Skip to main content

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.

zkVM Overview

The RISC Zero zkVM is a zero-knowledge verifiable general computing platform that enables you to prove correct execution of arbitrary code. At its core, it’s a RISC-V virtual machine that produces cryptographic proofs of computation.

What is Zero-Knowledge Proof?

A zero-knowledge proof allows one party (the prover) to convince another party (the verifier) that something is true without revealing all the details. In the case of RISC Zero:
  • The prover can show they correctly executed some code
  • The verifier can confirm the execution was correct
  • Only the code’s output is revealed, not the inputs or intermediate state
With RISC Zero, you can prove that you ran specific code and got a specific result, without revealing the private inputs you used.

How the zkVM Works

The zkVM emulates a small RISC-V computer, allowing it to run arbitrary code in any language with a RISC-V compiler toolchain. Currently, the SDK supports:
  • Rust (primary)
  • C
  • C++

Key Properties

General Purpose Computing Unlike domain-specific ZK systems, the zkVM can execute any code that compiles to RISC-V. This means you can:
  • Use existing libraries and dependencies
  • Leverage familiar programming languages
  • Implement complex business logic
Zero-Knowledge The protocol is zero-knowledge, meaning:
  • The verifier learns nothing about execution details beyond the journal output
  • Private inputs remain completely hidden
  • Intermediate computation steps are not revealed
Cryptographically Sound The system achieves:
  • 98 bits of conjectured security with default parameters
  • Perfect zero-knowledge properties
  • Based on well-studied zk-STARK and Groth16 protocols

Core Concepts

Understanding the zkVM requires familiarity with several key concepts:

Method

A method is RISC-V code compiled from your source language (e.g., Rust). It represents the program that will be executed and proven inside the zkVM.
// Example guest method
risc0_zkvm::guest::entry!(main);

fn main() {
    let a: u64 = env::read();
    let b: u64 = env::read();
    let product = a.checked_mul(b).expect("Integer overflow");
    env::commit(&product);
}

Image ID

The Image ID is a cryptographic hash of the method’s ELF file. It uniquely identifies what code was executed and is required for verification.
Think of the Image ID as a fingerprint of your compiled program. It ensures the verifier knows exactly what code produced the proof.

Journal

The journal is an append-only log that represents the official public output of the computation. Guest code writes to the journal using env::commit().

Receipt

A receipt is the zero-knowledge proof of correct execution. It consists of:
  • The journal (public outputs)
  • The seal (cryptographic proof data)
The receipt proves that the journal was produced by correctly executing the method corresponding to a given Image ID.

Use Cases

The zkVM enables powerful applications across many domains: Privacy-Preserving Computation
  • Prove you satisfy conditions without revealing sensitive data
  • Verify credentials without exposing personal information
Verifiable AI/ML
  • Prove model inference was performed correctly
  • Verify training data properties without revealing the data
Blockchain Scaling
  • Generate compact proofs of off-chain computation
  • Verify complex state transitions efficiently
Secure Multi-Party Computation
  • Coordinate computation across untrusting parties
  • Prove adherence to agreed-upon protocols

Development Workflow

A typical zkVM development workflow involves:
  1. Write guest code - Implement your computation logic
  2. Compile to method - Build the RISC-V ELF binary
  3. Execute and prove - Run the method in the zkVM to generate a receipt
  4. Verify - Validate the receipt against the expected Image ID
use risc0_zkvm::{default_prover, ExecutorEnv};

// Build the execution environment
let env = ExecutorEnv::builder()
    .write(&input_data)
    .unwrap()
    .build()
    .unwrap();

// Prove execution
let prover = default_prover();
let receipt = prover.prove(env, METHOD_ELF).unwrap().receipt;

// Verify the receipt
receipt.verify(METHOD_ID).unwrap();

// Extract public outputs
let output: OutputType = receipt.journal.decode().unwrap();
Proving is computationally intensive. Development mode can be enabled with RISC0_DEV_MODE=1 to skip actual proof generation during testing.

Next Steps

To learn more about the zkVM:

Additional Resources