Documentation Index
Fetch the complete documentation index at: https://mintlify.com/risc0/risc0/llms.txt
Use this file to discover all available pages before exploring further.
cargo-risczero
Thecargo-risczero crate provides command-line tools for building, testing, and managing RISC Zero zkVM projects.
Installation
Overview
Thecargo risczero command provides:
- Project scaffolding: Create new zkVM projects
- Build management: Compile guest programs
- Toolchain management: Install RISC-V toolchains
- Testing utilities: Run and verify proofs
After installing, run
rzup install to set up the required RISC-V toolchain.Commands
new
Create a new RISC Zero project from a template.Options:Generated Structure:
--guest-name <NAME>: Name for the guest package (default: “method”)--template <TEMPLATE>: Template to use
default: Standard zkVM project structureminimal: Minimal project setup
build
Build guest programs for the zkVM.Options:
--manifest-path <PATH>: Path to Cargo.toml--features <FEATURES>: Comma-separated list of features--release: Build in release mode
verify
Verify a receipt file.Example:
install
Install RISC Zero toolchain components.Options:
rust: Install Rust toolchaincpp: Install C++ toolchain
Feature Flags
Includes
r0vm feature.Enables the r0vm runtime and utilities.
Enables experimental features and commands.
Enables CUDA GPU acceleration.
Enables Metal GPU acceleration (macOS).
Enables Docker-based guest building.
Environment Variables
Override the default toolchain version.
Custom path for cargo-risczero cache.
r0vm Binary
The package also provides ther0vm binary for running and analyzing guest programs:
r0vm run
Execute a guest ELF file.Options:
--elf <FILE>: Path to ELF file--env <FILE>: Environment file with input data--profile: Enable profiling--trace: Enable execution tracing
r0vm info
Display information about an ELF file.Shows:
- Image ID
- Entry point
- Program size
- Memory layout
r0vm analyze
Analyze execution and count cycles.Provides:
- Total cycle count
- Segment breakdown
- Syscall statistics
- Memory usage
Project Templates
When creating a new project,cargo risczero new generates:
Host Package
Guest Package
Build Script
Workflow
Typical development workflow:Docker Integration
With thedocker feature, build guests reproducibly:
- Reproducible builds
- Consistent cycle counts
- Cross-platform compatibility
GPU Support
Enable GPU acceleration in your project:Troubleshooting
Toolchain Issues
Build Issues
Environment Variables
Examples
Creating a Simple Project
Custom Guest Features
Profiling
Integration with IDEs
VS Code
Add to.vscode/tasks.json:
Rust Analyzer
Add to.vscode/settings.json: