Specifying a Query into Axiom

Overview of an Axiom Query

Developers send queries to Axiom's on-chain contract requesting a ZK proof for a specific set of data they would like to prove. Queries can be built in AxiomREPL or with the Axiom SDK. See AxiomREPL and Quickstart for more details, or Autonomous Airdrop for a concrete example. Axiom V2 supports two types of queries:

  • Compute Query: This can be created through the AxiomREPL Javascript interface and supports general computations over the history of Ethereum.

  • Data Query: This can be created through the Axiom SDK and supports reading data only from the entire history of Ethereum.

Most developers will want to use the Compute Query; the Data Query is available for power users. Learn more about the two types of queries below.

Compute Query

Compute Queries are built in AxiomREPL, which allows developers to write custom ZK circuits in Javascript which make reference to historic on-chain data on Ethereum. AxiomREPL exports a client-side ZK prover for each compute query which allows users of on-chain applications to generate client-side proofs and send queries to Axiom.

Additional information can be found at AxiomREPL.

Data Query

In order to construct a Data Query, a developer can specify different subqueries for the types of data that they want. Learn more about the different types of subqueries at Data Subqueries.

Developers will need to do additional validation within their smart contracts to ensure aspects of query integrity before passing the data to Axiom.

Callback

A Query also includes a callback, which allows users to specify a smart contract that will receive the data after the proof is generated. For more information, see Handling Axiom Callbacks.

Last updated