Skip to main content

Crate aleo_rust_sdk

Crate aleo_rust_sdk 

Source
Expand description

§Aleo Rust SDK

A comprehensive Rust SDK for interacting with the Aleo blockchain. Provides tools for account management, program loading, local zero-knowledge execution, proof generation, network querying, and transaction broadcasting.

Built on top of snarkVM 4.10.0 for zero-knowledge proving and reqwest for async HTTP.

§Architecture

The SDK is organized into five modules:

ModulePurpose
accountKey chain: PrivateKey → ViewKey → ComputeKey → Address
programLoad, parse, and inspect Aleo programs
executionAuthorize, execute, prove, and package transactions
networkHTTP client for Aleo v2 JSON-RPC and REST endpoints
recordRecord discovery, decryption, and coin selection
clientHigh-level AleoClient orchestrating the full lifecycle

§Quick Start

use aleo_rust_sdk::{AleoClient, AleoAccount};
use snarkvm::prelude::TestRng;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let mut rng = TestRng::default();
    let client = AleoClient::new("https://api.explorer.provable.com/v2/testnet")?;

    // Create a random account
    let account = AleoAccount::new_random(&mut rng)?;
    println!("Address: {}", account.address_str());

    // Query the network
    let height = client.get_block_height().await?;
    println!("Block height: {height}");

    Ok(())
}

§Feature flags

All features are built-in. The heavy lifting dependency is snarkVM for zero-knowledge proving.

  • aleo-cli — CLI tool built on this SDK
  • snarkvm — Zero-knowledge VM for Aleo

§License

Licensed under MIT OR Apache-2.0.

Re-exports§

pub use account::AleoAccount;
pub use client::AleoClient;
pub use error::AleoError;
pub use execution::ExecutionEngine;
pub use network::AleoHttpClient;
pub use network::FixedStateRootQuery;
pub use network::ProvableQuery;
pub use program::AleoProgram;

Modules§

account
Aleo Account — key management for Aleo blockchain accounts.
client
Aleo Client — the top-level entry point for the SDK.
error
Aleo SDK — custom error types.
execution
Aleo Execution — authorization, proving, and transaction packaging pipeline.
network
Aleo Network — RPC client for interacting with Aleo blockchain nodes.
program
Aleo Program — load and inspect Aleo programs.
record
Aleo Record — record discovery, decryption, and selection.