3 Use Cases for Real-Time Blockchain Analytics

September 20, 2022

,

Introduction

Cryptocurrencies and NFTs have helped bring blockchain technology to the mainstream over the last few years, driven by the potential for astronomic financial returns. As more users become familiar with blockchain, attention and resources have started to shift towards other use cases for decentralized applications, or dApps. dApps are built on blockchains and are the use case layer for web3 infrastructure, offering a wide range of services. As dApps increase in popularity, the need for blockchain analytics is becoming more and more apparent. This blog discusses some emerging use cases for real-time blockchain analytics and some key considerations for developers building dApps.

dApps and Blockchain Analytics

dApps are how users engage with the underlying blockchain infrastructure, with the most common dApps allowing users to buy and sell crypto and NFTs. Substantial development in the space over the last few years has seen other dApps, including DeFi, gaming, social, and many others, explode in popularity. However, analyzing the data generated on the blockchain by these dApps is challenging. The appeal of blockchain - namely, open access, permissionless access, privacy and transparency - renders the on-chain data relatively basic, with only simple transaction details recorded. On-chain data has to be tied back to relevant off-chain datasets, which can require complex JOIN operations which lead to increased data latency. These challenges have led to blockchain analytics that are generally tailored for individual users and their specific needs in order to limit the effort and expense of joining multiple datasets at scale.

dune_analytics Image Source

There are several companies that enable users to analyze on-chain data, such as Dune Analytics, Nansen, Ocean Protocol, and others. Many of these services, as well as the dApps they may support, are built on transactional (OLTP) databases such as PostgreSQL, DynamoDB, MongoDB and others. While OLTP databases offer great performance for transactional workloads, it becomes challenging and inefficient to meet the analytics demands of dApps that need to parse ever increasing amounts of data. These databases struggle to serve low latency results during high demand periods, when a lot of users are simultaneously querying data. Developers need to support the same high performance, but with a significantly larger user base. Real-time blockchain analytics enable sub-second, user facing queries even as the number of concurrent users grows and data size increases. While blockchain analytics is still in its infancy, we have seen several intriguing use cases for real-time blockchain analytics.

Embedded content: https://www.youtube.com/embed/QgrYj7wJQ50

NFT and Crypto Price Analysis

Although blockchain data is open for anyone to see, it can be difficult to make that on-chain data consumable for analysis. Each individual smart contract can have a different data schema, making data aggregation challenging when analyzing hundreds or even thousands of contracts. Crypto/NFT exchanges and analytics services allow users to analyze the relevant smart contract data using a few different approaches. One method is to create a new database table for every smart contract function. While this reduces the complexity of handling different schemas, each smart contract can have 30+ functions and there are tens of thousands of smart contracts. Other companies store all the smart contract data in one table and then use aggregation frameworks to simplify the data storage.

wallet_connections Image Source

Regardless of the approach, these companies typically expose the data to users by allowing them to write custom SQL queries. They enable users to monitor transactions and uncover trends in real-time across different blockchains and tokens to make better investment decisions. Information such as the number of holders of a particular NFT or the most popular NFT collections become much easier to query in real-time. Along with the companies listed in the previous section, there are multiple other platforms such as Messari, Coin Metrics, and NFTGo that allow users to track and analyze various cryptocurrencies and NFTs. These platforms alleviate the time-consuming task of retrieving data from multiple chains and make the relevant data easily accessible and queryable. In a market that can be heavily influenced by external factors such as government regulations, social media influence, and other asset prices, it is imperative that investors have the ability to analyze and react in real-time.

Gaming

Blockchain gaming has grown rapidly in recent years, and the industry has held strong, despite the recent downturn in the crypto market. Gaming accounts for 52% of all unique active wallets, increasing 2000% from Q1 2021 to 2022. These “play-to-earn” games provide players with tokens that represent unique in-game items such as new characters, skins, and other items. Managing that ecosystem becomes challenging as a game’s popularity grows and developers have to regulate the token supply at scale, in real-time. Tens of thousands of players may be opening loot boxes, purchasing packs, or defeating levels, all earning NFTs at the same time.

