What libraries are available for handling queries?

The Query TypeScript SDK can be used to create query requests, mock query responses for testing, and parse query responses along with some utilities for posting query responses.

The Solidity QueryResponse Abstract Contract can be used to parse and verify query responses on EVM chains. Simply forge install wormhole-foundation/wormhole-solidity-sdk. See the Solana Stake Pool repo as an example use case. The SDK also contains QueryTest.sol for mocking query requests and responses in forge tests.

The Go query package can also be used to create query requests and parse query responses.

💡 A Rust SDK for Solana is being actively investigated by the Wormhole Contributors. See the Solana Queries Verification repo as a proof of concept.

Are there any examples?

There sure are!

What is the format of the response signature?

The guardian node calculates an ECDSA signature using crypto.Sign where the digest hash is keccak256("query_response_0000000000000000000|"+keccak256(responseBytes)). See the Guardian Key Usage whitepaper for more background. This signature then has the guardian's index in the guardian set appended to the end.

💡 If you are used to ecrecover you will notice that the v byte is 0 or 1 as opposed to 27 or 28. The signaturesToEvmStruct method in the Query TypeScript SDK accounts for this as well as structuring the signatures into an IWormhole.SignatureStruct[].

Can anyone run a Query Proxy server?

The Query Proxy is currently permissioned by the Guardians. The guardian nodes are configured to only listen to a set of allow-listed proxies. However, it is possible that this restriction may be lifted in the future and/or more proxies could be added.

It is also important to note that the proxies do not impact the verifiability the request and result - i.e. their role in the process is trustless.

Last updated