This article offers a detailed tutorial on setting up a multi-chain indexer to index Inter-Blockchain Communication (IBC) transfers among Cosmos Zones. The guide illustrates the integration of bidirectional transfers between Osmosis and Cosmos Hub, emphasising the ease of adding more chains.
By following this tutorial, you will develop an understanding of efficiently correlating event data across multiple networks. Additionally, you will learn how to configure a SubQuery indexer to monitor, track, and aggregate events from diverse Cosmos blockchains into a unified entity.
Example
The IBC sample project gathers data related to the IBC transfers. Key resources:
Use-Cases
Upon starting the project, you'll have the option to initiate queries. In this scenario, we can retrieve a `BridgeEvent` entity, which holds details about the transfer execution on both ends. The entity will be fully populated only after successful indexing on both sides. Let's proceed to query this object:
query {
bridgeEvents {
nodes {
id
senderId
receiverId
sourceChain
sourceChainTransaction
destinationChain
destinationChainTransaction
amount
}
}
}
After the execution, the result will resemble the following:
{
"data": {
"bridgeEvents": {
"nodes": [
{
"id": "2443408",
"senderId": "cosmos1nlj3wgunmjehnpue8a98wsflnx26tfhxmhfzhc",
"receiverId": "osmo1ln7rurzjr4x5403qhpyuma0x53dgkzkk0vewf3xr7rc24s57yzvshuqzdv",
"sourceChain": "cosmoshub-4",
"sourceChainTransaction": "3002CF4484AB82F8F995CC54FDD5B359327F89D861A0F9A7EF17475554A4BC8B",
"destinationChain": "osmosis-1",
"destinationChainTransaction": "9B98ED344801C4EB22047E455F36435FC008192985151B7DA70EA67246E1AD04",
"amount": "3000000"
}
]
}
}
}
In this response, you can check the specifics of the transfer execution, encompassing details unique to each network participating in the process.
Furthermore, when you combine multi-chain capabilities with aggregations, it opens up significant possibilities for cross-chain analysis without a need to exit the GraphQL interface to gain insights into specific subject matters.
About Cosmos SDK and IBC Transfers
The Cosmos SDK is an open-source framework for building multi-asset public blockchains, like the Cosmos Hub, as well as permissioned Proof-of-Authority blockchains. Blockchains built with the Cosmos SDK are generally referred to as application-specific blockchains.
The goal of the Cosmos SDK is to allow developers to easily create custom blockchains from scratch that can natively interoperate with other blockchains. SDK-based blockchains are built out of composable modules, most of which are open-source and readily available for any developers to use.
In the context of Cosmos, the Inter-Blockchain Communication (IBC) protocol is a core technology that enables interoperability between blockchains built with the Cosmos SDK and other compatible blockchains. Interoperability allows for increased collaboration, innovation, and value creation across different blockchain ecosystems.
About SubQuery
SubQuery Network is innovating web3 infrastructure with tools that empower builders to decentralise the future. Our fast, flexible, and open data indexer supercharges dApps on 120 networks, enabling a user-focused web3 world. Soon, our Data Node will provide breakthroughs in the RPC industry, and deliver decentralisation without compromise. We pioneer the web3 revolution for visionaries and forward-thinkers. We’re not just a company - we’re a movement driving an inclusive and decentralised web3 era.
Linktree | Website | Discord | Telegram | Twitter | Blog | Medium | LinkedIn | YouTube