Skip to main content

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 your Cargo.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 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

The BuildSdk trait provides functionality for registering OpenVM guest programs with the Axiom Proving API.

Basic Build

The SDK reads the OpenVM v2 build output from its default locations: the transpiled VMEXE at 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

Set config_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 your Cargo.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. Set project_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.
Program Information Available:
  • 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.
Build Status Types:
  • 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.
Accepted artifact types are exe, elf, source and app_exe_commit.

Generating Proofs

The ProveSdk 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.
Proof Information Available:
  • 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

The RunSdk trait allows you to execute programs without generating proofs, useful for testing and debugging.

Basic Execution

Handling Execution Results

Verifying Proofs

The VerifySdk trait provides proof verification capabilities.

EVM Proof Verification

Custom Configuration for EVM Verification

STARK Proof Verification

Configuration Management

The ConfigSdk trait provides access to VM configurations and related artifacts.

Getting Configuration Metadata

Downloading Configuration Artifacts

Working with Proving Keys

Project Management

The ProjectSdk 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
2. 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
3. Not in a Rust project Error
  • Ensure Cargo.toml exists in the directory you passed to upload_exe
3a. OpenVM build output not found Error
  • Run cargo openvm build in the guest crate before registering the program
  • The error names the directory it expected, normally openvm/release
  • If you set CARGO_TARGET_DIR or build from a workspace root, the artifacts land outside the expected paths, which are not currently supported
4. Registration Failures
5. Input Validation Errors
  • Hex strings must start with 0x01 (bytes) or 0x02 (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 struct
  • AxiomConfig: Configuration for API endpoint, key, and default config ID
  • ProgressCallback: Trait for handling progress events
  • NoopCallback: Silent progress callback implementation

Traits

  • BuildSdk: Program building functionality
  • ProveSdk: Proof generation functionality
  • RunSdk: Program execution functionality
  • VerifySdk: Proof verification functionality
  • ConfigSdk: Configuration management functionality
  • ProjectSdk: Project management functionality

Enums

  • ProofType: Evm or Stark
  • ConfigSource: ConfigId(String) or ConfigPath(String)