Skip to main content

Prerequisites

Before installing SnarkVM, ensure you have Rust installed on your system.

Install Rust

We recommend installing Rust using rustup.
For macOS users, install additional dependencies:
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:

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

This will compile all workspace members. The release build is optimized and may take several minutes.
3

Run Tests

Verify the installation by running tests:
Synthesizer tests can be slow. To run specific 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

You should see output showing a generated private key and address.

Development Tools

Code Formatting

SnarkVM requires nightly Rust for formatting:

Linting

Run Clippy to catch common mistakes:
Clippy warnings are treated as errors in SnarkVM. All code must pass Clippy checks before being committed.

Platform-Specific Notes

If you encounter OpenSSL errors:

Next Steps

Quick Start Guide

Now that SnarkVM is installed, learn how to build your first application.