Today we are proud to release our support for Ethereum. In this article we share a detailed developer guide for the Ethereum community to use to solve their data indexing needs, including how to migrate from The Graph or use our Managed Service.
SubQuery is an open data indexer that is designed to be flexible, fast and provide universal coverage. Our open indexing tool empowers developers to;
- Build their own API in hours
- Index chains incredibly quickly with the assistance of dictionaries (pre-computed indices)
- Take advantage of multi-threading and optimisation of the store to reduce costly database writes.
Our experience with customers across all verticals in Polkadot, Cosmos, Algorand, NEAR and Avalanche (wallets, networks, explorers, NFT, DeFi, scanners, etc) has helped us build the best Indexer for Developers in web3.
Our Ethereum support is still in its beta, and while we’ve completed considerable testing to ensure that it’s stable, we have further improvements to massively increase the performance and features. Watch this space!
Why Use SubQuery?
SubQuery also brings some major improvements to existing decentralised indexing solutions, including users of The Graph. For one, SubQuery is far more flexible with the ability to make external API calls or import external libraries from within your mapping functions, and better controls to run your projects in your own infrastructure with automated DOS (denial of service) mitigation controls. Additionally, we have no plans to sunset our managed service.
Both SubQuery and The Graph are designed to index data fast, but analysis shows that the existing beta support from SubQuery is already 1.85x faster for common projects over The Graph (e.g the standard Ethereum Name Service project). This adds up when you’re indexing millions of blocks, and is something to consider when choosing your indexer. SubQuery achieves this by using mulit-threading and optimisation of the store to reduce costly database writes. With faster sync times, developers can iterate faster and deliver features to market quicker.
At SubQuery we have an open-source SDK that is easy to use and lightning quick. It provides you with a standard GraphQL endpoint, or you can just query the postgres database directly. With it you can index a unique set of data from your own smart contracts that allows you to build a superior product that blows your competition out of the water! We give you flexibility to get the data that you need in the shape that works best for you.
Reliability is key, and you need a reliable and scalable platform to host it. SubQuery’s managed service is an industry leading hosting solution for all customers that is serving hundreds of millions of daily requests to the biggest projects in Polkadot. We provide our enterprise level customers with services such as dedicated databases, redundant clusters, intelligent multi-cluster routing, and advanced monitoring and analytics. It will support your application when you are ready and will scale with you. Unlike The Graph, we have no plans to sunset our Managed Service.
And finally, in a few months you’ll be able to completely decentralise your SubQuery infrastructure with the SubQuery Network, the future of Web3 infrastructure. The SubQuery Network will index and service your projects data to the global community in an incentivised and verifiable way. It is designed to support any SubQuery project from any layer-1 network including Ethereum, so you can take advantage of the scale of the unified SubQuery Network from launch.
Read more about the advantages of SubQuery over other options here.
The best way is to start with our starter project which contains a running project with an example of all mapping functions. You’ll need to install a recent version of @subql/cli via npm i -g @subql/cli@latest to access this.
If you don’t want to see a kitchen sink example, you can follow a step by step guide on how to create a real world example. Follow our quick start tutorial to see how to index all Ethereum Gravatars created or updated on the Ethereum network in less than 15 minutes.
If you’re already familiar with the Graph, you can jump right to a slightly more complicated quick start tutorial with the Ethereum Name Service project, which indexes all ENS Records in the ENS registry
With SubQuery’s Ethereum integration, there are three types of mapping handlers:
- BlockHandler: All blocks and their hash and height
- TransactionHandler: All transactions and their hash, height, and timestamp
- LogHandler: On each and every log that matches optional filter criteria, access various data from the Ethereum logs
We’ve updated the SubQuery Documentation to add Ethereum specific information to the general SubQuery documentation. This includes an excellent migration guide to help you move your projects from a SubGraph to a SubQuery Project.
Our Ethereum Support
As part of our multi-chain ambitions, we are planning to support the entire EVM ecosystem. Our first implementation starts specifically with Ethereum mainnet where we have completed most of our testing and confident that this works.
However, we are confident that this SubQuery implementation should work seamlessly with most other EVM chains. While SubQuery’s Ethereum support begins with Ethereum, look out for us soon on other leading EVM chains and layer-2 scaling solutions, like Polygon, BNB, and Arbitrum.
Migrating From The Graph
When we set out to build SubQuery, we always planned to massively improve on the developer experience of other providers, like The Graph, while ensuring that it was as easy as possible to migrate.
Ethereum developers can benefit from the superior SubQuery experience, including the open-source SDK, tools, documentation, and developer support that the SubQuery ecosystem provides. Additionally, SubQuery’s Ethereum implementation has been designed to operate almost identically to existing EVM support from other networks that SubQuery already supports, including Avalanche, Flare, Cosmos (Ethermint), and Polkadot (FrontierEVM).
If you are an existing user of The Graph, you can follow the guide here to migrate your project to SubQuery and supercharge your indexing today.
Deploying your Project to SubQuery’s Managed Service
Although you will always be able to run your project in your own infrastructure easily, SubQuery’s Managed Service now supports Ethereum projects. Some of the biggest projects depend on SubQuery’s enterprise level managed service and now you can too. To celebrate our launch, the first 20 Ethereum projects hosted on the SubQuery Managed Service will receive Standard plan hosting for 3 months for free.
You can follow the guide here to publish your Ethereum SubQuery project to our managed service.
You can update your managed service project as much as you want. We even have a staging deployment slot to allow you to do seamless blue/green upgrades without any downtime. This staging slot can also be used to run a clean instance of SubQuery with a fresh database for complete background reindexing of your project. Customers usually link the staging slot to the staging/development versions of their applications.
Once deployed, you can access your project using the SubQuery Explorer, and make requests directly from your app to the provided GraphQL endpoint. Let us know if you would like us to enable more advanced features like GraphQL subscriptions, more complex queries, and aggregation functions.
SubQuery’s Support for Ethereum
Today we are sharing the following:
- Advanced Indexing of blocks, transactions, and logs
- Full support for Ethereum in our free enterprise level managed service
- Intuitive documentation in the SubQuery Documentation
- Two quick start guides for Gravatars and the Ethereum Name Service
- An Ethereum Dictionary: Pre-computed indices to dramatically reduce indexing time
In the coming weeks you can expect:
- A step by step learning course in the SubQuery Academy
- Full support for Ethereum in our decentralised SubQuery Network
If you have any questions, please reach out to Sean Au or James Bayly or contact our Discord Technical Support
SubQuery is a blockchain developer toolkit enabling others to build Web3 applications of the future. A SubQuery project is a complete API to organise and query data from layer-1 chains. Currently servicing Polkadot, Substrate, Algorand, Cosmos, NEAR, Avalanche, and now Ethereum projects, this data-as-a-service allows developers to focus on their core use case and front-end, without needing to waste time on building a custom backend for data processing. The SubQuery Network proposes to enable this same scalable and reliable solution, but in a completely decentralised way.
Linktree | Website | Discord | Telegram | Twitter | Matrix | LinkedIn | YouTube