What are ZettaBlock APIs?
There are 3 types of API ZettaBlock provides.
Custom API
Custom API is the GraphQL API endpoint that you can build using ZettaBlock’s API Builder via SQL. For example, you can create a Custom API for ETH weekly deposited to Beacon following this recipe.
You can build your own GraphQL API via our API Builder UI, and the CLI terminal will be supported soon. For details, please refer to API Builder.
Performance
The custom GrahQL API is real-time (100ms latency), cost-effective (1000X cheaper than analytics API), and can handle high QPS. Those attributes make it a perfect solution for public-facing needs such as APIs empowering your consumer-facing dApps.
Besides, you can fine-tune the GraphQL API’s performance by configuring incremental data refresh and indexing fields.
Use Case
Build user-facing APIs for you dApp. Examples coming soon.
Data Lake API
Data Lake API is the analytics API that you use to interact with ZettaBlocks’s data lake. You can use it to submit arbitrary SQL queries to the data lake and fetch results accordingly. For example, in this recipe, you can submit a SQL to check the latest block from Ethereum. For large volume results, you can also use the stream mode to access and write to a file.
Performance
Data Lake API is good for arbitrary SQL queries and data analytics use cases but not suitable for end-use facing scenarios. In short, analytics API is 1000X slower and more expensive than transactional API (i.e., Custom GraphQL API here) for the same user facing use case.
Use Case
Ad-hoc SQL query based on your analytics questions. Examples coming soon.
Pre-built API (Alpha)
Pre-built API is a collection of GraphQL API endpoints built and curated by the ZettaBlock Team and Community. Pre-built APIs are aimed at serving common query and metrics needs, so you don’t have to duplicate the effort. Currently, the pre-built API includes:
- Token API: token price, metadata, etc.
- NFT API: NFT transactions, ownership, metadata, etc.
- Blockchain API: low-level blockchain data such as transactions, blocks, fee history, etc.
Performance
Similar to any other custom GraphQL API you can build on ZettaBlock: real-time, cost-effective, and can handle high QPS.
Use Case
Common query needs for blockchain data. Examples coming soon.
How to use ZettaBlock API
Get Started with ZettaBlock
If you’re completely new to ZettaBlock, you can start with Quickstart (Coming soon).
Get Started with ZettaBlock API
For how to get started with ZettaBlock API specifically:
- Custom API & Pre-built API: you can start with "User Facing API Query"
- Data Lake API: you can start with "SQL Query to Data Lake in Python"
API Key
How to get your API key
Please check API Key guide (Coming soon) for detail
How to manage your API Key and Usage
Please check API usage guide (coming soon) for more details.