Documentation Index
Fetch the complete documentation index at: https://mintlify.com/provablehq/snarkvm/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before installing SnarkVM, ensure you have Rust installed on your system.
Install Rust
We recommend installing Rust using rustup.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
For macOS users, install additional dependencies:brew install pkgconf
brew install openssl
Download and run the appropriate installer:Follow the on-screen instructions to complete installation.
SnarkVM requires Rust version 1.88.0 or higher. Verify your installation with:
Install SnarkVM as a Library
SnarkVM is primarily designed to be used as a library in Rust projects.
Add to Cargo.toml
Add SnarkVM to your project’s Cargo.toml:
[dependencies]
snarkvm = "4.4.0"
Using Specific Crates
For more granular control, you can depend on individual crates:
[dependencies]
snarkvm-console = "4.4.0"
snarkvm-circuit = "4.4.0"
snarkvm-synthesizer = "4.4.0"
Available Features
SnarkVM provides several feature flags:
| Feature | Description |
|---|
default | Includes algorithms, circuit, console, ledger, synthesizer, and utilities |
full | Enables all crates including curves and fields |
wasm | WASM bindings for browser support |
cuda | GPU acceleration for cryptographic operations |
async | Async support for ledger and synthesizer |
serial | Disable parallel execution (useful for debugging) |
Example with features:
[dependencies]
snarkvm = { version = "4.4.0", features = ["full", "async"] }
Build from Source
To build SnarkVM from source for development or testing:
Clone the Repository
git clone --branch staging --single-branch https://github.com/ProvableHQ/snarkVM.git
cd snarkVM
The staging branch contains the latest development code. For stable releases, use the mainnet branch.
Build the Library
This will compile all workspace members. The release build is optimized and may take several minutes. Run Tests
Verify the installation by running tests:Synthesizer tests can be slow. To run specific tests:cargo test -p snarkvm-console -- test_name
Verify Installation
Create a simple program to verify your installation:
Create a New Project
cargo new snarkvm-test
cd snarkvm-test
Update Cargo.toml
[package]
name = "snarkvm-test"
version = "0.1.0"
edition = "2024"
[dependencies]
snarkvm = "4.4.0"
anyhow = "1.0"
Test the Installation
Replace src/main.rs with:use snarkvm::prelude::*;
use anyhow::Result;
fn main() -> Result<()> {
// Create a new private key
let rng = &mut snarkvm_utilities::TestRng::default();
let private_key = PrivateKey::<MainnetV0>::new(rng)?;
// Derive the address
let address = Address::try_from(&private_key)?;
println!("Private Key: {}", private_key);
println!("Address: {}", address);
Ok(())
}
Run the Program
You should see output showing a generated private key and address.
SnarkVM requires nightly Rust for formatting:
rustup install nightly
cargo +nightly fmt --all
Linting
Run Clippy to catch common mistakes:
cargo clippy --all-targets --all-features -- -D warnings
Clippy warnings are treated as errors in SnarkVM. All code must pass Clippy checks before being committed.
If you encounter OpenSSL errors:export OPENSSL_DIR=/opt/homebrew/opt/openssl@3
export PKG_CONFIG_PATH=/opt/homebrew/opt/openssl@3/lib/pkgconfig
Install development packages:# Ubuntu/Debian
sudo apt-get install build-essential pkg-config libssl-dev
# Fedora
sudo dnf install gcc pkg-config openssl-devel
Ensure you have Visual Studio Build Tools installed:
Next Steps
Quick Start Guide
Now that SnarkVM is installed, learn how to build your first application.