Prerequisites
Before installing SnarkVM, ensure you have Rust installed on your system.Install Rust
We recommend installing Rust using rustup.- macOS / Linux
- Windows
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’sCargo.toml:
Using Specific Crates
For more granular control, you can depend on individual crates:Available Features
SnarkVM provides several feature flags:
Example with features:
Build from Source
To build SnarkVM from source for development or testing:1
Clone the Repository
The
staging branch contains the latest development code. For stable releases, use the mainnet branch.2
Build the Library
3
Run Tests
Verify the installation by running tests:
Verify Installation
Create a simple program to verify your installation:1
Create a New Project
2
Update Cargo.toml
3
Test the Installation
Replace
src/main.rs with:4
Run the Program
Development Tools
Code Formatting
SnarkVM requires nightly Rust for formatting:Linting
Run Clippy to catch common mistakes:Platform-Specific Notes
- macOS
- Linux
- Windows
If you encounter OpenSSL errors:
Next Steps
Quick Start Guide
Now that SnarkVM is installed, learn how to build your first application.