Today we are proud to release our support for Polygon, a popular Layer 2 scaling solution for Ethereum. In this article we share a detailed developer guide for the Polygon 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 data from Polygon (and many other chains) incredibly quickly with the assistance of dictionaries (pre-computed indices)
- Take advantage of multithreading and optimisation of the store to reduce costly database writes.
Our experience with customers across all verticals in Ethereum, Polkadot, Cosmos, Algorand, NEAR, Flare and Avalanche (wallets, networks, explorers, NFT, DeFi, scanners, & more) has helped us build the best Indexer for developers in Web3.
Our Polygon 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!
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 all deposit and withdrawals made to the Polygon Plasma bridge from the Ethereum network in less than 15 minutes.
With SubQuery’s Polygon 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 Polygon Support
As part of our multi-chain ambitions, we are planning to support the entire EVM ecosystem. So far we support the Ethereum mainnet and Polygon 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 and Polygon, look out for us soon on other leading EVM chains and layer-2 scaling solutions like 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 Polygon 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. The migration from a SubGraph to a SubQuery Project is (by design) easy and quick. It may take you an hour or two to complete the migration, depending on the complexity of your SubGraph.
If you would like to find out more about how SubQuery compares to other popular indexers, read our Indexer Comparison article.
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 Polygon projects. Some of the biggest projects depend on SubQuery’s enterprise level managed service and now you can too.
You can follow the guide here to publish your Polygon 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 Polygon
Today we are sharing the following:
- Advanced Indexing of blocks, transactions, and logs
- An excellent quick start tutorial that takes you through the Polygon SubQuery indexer
- Full support for Polygon in our free enterprise level managed service
- Intuitive documentation in the SubQuery Documentation
- A Polygon 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 Polygon 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 Ethereum, Polygon, Polkadot, Algorand, Cosmos, NEAR, Avalanche, and Flare 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