TL;DR: Learn how the Substreams-based Atomic API revolutionizes blockchain data management by using Substreams and database integration for efficient data processing and analysis.
Hey there, let’s dive into the world of the Substreams-based Atomic API, which is crafted on two foundational contracts: AtomicAssets and AtomicMarket. AtomicAssets is a robust standard for creating and managing NFTs on Antelope blockchains, while AtomicMarket is an integrated market smart contract for trading these NFTs.
Together, they form the backbone of this API, originally developed to replicate market volume charts similar to those on AtomicHub. Imagine having access to every collection’s daily sales numbers and amounts, all neatly laid out for you in USD or the native chain token.
Keep reading to learn how this tool helps aggregate and analyze NFT data, offering detailed insights into trading patterns and asset values within the WAX and EOS NFT marketplaces.
Unpacking the technology behind NFT analytics
First up, we’ve got Substreams, a nifty tech from StreamingFast that transforms raw on-chain data into something we can easily use. We’re working with two Substreams here because we’re dealing with two contracts.
Next is the webhook sink. This process runs the Substreams and sends the data over HTTP POST requests. Keep in mind that you’ll need a separate webhook sink for each Substream and each chain. So if you’re dealing with two chains—that’s four webhook sinks in total for both the AtomicAssets Substreams and AtomicMarket Substreams.
The database of choice? ClickHouse using the ClickHouse sink. Check out our blog post where we introduce ClickHouse sink and how it can simplify blockchain data analytics with efficient data extraction and processing. The ClickHouse sink does the heavy lifting of inserting the data into your ClickHouse database.
The role of Substreams
Substreams is the backbone of the Atomic API, responsible for extracting and refining data from the blockchain. Its primary function is to transform raw data into a format that is more accessible and usable. A notable feature of Substreams is adaptability as it allows you to modify data fields. This lets you break down complex information into more manageable and insightful parts.
Graph Node compatible
The Substreams uses the [graph_out] module to stream Atomic events to the ClickHouse database. This [graph_out] map module is also compatible with Graph Node to create subgraphs.
Database integration: the core of API functionality
For the Substreams-based Atomic API to operate effectively, it requires the integration of specific tables in the database. These tables store critical information from the AtomicMarket and AtomicAssets contracts. The inclusion of these tables enables users to perform comprehensive queries, including sales data, and offers the flexibility to filter results based on parameters like template IDs, which are not originally present in the AtomicMarket smart contract.
Exploring the API: a journey through endpoints and queries
The Substreams-based Atomic API is equipped with various endpoints, each serving a unique purpose. The demonstration in the video is completed on Swagger.
- Health endpoint ensures seamless communication between the API and the ClickHouse database.
- Chains endpoint provides a selection of available chains in the database.
- Sales endpoint allows you to query sales data with an extensive list of filters to pinpoint specific transactions.
Our practical demonstration of these endpoints shows their effectiveness in retrieving and analyzing data. For instance, filtering sales for a particular collection on the EOS chain yields precise and comprehensive results, showcasing the API’s robustness.
Aggregation and metrics: enhancing data analysis
The aggregation feature of the Substreams-based Atomic API enables you to count and analyze sales volume for each collection. This tool is instrumental in replicating market volume charts, offering a granular view of transactional data.
The metrics endpoint provides valuable insights into API usage, such as the number of queries made, errors encountered, and rows read, which helps with effective API monitoring.
Final thoughts
Substreams are revolutionizing blockchain data management. This technology is key to simplifying complex blockchain data, making it more accessible. While the Substreams-based Atomic API is a remarkable example of what can be achieved with Substreams, it is important to understand that Substreams is the core innovation and the driving force behind the integration of blockchain data into user-friendly applications.
We encourage you to explore the capabilities of Substreams further by watching the video above and check out our GitHub repo, Awesome Substreams.
Very detailed, great demonstration and explanation. Gonna delve into some of those awesome substreams!