Aleo Rust SDK
A Rust SDK for interacting with the Aleo blockchain — account management, program loading, local execution with zero-knowledge proof generation, network querying, and transaction broadcasting.
Why this SDK? The official ProvableHQ/aleo-rust has been archived and is no longer maintained. This SDK provides an up-to-date implementation using snarkVM 4.10.0 and the current Aleo testnet v2 JSON-RPC endpoints.
Table of Contents
- Packages
- Features
- Architecture
- Installation
- Quick Start
- Examples
- Roadmap
- CLI Tools
- Related Projects
- Development
- Contributing
- License
Packages
| Package | crates.io | docs.rs | Description |
|---|---|---|---|
| aleo-rust-sdk | crates.io | docs.rs | Meta-package — all modules below |
| aleo-rust-sdk (account) | — | docs | Key chain: PrivateKey → ViewKey → ComputeKey → Address |
| aleo-rust-sdk (program) | — | docs | Program loading, parsing, inspection |
| aleo-rust-sdk (execution) | — | docs | Authorize, execute, prove, package transactions |
| aleo-rust-sdk (network) | — | docs | v2 JSON-RPC + REST HTTP client |
| aleo-rust-sdk (record) | — | docs | Record discovery, decryption, and coin selection |
| aleo-rust-sdk (client) | — | docs | High-level AleoClient orchestrator |
The CLI tool aleo-cli is a separate crate that consumes this SDK.
Features
| Category | Feature |
|---|---|
| 🔑 Account Management | Generate, import, and derive Aleo accounts (PrivateKey, ViewKey, ComputeKey, Address). Full key derivation chain. |
| 📦 Program Loading | Fetch programs from the network via REST API, parse .aleo source files, inspect function/mapping definitions. |
| ⚡ Local Execution | Authorize and execute Aleo program transitions locally without broadcasting — ideal for dry-runs and testing. |
| 🔐 Proof Generation | Generate zero-knowledge proofs (Varuna V2) for local execution. Fee proving with V0 fee keys for testnet. |
| 🌐 Network Queries | Query block height, state root, program source, and mapping values via REST + JSON-RPC. |
| 📋 Record Management | Fetch, decrypt, and filter private credits.aleo records by owner. Scan record ciphertexts across block ranges. |
| 🚀 Transaction Broadcasting | Submit serialized transactions to the network and poll for confirmation. |
| 🏗️ High-level Client | AleoClient orchestrates the full lifecycle: account → program → execute → prove → broadcast. |
Architecture
┌─────────────────────────────────────────────────────┐
│ AleoClient │
│ (high-level orchestrator — account, program, │
│ execute, prove, broadcast in one place) │
├──────────┬──────────┬──────────┬──────────────────────┤
│ account │ program │ execution│ network │
│ │ │ │ │ │
│ │ │ │ │ AleoHttpClient │
│ PK → VK │ parse │ auth │ ├─ REST (v2) │
│ CK → ADDR│ inspect │ execute │ ├─ JSON-RPC │
│ │ │ from_net │ prove │ └─ broadcast │
│ ▼ │ ▼ │ ▼ │ ▼ │
├──────────┴──────────┴──────────┴──────────────────────┤
│ record │
│ AleoRecord · RecordScanner · RecordManager · CoinSel │
├────────────────────────────────────────────────────────┤
│ snarkVM 4.10.0 (Process<TestnetV0>) │
│ reqwest (async HTTP) — tokio runtime │
└──────────────────────────────────────────────────────┘
Installation
Add to your Cargo.toml:
[]
= "0.2.0"
= { = "1", = ["full"] }
Requirements:
- Rust 1.85+
- snarkVM 4.10.0 (automatically resolved)
- For proving: ~16 GB RAM recommended
Quick Start
Query testnet (no account needed)
use AleoClient;
async
Generate an account and fetch balance
use ;
use TestRng;
async
Full end-to-end transfer pipeline
use AleoClient;
use ;
use FromStr;
async
Examples
| Example | Source | Description |
|---|---|---|
testnet_query |
examples/testnet_query.rs | Query testnet: block height, state root, program info (no key needed) |
testnet_transfer |
examples/testnet_transfer.rs | Full pipeline: authorize → execute → prove → broadcast credits transfer |
simple_execute |
examples/simple_execute.rs | Minimal workflow: load program, execute locally (dry-run) |
Run an example:
# Query testnet state (no private key required)
# Full transfer (requires PRIVATE_KEY env var)
# Local dry-run execution
Roadmap
Planned features (in order of priority):
- WASM support — compile SDK for browser/Node.js via
wasm-pack - Transaction history — fetch and decode historical transactions
- Program deployment — deploy and upgrade Aleo programs from Rust
- Mainnet support — add mainnet configuration alongside testnet
- Record merging — join multiple small records into a single larger record
- Batch transfers — send multiple transfers in one transaction
- Type-safe program bindings — generate Rust structs from Aleo program mappings
CLI Tools
The aleo-cli command-line tool is built on top of this SDK:
# Install
# Query testnet status
# Check account balance
# Generate a new Aleo account
# Send a private transfer
Related Projects
| Project | Description |
|---|---|
| ProvableHQ/snarkVM | Zero-knowledge VM for the Aleo blockchain (this SDK's core dependency) |
| ProvableHQ/snarkOS | Decentralized OS for ZK applications — Aleo node software |
| ProvableHQ/sdk | Official JavaScript/TypeScript SDK for Aleo (NPM: @provablehq/sdk) |
| qiaopengjun5162/aleo-cli | Aleo CLI tool built on this SDK |
| AleoNet/workshop | Starter guide to building ZK applications on Aleo |
| Aleo developer docs | Official Aleo developer documentation |
Development
# Build
# Test
# Lint
# Generate docs
# Full check suite
See CONTRIBUTING.md for detailed guidelines.
Contributing
Contributions are welcome! Please read CONTRIBUTING.md for guidelines on reporting bugs, suggesting features, and submitting code changes.
License
Licensed under either MIT License or Apache-2.0 at your option.