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.
risc0-zkvm
Therisc0-zkvm crate is the primary interface for building zero-knowledge applications with RISC Zero. It provides the zkVM that executes RISC-V code and produces zero-knowledge proofs.
Installation
Overview
The RISC Zero zkVM is a RISC-V virtual machine that produces zero-knowledge proofs of code execution. By using the zkVM, a cryptographic receipt is produced which anyone can verify was produced by the zkVM’s guest code.For guest code (code running inside the zkVM), disable default features:
Feature Flags
Enables the client API for interacting with the zkVM from the host.
- Implies:
std - Target: All except rv32im
Enables the prover, required for generating proofs.
- Implies:
client,std - Incompatible: zkVM guest environment
Enables CUDA GPU acceleration for the prover.
- Implies:
prove,std - Requirements: CUDA toolkit must be installed
Enables integration with Bonsai proving service.
- Enabled by default
Support for Rust standard library.
Exposes a getrandom implementation using the
sys_random ecall.- Note: By default, getrandom panics in the zkVM
Disables dev mode to prevent faking proofs in production.
Core Types
Prover
Main trait for proving zkVM programs.
Default implementation of the Prover trait.
Local prover implementation that generates proofs on the current machine.
Prover implementation that uses the Bonsai proving service.Requires:
bonsai featureExecution Environment
Environment configuration for zkVM execution.
Builder for constructing ExecutorEnv.Methods:
write<T: Serialize>(&mut self, data: &T) -> Result<&mut Self>stdin(&mut self, reader: impl Read + 'static) -> &mut Selfstdout(&mut self, writer: impl Write + 'static) -> &mut Selfadd_assumption(&mut self, receipt: impl Into<AssumptionReceipt>) -> &mut Selfbuild(&mut self) -> Result<ExecutorEnv>
Receipt
Cryptographic proof of zkVM execution.Variants:
Composite(CompositeReceipt)- Multi-segment proofSuccinct(SuccinctReceipt)- Compressed proof via recursionGroth16(Groth16Receipt)- SNARK proof for on-chain verificationFake(FakeReceipt)- Development-only fake receipt
Public outputs from zkVM execution.
ProverOpts
Options for customizing proof generation.
Type of receipt to generate.Variants:
Composite- Standard multi-segment receiptSuccinct- Compressed receiptGroth16- SNARK receipt for blockchain verification
Guest API
When writing guest code (code that runs inside the zkVM), use these functions:Input/Output
Read input data from the host.Example:
Commit data to the journal (public output).Example:
Memory Management
Size of a zkVM memory page.
Maximum guest memory size.