Axiom V2 Docs Old
  • Introduction
    • What is Axiom?
    • Quickstart
  • Examples
    • Autonomous Airdrop
      • AxiomREPL Code
      • Contract
      • Web App
      • DataQuery-only Version
  • Developers
    • Axiom for Developers
    • Specifying a Query into Axiom
    • AxiomREPL
      • AxiomREPL Examples
    • Exporting a Client Side Prover
    • Handling Axiom Callbacks
    • Common Issues
      • Callback Debugging
  • SDK and REPL Reference
    • Axiom SDK Reference
      • QueryBuilderV2
      • Data Subqueries
        • Header Subquery
        • Account Subquery
        • Storage Subquery
        • Transaction Subquery
        • Receipt Subquery
        • Solidity Nested Mapping Subquery
    • AxiomREPL Reference
      • Circuit Types
      • Circuit Functions
      • Data Functions
      • Compute Functions
  • Protocol Design
    • Architecture Overview
    • Caching Block Hashes
    • Axiom Query Protocol
      • Axiom Query Format
    • ZK Circuits for Axiom Queries
    • Ethereum On-chain Data
    • Guardrails
  • Transparency and Security
    • KZG Trusted Setup
    • Contract Addresses
    • On-chain ZK Verifiers
    • Security
  • Zero Knowledge Proofs
    • Introduction to ZK
    • ZK Examples
    • Getting Started with halo2
    • halo2-repl
  • Additional Resources
    • Axiom V2 Explorer
    • Github
    • Website
    • Telegram
    • Discord
    • Axiom V1 Docs
Powered by GitBook
On this page
  • Where Axiom fits in
  • How to use Axiom
  1. Developers

Axiom for Developers

How Axiom fits into your smart contract application

PreviousDataQuery-only VersionNextSpecifying a Query into Axiom

Last updated 1 year ago

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 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 to see how all of the different parts fit together.

Autonomous Airdrop example
AxiomREPL
Simplified stack diagram of where various pieces of the stack sit
One common system diagram of a on-chain application using Axiom to generate ZK proofs of historical data