Query cross-chain data and receive verification for on-chain use
interchainqueries
module for the Neutron network.
Interchain Queries allow developers to get verifiable data from other blockchains. This feature is essential for creating secure cross-chain applications. The module uses Merkle proofs and IBC clients to confirm the accuracy of the data retrieved directly from the storage of the target blockchain. It allows any smart contract to register Interchain Queries without needing any special module on the target blockchain.
interchainqueries
module, which forwards it to the smart contracts for processing.
This entire process is called Interchain Query execution, and the step where the data is delivered is known as Interchain Query result submission. The interchainqueries
module provides endpoints and emits specific events to make the relayer’s job easier. You can find more details about these events and endpoints in the Reference section.
An Interchain Query relayer submits a query result using the SubmitQueryResult endpoint of the interchainqueries
module. Through this endpoint, the interchainqueries
module verifies the result and triggers the corresponding sudo handler in the smart contract that owns the Interchain Query. The smart contract uses this handler to process the query result, reacting to the new data received from the target chain.
Another similarity between the interchainqueries
module and IBC is the use of IBC clients. All Interchain Queries involve reading data from a remote chain’s storage, and this data is verified against the ConsensusState
of an IBC client connected to that chain. During result submission, the interchainqueries
module checks the submitted storage values using the provided proofs, comparing them against the ConsensusState
of the IBC client on the Neutron side. This ensures that the authenticity of the retrieved data is guaranteed by the IBC protocol.
Warning: There is a known bug when querying empty or nil values with KV-queries. If the value under a key is empty or nil, the query will not return any result. This limitation should be considered when designing applications that depend on KV-queries.
RemoveInterchainQuery
message can be executed by:
latest query result submission height + (query update period) * 20
Deep dive into how Interchain Queries work and their verification mechanisms
Step-by-step instructions for using Interchain Queries in your contracts
Comprehensive technical reference including API, messages, events, state, and CLI
Known issues and limitations of the ICQ module