Quick start
This guide will walk you through creating and running your first RISC Zero zkVM application. You’ll build a simple program that proves knowledge of two numbers that multiply to a specific product, without revealing the factors themselves.Prerequisites
Before you begin, make sure you have installed the RISC Zero toolchain.Create a new project
Usecargo risczero to create a new project from the default template:
You can customize the project creation with additional flags:
--no-std: Create a project with no_std in the guest--no-git: Disable git initialization--template <URL>: Use a custom template from GitHub
Project structure
zkVM applications are organized into a host program and a guest program:- Host: Executes the guest program and generates the proof
- Guest: The code that runs inside the zkVM and gets proven
Understanding the hello-world example
Let’s examine the default hello-world example that demonstrates proving knowledge of factors.Guest code
The guest program runs inside the zkVM. Here’s the complete guest code:methods/guest/src/main.rs
env::read()reads input from the hostenv::commit()writes the output to the journal- The guest code validates that the factors are non-trivial
Host code
The host program executes the guest and generates the proof:src/lib.rs
src/main.rs
Run the example
Navigate to your project directory and run:The first run may take several minutes as it compiles the guest code and generates the proof. Subsequent runs will be faster.
What just happened?
Guest computes product
The guest program computed 17 × 23 = 391 and committed the result to the journal.
Key concepts demonstrated
Receipt
The proof of correct execution. It contains:- Journal: The public output (391 in this example)
- Seal: Cryptographic proof data
Image ID
A cryptographic hash of the guest program (MULTIPLY_ID). Used during verification to ensure the correct program was executed.Zero-knowledge
The verifier learns that 391 is composite and that the prover knows the factors, but does not learn the actual factors (17 and 23).Dependencies
YourCargo.toml should include:
Cargo.toml
methods/guest/Cargo.toml
Feature flags
Common feature flags forrisc0-zkvm:
prove: Enables the prover (required for generating proofs)cuda: Enables CUDA GPU accelerationclient: Enables the client API
Building deterministically
To ensure your guest code produces the same ImageID across different build environments:Next steps
Examples
Explore more example projects
API Reference
Browse the complete API documentation
Developer docs
Learn advanced concepts and best practices
Tutorial
Follow the step-by-step tutorial