Overview
The Axiom Rust SDK is a library for interacting with the Axiom Proving API. It is built on top of the Axiom Proving API and provides a higher-level interface for interacting with the API. This guide covers installation, configuration, and usage of all SDK features.Installation
Add the Axiom SDK to yourCargo.toml:
Configuration
Setting Up Your API Key
Before using the SDK, you need to configure your API key. You can do this in several ways:Option 1: Using the CLI (Recommended)
Option 2: Manual Configuration
Create a configuration file at~/.axiom/config.json:
Option 3: Programmatic Configuration
Progress Callbacks
The SDK supports custom progress callbacks for user feedback during long-running operations:Building Programs
TheBuildSdk trait provides functionality for registering OpenVM guest programs with the
Axiom Proving API.
Basic Build
openvm/release/<bin>.vmexe (a sibling of target/) and the raw ELF at
target/<openvm-target>/release/<bin>. A custom CARGO_TARGET_DIR or a workspace-level
target directory is not currently supported.
Build with Custom Configuration
UploadExeArgs lets you pin the VM configuration, select a binary, and control how programs
are organized into projects.
Configuration Source
Setconfig_id to register the program against a specific VM configuration instead of the
system default. The ID must reference a existing config.
Binary Target Selection
When yourCargo.toml contains multiple binary targets, set bin_name to choose which
ELF and VMEXE pair is uploaded. If the crate produces exactly one binary, leave it as
None and the SDK detects it.
Project Organization
You can control how your programs are organized by either creating new projects or adding programs to existing ones. This is useful for maintaining logical groupings of related programs or when you want to keep all your experimental builds separate from production code. Setproject_id to add the program to an existing project, or project_name to create a
new one. Use program_name to give the program itself a recognizable name instead of the
generated one.
Managing Build Artifacts
Once you’ve initiated a build, the SDK provides comprehensive tools to monitor progress, inspect results, and download the generated artifacts. This section covers the various ways to interact with your build results.Listing and Inspecting Programs
The SDK allows you to retrieve information about all your programs, including their current status and any error messages.- Name: Human-readable identifier for your program
- ID: Unique identifier used for API operations
- Status: Current build state (pending, building, ready, failed)
- Error Messages: Detailed error information if the build failed
Monitoring Build Status
You can check the status of a specific build to determine when it’s ready or if it has encountered any issues.- Pending: Build is queued and waiting to start
- Building: Build is currently in progress
- Ready: Build completed successfully and artifacts are available
- Failed: Build encountered an error and cannot proceed
Downloading Build Artifacts
Once a build is complete, you can download various artifacts that were generated during the build process.exe, elf, source and app_exe_commit.
Generating Proofs
TheProveSdk trait handles proof generation for your built programs.
Basic Proof Generation
Input Formats
The SDK supports multiple input formats:EVM Proof Generation
Managing Proofs
Once you’ve initiated proof generation, the SDK provides comprehensive tools to monitor progress, inspect results, and download the generated proofs. This section covers the various ways to interact with your proof generation jobs and retrieve the final artifacts.Listing and Inspecting Proofs
The SDK allows you to retrieve information about all proofs generated for a specific program.- ID: Unique identifier for the proof generation job
- State: Current status of the proof generation (pending, proving, ready, failed)
- Type: The type of proof being generated (STARK or EVM)
- Error Messages: Detailed error information if the proof generation failed
Downloading Proof Artifacts
Once proof generation is complete, you can download the generated proofs in various formats. The SDK provides flexibility in how and where you save these artifacts.Running Programs
TheRunSdk trait allows you to execute programs without generating proofs, useful for testing and debugging.
Basic Execution
Handling Execution Results
Verifying Proofs
TheVerifySdk trait provides proof verification capabilities.
EVM Proof Verification
Custom Configuration for EVM Verification
STARK Proof Verification
Configuration Management
TheConfigSdk trait provides access to VM configurations and related artifacts.
Getting Configuration Metadata
Downloading Configuration Artifacts
Working with Proving Keys
Project Management
TheProjectSdk trait helps organize your programs into projects.
Creating and Managing Projects
Managing Project Programs
Troubleshooting
This section covers common issues you may encounter when using the Axiom Rust Client SDK, along with detailed solutions and preventive measures. 1.CLI not initialized Error
API key not valid or inactive Error
- Check that your API key is correct
- Verify your API key is active in the Axiom dashboard
- Ensure you’re using the correct API endpoint
Not in a Rust project Error
- Ensure
Cargo.tomlexists in the directory you passed toupload_exe
OpenVM build output not found Error
- Run
cargo openvm buildin the guest crate before registering the program - The error names the directory it expected, normally
openvm/release - If you set
CARGO_TARGET_DIRor build from a workspace root, the artifacts land outside the expected paths, which are not currently supported
- Hex strings must start with
0x01(bytes) or0x02(field elements) - JSON input files must have an
"input"array - All input values must be valid hex strings
API Reference
Core Types
AxiomSdk: Main SDK structAxiomConfig: Configuration for API endpoint, key, and default config IDProgressCallback: Trait for handling progress eventsNoopCallback: Silent progress callback implementation
Traits
BuildSdk: Program building functionalityProveSdk: Proof generation functionalityRunSdk: Program execution functionalityVerifySdk: Proof verification functionalityConfigSdk: Configuration management functionalityProjectSdk: Project management functionality
Enums
ProofType:EvmorStarkConfigSource:ConfigId(String)orConfigPath(String)