Introducing Interchain Queries

Quasar.fi
5 min readOct 19, 2022

--

Blockchains aspire to be self-contained state machines, relying purely on internally generated data. This self-contained design is ideal for maintaining an enclave of verifiable data, but the siloed architecture makes it challenging for blockchains desiring to integrate external sources of truth. When outside information needs to be utilized within a chain (e.g. fetching price of external asset, weather temperature, result of election etc.), it can require exposing the network to the risk of a centralized, corruptible source of truth which could compromise the integrity of the on-chain data. Bringing real-world data on-chain, known as the oracle problem, has historically been a key challenge for consumer blockchain applications.

The primary solution to date for the oracle problem has been to rely on 3rd party oracle services. Oracle services, often distributed networks themselves, retrieve and verify external data for blockchains and smart contracts through methods such as web APIs or market data feeds. While oracle services have been useful, they are merely a stop-gap and still susceptible to manipulation. In 2021 over $100M was stolen from DeFi protocols due to oracle manipulation.

In collaboration with Polymer Labs and Strangelove Ventures, Quasar is helping build a new, permissionless system for sharing information between blockchains using the IBC standard (Inter-Blockchain Communication), known as Interchain Queries (ICQ).

Several IBC standards have been created in the last couple of years to help standardize how blockchains can communicate with each other and unlock new composable utilities. For example, ICS20 — Fungible Token Transfers is an IBC standard for transferring fungible tokens between chains connected with IBC channels. Importantly, ICS20 preserves fungibility and ownership, cross-chain, in a permissionless way, unlike ad-hoc bridges. Another IBC standard is, ICS27 — Interchain Accounts (ICA), which enables the creation and control of accounts on a remote chain executed from an account on a separate, controller chain. With these IBC standards, different blockchains are now able to exchange data and modify the state of the other’s. This new composability has spawned new applications in areas like DeFi, and we’re proud to announce a new addition, Interchain Queries (ICQ)

Interchain Queries (ICQ) are the next innovation in line and a core piece to cross-chain composability. Queries, in general, read on-chain data. You may want to query, for example, a token balance for a specific account on some chain (chainA). Typically, a query provided directly to a client node running the binary for chainA can simply return the answer to this query. But what if you needed to query chainB to perform some transaction on chainA ? These are two entirely different blockchains, with different binaries, and validator networks. How can we validate the data from a different chain in a trust-minimized way? We designed ICQ to solve this data sharing challenge. With ICQ, queries are packaged as an IBC packet on the querying chain. With an IBC channel established with the target chain, the IBC packet carrying the query is simply sent to the target chain with the help of relayers. On arrival, the IBC packet is unpacked by the ICQ module to reveal the query which is then executed on the application layer of the target chain, just as normal domestic queries within a homogenous blockchain network. Finally, the response of the query is sent to the querying chain within the returned IBC packet acknowledgement. Voila! Reading a blockchain’s state with a query that originated from a different chain is now possible!

Here’s a light overview of how ICQ works. For clarity let’s call the chain that sends the query the “home chain” (chainA in the diagram) and the chain that receives the query the “satellite chain” (chainB in the diagram)

  • A node on the querying chain (chainA) first constructs an IBC packet. The IBC Packet is then sent over the established IBC channel via realayers to a node on the satellite chain(chainB) where it is received by their ICQ module
  • The ICQ module opens the packet, checks the query and routes it to the appropriate application module on chainB
  • Using the relevant data, the satellite chain (chainB) creates a structured response
  • Lastly, through the ICQ module, the response is then sent back to the home chain.

Note that ICQ is an open source standard which can be implemented in a variety of ways either utilizing a native ICQ module or relying completely on IBC-enabled smart contracts.

In the next article in this series, we will dive deeper into the specific mechanics behind implementing ICQ with examples! We are excited to demystify ICQ for the broader IBC community to help engender new and exciting cross-chain applications!

We are proud to work with our friends at Polymer Labs and Strangelove Ventures to contribute Interchain Queries to the larger Cosmos Hub.

About Quasar

Quasar is the home of next-generation DeFi investment opportunities, powered by expert and community driven strategies. Quasar is democratizing DeFi by making it fair, simple and transparent. By lowering the barriers to entry of vault management, Quasar allows individuals to easily participate in DeFi without having to manage the underlying strategies themselves and strategists to earn profit based on their performance. Expert driven strategies — For the many, not the few.

About Strangelove

Strangelove Labs is a core developer and implementer within the Cosmos ecosystem. Strangelove Labs contributes to core open source software enabling Cosmos infrastructure, provides advisory and implementation services to projects launching on Cosmos, and offers a full suite of infrastructure-as-a-service products. Additionally, Strangelove Labs is an active venture investor in the Cosmos ecosystem through their partnership with Galileo, an early-stage crypto venture firm built to support the expanding Cosmos + Celestia IBC ecosystems. Learn more at strangelove.ventures

About Polymer

Polymer Labs is the first modular IBC-based networking protocol, establishing IBC as the leading open-source interoperability solution across the blockchain industry. The Polymer team, primarily made up of experienced web2 infrastructure builders, is a core contributor to Cosmos open sourced code. The Polymer chain enables IBC connectivity across all integrated chains with trustless architecture based on light client state proof verification.

--

--

Quasar.fi

Home of the first Interchain Smart Contracts and the only CL vaults on Osmosis. Interchain Yield Aggregation - evolved. D.A.M cool too. $QSR on Osmosis