LogoLogo
  • Introduction
  • Quick Start
    • Developing Cross Chain Dapps
      • Standard Relayer
      • Specialized Relayer
    • Tutorials
      • Hello Wormhole
        • Hello Wormhole Explained
        • Beyond Hello Wormhole
      • Hello Token
      • CCTP
        • USDC Transfers With Connect SDK
      • Simple Relayer
        • Advanced Relayer Example
    • Demos
    • Wormhole Connect: Bridging Made Easy
  • Explore Wormhole
    • Architecture
    • Security
    • Core Contracts
    • Guardians
    • VAAs
    • Relayers
    • Spy
    • Gateway
      • Onboarding
  • Reference
    • Constants Reference
    • Development Environment
      • Tilt
      • Tooling
    • Blockchain Platforms
      • Algorand
      • Aptos
      • CosmWasm
      • EVM
        • Relayer
      • Near
      • Solana
      • Sui
    • API Docs
      • Wormholescan API
    • SDK Docs
      • Legacy SDK
    • CLI Docs
    • Glossary
  • Wormhole Connect
    • Overview
    • Routes
    • Features
    • Configuration
  • Native Token Transfers
    • Overview
      • System Components
      • Deployment Models
    • Deployment
      • Installation
      • Deploy to EVM
      • Deploy to Solana
      • Post Deployment
    • Configuration
      • Rate Limiting
      • Access Control
    • Security
    • Custom Transceivers
    • Architecture
      • EVM Message Lifecycle
      • Solana Message Lifecycle
  • Queries
    • Overview
    • Getting Started
    • FAQs
  • MultiGov
    • Overview
    • Getting Started
    • Deployment
      • Configuration
    • Upgrading
    • Architecture
    • Guides
    • FAQs
  • External Links
    • Explorer
    • Ecosystem
    • Guardian Dashboard
    • Portal Bridge Docs
    • Discord
    • Twitter
    • Github
Powered by GitBook
On this page
  • The Flow of a Query
  • Supported Query Types
  • eth_call
  • eth_call By Timestamp
  • eth_call With Finality
  • sol_account
  • sol_pda
  • Supported Chains
  • Mainnet
  • Testnet
  • Next Steps

Was this helpful?

Edit on GitHub
  1. Queries

Overview

Last updated 1 year ago

Was this helpful?

💡 Queries are currently in closed-beta, though you can start developing today! Check out and reach out to

Wormhole Queries offer on-demand access to guardian-attested on-chain data.

The current implementation offers integrators a simple REST endpoint to initiate an off-chain request via a proxy which handles forwarding the request to the guardians and gathering a quorum of responses. The result consists of the encoded response (which includes the request details) along with the guardian signatures. These can then be verified on-chain.

Read more about Queries in the .

The Flow of a Query

  1. An off-chain process initiates a Query Request via HTTPS to the Query Proxy (a.k.a. CCQ Server) - e.g. a user clicks a button to interact with a contract which requires cross-chain data.

  2. The Query Proxy validates the request and forwards it to the guardians via a gossip network.

  3. The Guardians independently validate the request, make the requisite RPC calls, verify the results, sign, and gossip a response back to the Query Proxy.

  4. The Query Proxy aggregates the results and returns a response when it reaches quorum - 2/3+ of the current guardian set - the same quorum requirements as the core bridge.

  5. The off-chain process can then submit these to an on-chain contract which should verify the signatures and validate the request before processing the result.

In the flow above, the Query Proxy serves as a permissioned but trustless part of the protocol.

In most cases, this entire process takes less than one second! In the case where a request is invalid or cannot be successfully processed by the guadians, they will retry for up to one minute before timing out.

Requests can be batched to have the guardians make multiple calls to multiple networks. This can further reduce overhead for processing query responses on-chain.

Up to 255 queries can be batched together, with certain types allowing for batching themselves.

Supported Query Types

eth_call

Calls are batched to allow specifying multiple calls (even to multiple contracts) against the same block. These will be done in the same batch RPC call and are easier for the requestor to verify on chain. Up to 255 calls may be batched in an single eth_call query.

The result contains the specified block number, hash, and timestamp along with the call result(s).

eth_call By Timestamp

This query type is similar to eth_call but targets a timestamp instead of a specific block_id. This can be useful when forming requests based on uncorrelated data, such as requiring data from another chain based on the block timestamp of a given chain.

The result additionally contains the target and following block details with the following condition enforced.

target_block.timestamp <= target_time < following_block.timestamp
and
following_block_num - 1 == target_block_num

eth_call With Finality

This query type is similar to eth_call but ensures that the specified block has reached the specified finality before returning the query results. The finality may be finalized or safe. Note that in the case that a chain does not natively support the safe tag, this will be equivalent to finalized.

sol_account

sol_pda

Supported Chains

The following table provides expected support based on testing. However, the success of any given query is based on the success of the underlying call on each guardian’s RPC node.

Mainnet

Chain
Wormhole Chain ID
eth_call
By Timestamp
With Finality
Expected History

Ethereum

2

✅

✅

✅

128 blocks

BSC

4

✅

✅

✅

128 blocks

Polygon

5

✅

✅

✅

128 blocks

Avalanche

6

✅

✅

✅

32 blocks

Oasis Emerald

7

✅

✅

✅

archive

Fantom

10

✅

✅

✅

16 blocks

Karura

11

✅

✅

✅

archive

Acala

12

✅

✅

✅

archive

Klaytn

13

✅

✅

✅

128 blocks

Celo

14

✅

ℹ️ hints required*

✅

128 blocks

Moonbeam

16

✅

ℹ️ hints required*

✅

256 blocks

Arbitrum One

23

✅

✅

✅

~6742 blocks

Optimism

24

✅

✅

❌

128 blocks

Base

30

✅

✅

✅

archive

*EthCallByTimestamp arguments for targetBlock and followingBlock are currently required for requests to be successful on these chains.

Testnet

Next Steps

Need some examples?

There are currently 5 supported types of queries. See for more details on each.

Effectively an equivalent of against a block specified by number or hash.

This query is used to read data for one or more accounts on Solana, akin to .

This query is used to read data for one or more on Solana, akin to calling on the result of PublicKey.findProgramAddressSync(seeds, programId). This is useful for times when you want to more generally read accounts owned by a program and verify the derivation on another chain, like how associated token accounts are all derived from the .

For example, many chains have implementations forked from , which keeps 128 blocks of state in memory by default (without running in archive mode). While this is good for about 25 minutes of history on Ethereum mainnet, it is only about 3 minutes on Optimism. While guardian nodes can be expected to have access to recent state, there are currently no guarantees of how far back in history they have access to.

See the for the list of testnet chains.

Still have questions? See if they are answered in the .

Ready to dive in? Check out .

the whitepaper
eth_call
getMultipleAccounts
Program Derived Addresses
getMultipleAccounts
Associated Token Account Program
geth
Constants Reference
FAQs
Getting Started
Basic Demo
Solana Stake Pool
Solana PDA / Token Account Balance
Solana Queries Verification
Getting Started
Join the Beta
whitepaper