aleo_rust_sdk/lib.rs
1//! # Aleo Rust SDK
2//!
3//! A comprehensive **Rust SDK** for interacting with the [Aleo](https://aleo.org) blockchain.
4//! Provides tools for account management, program loading, local zero-knowledge execution,
5//! proof generation, network querying, and transaction broadcasting.
6//!
7//! Built on top of [snarkVM 4.10.0](https://github.com/ProvableHQ/snarkVM) for zero-knowledge
8//! proving and [reqwest](https://crates.io/crates/reqwest) for async HTTP.
9//!
10//! ## Architecture
11//!
12//! The SDK is organized into five modules:
13//!
14//! | Module | Purpose |
15//! |--------|---------|
16//! | [`account`] | Key chain: `PrivateKey → ViewKey → ComputeKey → Address` |
17//! | [`program`] | Load, parse, and inspect Aleo programs |
18//! | [`execution`] | Authorize, execute, prove, and package transactions |
19//! | [`network`] | HTTP client for Aleo v2 JSON-RPC and REST endpoints |
20//! | [`record`] | Record discovery, decryption, and coin selection |
21//! | [`client`] | High-level `AleoClient` orchestrating the full lifecycle |
22//!
23//! ## Quick Start
24//!
25//! ```no_run
26//! use aleo_rust_sdk::{AleoClient, AleoAccount};
27//! use snarkvm::prelude::TestRng;
28//!
29//! #[tokio::main]
30//! async fn main() -> anyhow::Result<()> {
31//! let mut rng = TestRng::default();
32//! let client = AleoClient::new("https://api.explorer.provable.com/v2/testnet")?;
33//!
34//! // Create a random account
35//! let account = AleoAccount::new_random(&mut rng)?;
36//! println!("Address: {}", account.address_str());
37//!
38//! // Query the network
39//! let height = client.get_block_height().await?;
40//! println!("Block height: {height}");
41//!
42//! Ok(())
43//! }
44//! ```
45//!
46//! ## Feature flags
47//!
48//! All features are built-in. The heavy lifting dependency is
49//! [snarkVM](https://github.com/ProvableHQ/snarkVM) for zero-knowledge proving.
50//!
51//! ## Related crates
52//!
53//! - [`aleo-cli`](https://crates.io/crates/aleo-cli) — CLI tool built on this SDK
54//! - [`snarkvm`](https://crates.io/crates/snarkvm) — Zero-knowledge VM for Aleo
55//!
56//! ## License
57//!
58//! Licensed under MIT OR Apache-2.0.
59
60pub mod account;
61pub mod client;
62pub mod error;
63pub mod execution;
64pub mod network;
65pub mod program;
66pub mod record;
67
68// Re-export the main types at the crate root for convenience
69pub use account::AleoAccount;
70pub use client::AleoClient;
71pub use error::AleoError;
72pub use execution::ExecutionEngine;
73pub use network::{AleoHttpClient, FixedStateRootQuery, ProvableQuery};
74pub use program::AleoProgram;