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.

This section provides practical, working examples that demonstrate how to use SnarkVM in real-world applications. Each example includes complete, runnable code that you can use as a starting point for your own projects.

Available examples

Hello world

A minimal example to get started with SnarkVM

Token transfer

Transfer credits between accounts on the Aleo network

Custom program

Create and execute a custom Aleo program

Proof verification

Generate and verify zero-knowledge proofs

Prerequisites

All examples assume you have:
  • Rust installed (version 1.88.0 or later)
  • SnarkVM added to your Cargo.toml:
Cargo.toml
[dependencies]
snarkvm = "4.4.0"
rand = "0.8"

Running the examples

Each example is self-contained and can be run with:
cargo run --example <example_name>
Or copy the code into your own project’s main.rs file.

Learning path

We recommend following the examples in this order:
  1. Hello world - Learn basic account creation and address derivation
  2. Token transfer - Understand transaction creation and execution
  3. Custom program - Write and deploy your own Aleo program
  4. Proof verification - Work with zero-knowledge proofs directly

Example structure

Each example follows a consistent structure:
1

Setup

Import necessary types and create the runtime environment
2

Execution

Perform the core operations demonstrated by the example
3

Verification

Verify the results and print output

Additional resources

API reference

Detailed API documentation for all SnarkVM types

Guides

In-depth guides for common tasks
All examples use the Testnet3 network for demonstration. You can switch to MainnetV0 or CanaryV0 by changing the network type parameter.

Build docs developers (and LLMs) love