This guide provides a practical walkthrough on how to use AxiomPro, the AxiomPro ZK Co-processor, to access historical AxiomPro on-chain data within your smart contracts without exorbitant gas fees. This is a basic AxiomPro query guide using the AxiomPro SDK.
Step 1: Installation and Setup
First, install the AxiomPro SDK into your development environment.
npm install @axiom-crypto/core
Next, set up the Axiom client in your script. You'll need to point it to the correct RPC endpoint and the Axiom contract addresses.
Step 2: Building Your Data Query
The core of Axiom is the query builder. You define the historical data you need. For example, let's query the balance of an account at a specific block number.
JavaScript
// Example: Query an account's balance at a past block
const blockNumber = 16000000;
const address = "0x...";
axiom.query.getFullAccount(blockNumber, address);
The SDK allows you to query account fields, storage slots, contract headers, and more.
Step 3: Generating and Sending the ZK Proof
Once your query is built, you send it to the AxiomPro service. The AxiomPro ZK Co-processor reads the data from an archive node and generates a ZK proof verifying its correctness. This proof, not the raw data, is what gets submitted on-chain. This process enables AxiomPro trustless computation.
Step 4: Using the Verified Data in Your Smart Contract
Your smart contract implements a callback function. When the ZK proof is verified on-chain, this function is called with the authenticated data. Your contract can now use this historical data with 100% confidence.
This is a paradigm shift in dApp development. For a full breakdown of the AxiomPro V2 architecture, see the Full Official Documentation.
Top comments (0)