Author: Yi Sun, Axiom; Translation: 0xjs@金财经
Axiom V2 is now online on the Ethereum mainnet on January 22. Axiom allows smart contracts to compute more data in a trustless manner, including Ethereum’s entire historical data. We believe that the high cost of data access is a key bottleneck of smart contracts. By removing this bottleneck with ZK, we aim to empower developers to build data-rich on-chain applications.
Axiom V2 adds support for transactions, receipts and Solidity mapping to previously available accounts, contract storage and block headers, meaning Ethereum’s full history is now available on-chain through Axiom . Developers query this history in Typescript using the Axiom SDK, which now supports user-specified calculations on any combination of data types and blocks. With our new universal validator, receiving on-chain ZK-validated results from Axiom only requires implementing a single callback in the smart contract.
We make it easy for you to use Axiom in smart contracts – it only requires Solidity and Typescript – and you can query Axiom by sending transactions directly on-chain. To give it a try, run npx create-axiom-client to launch the launch repository or check out our developer documentation at docs.axiom.xyz. You can view our contracts on Ethereum mainnet and Sepolia here, and view queries for Axiom at explorer.axiom.xyz.
While releasing the V2 version, we migrated the Axiom V2 test network from Goerli to Sepolia and deprecated Axiom V1 on January 22, 2024.
Use Axiom V2 on mainnet now
Axiom V2 is now deployed on the Ethereum mainnet and available for production use. Using Axiom in an application requires two steps:
1. Use Axiom Typescript SDK to write an Axiom circuit that requests ZK verification calculations on historical data from Ethereum.
2. Use the Axiom smart contract SDK to implement the Axiom client contract. The SDK receives ZK-verified results from Axiom through on-chain callbacks.
First, run: npx create-axiom-client
This will create a starter repository with default circuits and contracts and a default Next.js web frontend that can be used to Your dapp initiates a query to Axiom.
Building Axiom circuits
You can use the Axiom SDK to customize circuits for your application, which provides:
< li>Axiom subqueries request ZK verified transactions, receipts and historical block headers, account and contract storage from Axiom
ZK primitives through arithmetic, logic, comparison and array operations to calculate data from Axiom subquerie.
Axiom circuit example that calculates the average historical balance of an Ethereum account
Writing Axiom circuits can be completely done in Typescript , as shown in the example above. To integrate into your application, compiling an Axiom circuit creates a ZK prover that can be used to create Axiom queries on your web application or server.
Integrated into smart contracts
To use Axiom's results in your application, simply implement the _validateAxiomV2Call and _axiomV2Callback functions to use the query results to validate and execute the callbacks provided by Axiom .
Axiom client contract accepts callback of Axiom result with ZK proof
For testing, we write An extension to the Foundry testing library that provides cheat codes to locally test Axiom circuits against your smart contracts. This allows Axiom-powered applications to be tested within standard smart contract workflows.
Test sending queries and prank callbacks using our Foundry cheat code
The smart contracts and ZK behind Axiom V2 The circuit is fully open source on our Github and has been audited by Spearbit, Zellic and Trail of Bits. You can query Axiom simply by sending an on-chain transaction to the AxiomV2Query smart contract deployed on the Ethereum mainnet and Sepolia testnet.
What can you do with Axiom
Axiom allows smart contract developers to access new types of data on the chain. We start with the history of Ethereum, including transactions, receipts, and historical states. It holds critical information about on-chain reputation and identity, DeFi transactions, and governance participation, but surprisingly, it was previously inaccessible to smart contracts without relying on a centralized off-chain oracle.
Developers can access newly available on-chain data through Axiom and incorporate it into their contracts, including:
Protocol Usage: Transaction and event logs encapsulate all previous interactions a user has had with any on-chain protocol.
Historical balance: Which tokens and NFTs the user holds, and the amount held.
Ethereum native data: Gas usage, base fee and RANDAO value from block headers and transaction inclusion and ordering information from transaction trie.
Axiom query results are verified on-chain via ZK proofs, meaning their correctness is cryptographically equivalent to data accessed via the EVM. This enables Axiom to combine different types of on-chain information in a single query and interoperate with existing protocols permissionlessly. This enables new types of trust-minimized applications to include:
We’re excited to support developers building compelling new on-chain experiences using these primitives and others powered by Ethereum’s rich history .
What’s next?
Over the next few weeks, we will share more information about early partners who have integrated Axiom, access Axiom queries about rollup and Ethereum L1 across the bridge, and our future upgrades route map.