SubQuery November Technical Update: EVM and Manifest Updates
Read more for our technical deep dive into the latest release of SubQuery
Support for External Chain Type Files in Project Manifest
Today is the launch of version 0.2.0open in new window of our project manifest file (
project.yaml). This new version provides developers with various improvements that have been requested by customers.
Most importantly, you can now reference a chain type definition file that has all the custom types included when you’re indexing a custom substrate chain. This quickly allows you to connect a new SubQuery project to any substrate based chain, including all of Kusama’s parachains. This should be a standard chain type file that declares the specific types supported by this blockchain in either
This solution allows you to avoid copying and managing chain type definitions in the manifest itself, and allows you to just clone the published chain type files listed in repositories like PolkadotJSopen in new window.
Moonbeam EVM Support
Today we are following up on that announcement with all the developer resources that you need to get started.
Currently, there is no open-source tool which allows developers to flexibly collect and query data across both Ethereum and Polkadot/Kusama. This limitation can cause dApps solutions within Moonriver to be siloed into the smart contract layer and thereby limit their potential to consumers across both thriving networks. This partnership with Moonbeam brings a complete and unified data indexing solution for all blockchain data within Moonriver and will greatly benefit Moonriver’s growing application ecosystem.
SubQuery is going to be a guest on the next Moonbuilders Workshop on Wednesday December 1st, register for it hereopen in new window.
Firstly, familiarize yourself with the updated documentation on how to connect to and index data from Moonbeam, Moonbase Alpha, and Moonriver.open in new window The process to index Moonbeam data is only two steps:
Step 1: Add the Moonbeam Custom Data Source
We have created a data processor specifically made to work with Moonbeam’s implementation of Frontieropen in new window. It allows you to reference specific ABI resources used by the processor to parse arguments and the smart contract address that the events is from or the call is made to. You can read more hereopen in new window.
SubQuery introduces more advanced filters than other indexers, allowing filtering of non-contract transactions, transaction senders, contracts and indexed log arguments. This allows developers to build a wide variety of projects that cater to their specific data needs.
Step 2: Index Moonbeam Data
Just like a normal SubQuery project, you use a mapping function to transform off chain data to the GraphQL entities that you define, the difference is that instead of a
SubstrateExtrinsic, your mapping function will receive a
MoonbeamEvent which are based on Ether's TransactionResponseopen in new window or Logopen in new window type. You can read more about these hereopen in new window.
There is a complete example project that indexes eth
transfer events and
approve smart contract calls. The code for this example project is here on GitHubopen in new window or accessible via the live SubQuery project on SubQuery Explorer hereopen in new window.
The bulk of the changes happen in the Manifest file (
project.yaml). You can see below that we have extended call filtersopen in new window to support either function signature stringsopen in new window or the function sighash to filter the function called on the contract. For event filtersopen in new window, you can use topics filtering that follows the Ethereum JSON-PRC log filters standard found hereopen in new window. Note that SubQuery introduces more advanced filters than other indexers for Moonbeam EVM and these improvements should significantly benefit developers.
If you are familiar with how Substrate based SubQuery project are made, you’ll notice how similar the mapping functions are for the new Moonriver support. Each mapping function receives a
MoonbeamEvent and processes them just like any other SubQuery project.
As you can see, creating a Moonriver or Moonbase Alpha project that indexes both Substrate and EVM data in a single project is extremely simple and largely similar. You can use SubQuery’s advanced scaffolding tools to speed up your dApp development and take advantage or richer indexing for you data to build more intuitive dApps. We can’t wait to see what you build!
SubQuery is a data aggregation layer that operates between the layer-1 blockchains (such as Moonriver and Polkadot) and DApps. This service unlocks blockchain data and transforms it to a queryable state so that it can be used in intuitive applications. It allows DApp developers to focus on their core use case and front-end, without needing to waste time on building a custom backend for data processing.
Linktreeopen in new window | Websiteopen in new window | Discordopen in new window | Telegramopen in new window | Twitteropen in new window | Matrixopen in new window | LinkedInopen in new window | Githubopen in new window | YouTubeopen in new window
Moonbeam is an Ethereum-compatible smart contract platform on the Polkadot network that makes it easy to build natively interoperable applications. This Ethereum compatibility allows developers to deploy existing Solidity smart contracts and DApp frontends to Moonbeam with minimal changes. As a parachain on the Polkadot network, Moonbeam will benefit from the shared security of the Polkadot relay chain and integrations with other chains that are connected to Polkadot. Currently in active development by PureStake, Moonbeam is expected to reach MainNet by Q4 2021. Learn more: https://moonbeam.network/open in new window.