Skip to main content

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.

Zero-knowledge virtual machine for private computations

Build decentralized applications with privacy-preserving smart contracts on Aleo. SnarkVM provides cryptographic primitives, program synthesis, and proof generation for the next generation of blockchain applications.

Quick start

Get up and running with SnarkVM in minutes

1

Install SnarkVM

Add SnarkVM to your Rust project’s Cargo.toml:
Cargo.toml
[dependencies]
snarkvm = "4.4.0"
Or install from source:
git clone https://github.com/ProvableHQ/snarkVM.git
cd snarkVM
cargo build --release
2

Import the prelude

The prelude provides commonly used types and traits:
use snarkvm::prelude::*;
use rand::thread_rng;
3

Create an account

Generate a new private key and derive the corresponding address:
// Generate a new private key
let private_key = PrivateKey::<Testnet3>::new(&mut thread_rng())?;

// Derive the view key and address
let view_key = ViewKey::try_from(&private_key)?;
let address = Address::try_from(&private_key)?;

println!("Address: {}", address);
4

Execute your first transaction

Initialize the VM and execute a program:
// Initialize the VM with a genesis block
let vm = VM::<Testnet3>::from(ConsensusStore::open()?)?;

// Execute a program
let transaction = vm.execute(
    &private_key,
    ("credits.aleo", "transfer_private"),
    inputs.iter(),
    None,
    0,
    None,
    &mut thread_rng()
)?;
This example executes the transfer_private function from the credits.aleo program. You can execute any deployed program using the same pattern.

Core capabilities

Everything you need to build privacy-preserving applications

Zero-knowledge proofs

Generate and verify SNARKs with Varuna and Marlin proving systems

Program synthesis

Compile and execute Aleo programs with the synthesizer

Cryptographic primitives

Use Poseidon hashing, polynomial commitments, and elliptic curves

Account management

Create and manage private keys, view keys, and addresses

Blockchain ledger

Interact with blocks, transactions, and consensus mechanisms

WASM integration

Run SnarkVM in the browser with WebAssembly bindings

Ready to build with SnarkVM?

Start building privacy-preserving applications on Aleo. Follow our quickstart guide to deploy your first zero-knowledge program.

Get started now