Axiom for Developers

How Axiom fits into your smart contract application

Axiom provides smart contracts trustless access to all on-chain data and arbitrary expressive compute over it. To integrate Axiom into your on-chain application, follow the following steps:

  • Specify a query into Axiom which computes over the history of Ethereum through our Javascript frontend for ZK circuits (see AxiomREPL to get started right in your web browser).

  • Export a client-side ZK prover for your dapp frontend that enables your users to verify the computation locally and send queries to the AxiomV2Query contract on-chain to verify the authenticity of the on-chain data inputs.

  • Implement a callback on your dapp smart contract to receive ZK-verified results from the AxiomV2Query contract.

Axiom is not an indexer or data aggregation service like The Graph or Covalent. Instead, dapps built with Axiom may use one of these services to find the data they want to prove with Axiom.

Where Axiom fits in

Here is a simplified stack diagram of where Axiom would fit into your on-chain application:

How to use Axiom

We've provided a general flow for a common way your app, third-party services, and Axiom can fit together. The user flow for Axiom involves the following steps:

  • Construct an Axiom query on your app frontend using the Axiom SDK. This will involve fetching inputs from a JSON-RPC node or indexer and generating a client-side ZK proof using our exported prover. Once constructed, users send the query on-chain to the AxiomV2Query contract.

  • Axiom will index the query, compute the result, and generate a ZK proof of validity. The result and proof are sent on-chain and verified in the AxiomV2Query contract.

  • Finally, Axiom will atomically call the user-specified callback on your smart contract with the ZK-verified results of the computation over the history of Ethereum. Your smart contract can then use these results trustlessly for your application.

A visual illustration of this flow is in the diagram below:

For more information, you can go through the Autonomous Airdrop example to see how all of the different parts fit together.

Last updated