We have seen companies implement real-time analytics to provide NFT product recommendations for card-based blockchain games, suggesting relevant packs for each user. These games also show live pricing for different NFTs, allowing users to have up-to-the-second information on the price of their owned cards and of those on the marketplace. The games also utilize real-time analytics to read smart contracts to “score” in-game competitions based on real-world events. These scores are then updated in real time on leaderboards, showcasing the performance of tens of thousands of users at a time.

web3_gaming Image Source

Blockchain game assets allow complete player ownership and verification of an items’ value. The items are tied to the underlying blockchain through NFTs, which can be traded directly with other users. Developers will need to implement robust real-time analytical capabilities to provide a seamless gaming experience and successful inventory management of in-game items. Personalized recommendations for players purchasing in-game items will improve the player experience and will require the ability to analyze real-time user activity to derive user intent, at scale.

Oracles

Blockchain oracles are services that connect smart contracts with off-chain data, providing a connection between on-chain data and external systems. They increase the utility of smart contracts by expanding their scope to interact with sources existing outside a blockchain. The most common oracle used today is an Input or Inbound Oracle that brings off-chain data onto a blockchain; for example many crypto exchanges use off-chain price data and bring it on-chain to display price information to users. Chainlink is the most popular Oracle, providing a range of feeds such as price feeds, weather data, and others.

web3_oracles Image Source

Oracles ingest data and join data from multiple data sources and have to provide low latency, high throughput data access to achieve the scale and performance required for their applications. Oracles are also utilized for their ability to perform complex computations off-chain, which would be prohibitively slow and expensive on-chain. To continue the gaming example from the previous section, off-chain computation can be used to introduce randomness to a game’s logic, creating more dynamic and exciting gameplay. Or for another example, a smart contract may be triggered by a construction material delivery; the contract would need a way to filter and search across fields in the delivery ticket data, and the contracts would need to be executed in seconds to confirm contract completion. Even on Web2 technology, this requires robust real-time analytics capabilities; with off-chain computing, Oracles can now provide these same capabilities to smart contracts.

Key Considerations for Real-Time Blockchain Analytics

Current platforms for blockchain analytics generally target individual users running a small number of queries and limit the number of concurrent queries that can be processed. This is useful, but as analytics needs expand, developers will need a platform that can keep up with performance expectations. Some of the key considerations for building a dApp with real-time analytics capabilities are:

Fast, Efficient Queries

  • As a dApp’s user base grows, its associated real-time analytics platform must handle 1000+ concurrent queries with sustained performance. Compute resources should scale as needed to support high concurrency at peak periods, while still providing sub-second query latency.

Schemaless Ingest

  • Data for dApps comes from a variety of sources, ranging from multiple blockchains to an almost infinite number of off-chain sources. To make this data easily queryable, it’s common to build hard-to-maintain ETL pipelines. Databases supporting schemaless ingest, on the other hand, can represent semi-structured data, nested objects and arrays, mixed types, and nulls, making ingest far easier for data with varying shapes and obviating the need for data prep.

JOINs and SQL

  • As mentioned, data for dApps comes from a plethora of on and off-chain sources. Joining data from these disparate sources can be challenging and time consuming; platforms that use common programming languages like SQL – with JOINs – will go a long way to enable painless analytics.

Quick Development and Iteration

  • The dApp environment is still evolving and developers need to be able to quickly respond to user needs and market dynamics. New coins and NFT projects may quickly rise in popularity or new use cases may unfold. Solutions should give developers operational simplicity and the ability to iterate quickly.

Despite the relative infancy of blockchain analytics, there are many developers and dApps that are entering the industry with creative ideas and approaches. In fact, blockchain data is perfectly set-up for more developed analytics capabilities: data structure, integrity and traceability are core to the technology - these features are some of the biggest roadblocks for conventional data analytics.

Rockset can provide developers with the necessary capabilities to build a fast and efficient real-time blockchain analytics platform. Our customers iterate faster, building data apps in weeks, not months, regardless of the shape of their data. Learn how growing companies deliver fast, fearless queries at scale at rockset.com.