Axiom Proving API

website·Indexed 34 days ago

https://docs.axiom.xyz

A platform for generating and verifying proofs for ZK-enabled applications built with OpenVM. It provides a REST API, Rust Client SDK, and CLI for managing programs, configurations, and proof generation, including support for EVM and STARK proofs.

Tokens
8.6K
Snippets
53
Records
69
Agent score
65%

What's inside Axiom

  1. Overview of the Axiom Proving API

    The Axiom Proving API provides a hosted interface for developers to generate ZK proofs for applications built with OpenVM. It leverages Axiom's cloud infrastructure to reduce the cost and latency associated with OpenVM proof generation. The API supports three primary operational areas: OpenVM deployment (including key generation and smart contract verifier generation), OpenVM program deployment (artifact management and reproducible builds), and ZK proof generation and verification.
  2. Overview of the Axiom Proving API

    The Axiom Proving API provides a suite of REST endpoints categorized into four primary functional areas: Configuration Management (VM configuration), Program Management (OpenVM programs), Proof Generation, and Proof Verification.
  3. Overview of OpenVM zkVM framework

    OpenVM is an open-source zero-knowledge virtual machine (zkVM) framework designed for modularity, customization, and extensibility. It allows developers to generate ZK proofs that verify the execution of arbitrary Rust programs (supporting both std and no-std via RISC-V compilation). Key capabilities include:

    • Unbounded Program Length: Supports verification of long programs using continuations and proof aggregation.
    • EVM Integration: Includes a Solidity verifier for efficient on-chain proof verification in the Ethereum Virtual Machine.
    • VM Extensions: Provides specialized extensions to efficiently verify complex operations within standard Rust programs, including:
      • Hashing: SHA2-256 and Keccak.
      • Elliptic Curve Operations: ECDSA on secp256k1 and secp256r1 (short Weierstrass curves).
      • Pairings: Optimal Ate pairing on BN254 and BLS12-381.
      • Arithmetic: Int256 and modular arithmetic over arbitrary moduli.
      • STARK recursion.
  4. Understand OpenVM version support and deprecation policy

    The Axiom Proving API supports production versions of OpenVM for as long as practical. Preview versions are not recommended for production and are subject to regular deprecation and retirement. Axiom uses three status levels for OpenVM versions:

    • Supported: Actively supported and recommended for use on the API.
    • Deprecated: Not supported for new deployments, but legacy support is maintained for existing ones.
    • Retired: No longer supported and unavailable on the API.
  5. OpenVM Production Version and Security Audits

    As of July 2026, OpenVM v2.0.0 is the recommended version for production use. This version has undergone an external security review by zkSecurity. Additionally, the OpenVM RV32IM extension was formally verified in Lean by Nethermind Research as of February 2026. All historical audit reports, including internal Axiom team reviews and Cantina audits, are hosted on the OpenVM GitHub repository.
  6. Replicate an OpenVM build from the Axiom Proving API

    To verify that an OpenVM binary from the Axiom Proving API corresponds to the original source code, you can reproduce the build locally using Docker and cargo-openvm. The process ensures determinism by using a specific host architecture (linux/amd64) and guest target (riscv32im-risc0-zkvm-elf).

    Prerequisites:

    • Install cargo-openvm
    • Install Docker

    Steps:

    1. Download the program source code (tar.gz) and the openvm.toml config file from the Axiom Proving API console.
    2. Create a compile.sh script to handle the build and move the resulting .vmexe file to an output directory.
    3. Use a Dockerfile with --platform=linux/amd64 to ensure an identical build environment.
    4. Build the Docker image and run it, mounting a local output directory to capture the binary.
    5. Compare the locally generated .vmexe file with the one downloaded from the Axiom Proving API using diff.
    # 1. Create compile.sh
    #!/bin/bash
    cd YOUR_PROGRAM_NAME
    cargo openvm build
    cp openvm/release/*.vmexe ../output/
    
    # 2. Build the Docker image (Ensure Dockerfile specifies --platform=linux/amd64)
    docker build -f Dockerfile . -t my-reproducible-build:latest
    
    # 3. Run the build and extract the binary
    mkdir -p output
    docker run -v $(pwd)/output:/output my-reproducible-build:latest
    
    # 4. Verify the binary matches the API version
    diff output/your-program.vmexe your-downloaded-exe
  7. OpenVM deterministic build specifications

    OpenVM achieves deterministic program compilation by running the build process within a Docker container using the following environment specifications:

    • Host Architecture: linux/amd64
    • Guest Target: riscv32im-risc0-zkvm-elf
    • Process: The source is compiled to a RISC-V ELF, which is then transpiled into an OpenVM binary (.vmexe).
  8. Migrate from deprecated List programs endpoint

    The GET /v1/programs endpoint is deprecated and will be removed in a future version. Depending on your use case, replace it with one of the following alternatives:

    • To implement dashboard functionality with search and sort capabilities across projects, use GET /v1/projects.
    • To list programs associated with a specific project, use GET /v1/projects/{project_id}/programs.
    # Deprecated
    GET /v1/programs
    
    # Recommended Alternatives
    GET /v1/projects
    GET /v1/projects/{project_id}/programs
  9. Implement custom progress callbacks in Axiom Rust SDK

    The SDK allows developers to provide custom feedback during long-running operations by implementing the ProgressCallback trait. This trait includes methods for handling success, errors, progress updates, and UI elements like headers and sections.
    use axiom_sdk::{AxiomSdk, ProgressCallback};
    
    struct MyCallback;
    
    impl ProgressCallback for MyCallback {
        fn on_success(&self, text: &str) { println!("✓ {}", text); }
        fn on_error(&self, text: &str) { eprintln!("✗ {}", text); }
        fn on_progress_start(&self, message: &str, total: Option<u64>) {
            if let Some(total) = total { println!("Starting: {} (total: {})", message, total); }
            else { println!("Starting: {}", message); }
        }
        fn on_header(&self, text: &str) { println!("\n=== {} ===", text); }
        fn on_info(&self, text: &str) { println!("ℹ {}", text); }
        fn on_warning(&self, text: &str) { println!("⚠ {}", text); }
        fn on_section(&self, title: &str) { println!("\n--- {} ---", title); }
        fn on_field(&self, key: &str, value: &str) { println!("{}: {}", key, value); }
        fn on_status(&self, text: &str) { print!("\r{}", text); }
        fn on_progress_update(&self, current: u64) { print!("\rProgress: {}", current); }
        fn on_progress_update_message(&self, message: &str) { print!("\r{}", message); }
        fn on_progress_finish(&self, message: &str) { println!("\r{}", message); }
        fn on_clear_line(&self) { print!("\r\x1b[K"); }
        fn on_clear_line_and_reset(&self) { print!("\r\x1b[K"); }
    }
    
    // Attach the callback to the SDK
    let config = load_config()?;
    let sdk = AxiomSdk::new(config).with_callback(MyCallback);
  10. Verify EVM and STARK proofs

    The VerifySdk trait provides methods to verify proofs. For EVM proofs, you can use a default configuration or provide a custom configuration ID. For STARK proofs, you must provide the program-id and the path to the proof file.
    use axiom_sdk::verify::VerifySdk;
    use std::path::PathBuf;
    
    // EVM Proof Verification
    let proof_path = PathBuf::from("./evm-proof.json");
    let verify_id = sdk.verify_evm(None, proof_path)?; // Default config
    sdk.wait_for_evm_verify_completion(&verify_id)?;
    
    // STARK Proof Verification
    let stark_proof_path = PathBuf::from("./stark-proof.json");
    let stark_verify_id = sdk.verify_stark("program-id", stark_proof_path)?;
    sdk.wait_for_stark_verify_completion(&stark_verify_id)?;
  11. Register programs using locally built ELF and VMEXE pairs in Axiom REST API v2.0.0

    Starting with Axiom REST API v2.0.0, program registration has changed: the API now accepts a locally built ELF and VMEXE pair instead of a source archive. Consequently, source code is no longer compiled on the server side.
  12. Generate proofs for OpenVM programs

    The ProveSdk trait handles proof generation. You can specify the ProofType (e.g., Stark or Evm) and provide input via hex bytes or a JSON file.

    Input Format Requirements:

    • Hex bytes must start with 0x01 for bytes or 0x02 for field elements.
    • JSON files should follow the structure: {"input": ["0x01...", "0x02..."]}.
    use axiom_sdk::{prove::{ProveSdk, ProveArgs}, ProofType};
    use cargo_openvm::input::Input;
    use std::path::PathBuf;
    
    let args = ProveArgs {
        program_id: Some("your-program-id".to_string()),
        input: Some(Input::HexBytes("0x01010101".to_string())),
        proof_type: Some(ProofType::Stark),
    };
    
    // For EVM proofs, change proof_type to ProofType::Evm
    // For JSON file input, use Input::FilePath(PathBuf::from("./input.json"))
    
    let proof_id = sdk.generate_new_proof(args)?;
    sdk.wait_for_proof_completion(&proof_id)?;