Expand description
The RISC Zero zkVM is a RISC-V virtual machine that produces zero-knowledge proofs of code it executes. By using the zkVM, a cryptographic receipt is produced which anyone can verify was produced by the zkVM’s guest code. No additional information about the code execution (such as, for example, the inputs provided) is revealed by publishing the receipt.
Additional (non-reference) resources for using our zkVM that you may also find helpful, especially if you’re new to the RISC Zero zkVM. These include:
- Our zkVM Tutorial, which walks you through writing your first zkVM project.
- The
cargo risczero
tool. It includes anew
command which generates code for building and launching a zkVM guest and guidance on where projects most commonly modify host and guest code. - The examples, which contains various examples using our zkVM.
- This clip from our presentation at ZK Hack III gives an overview of the RISC Zero zkVM. Our YouTube channel has many more videos as well.
- We track zkVM issues with known workarounds using the rust guest workarounds GitHub tag. If you’re having problems running your code in the zkVM, you can see if there’s a workaround, and if you’re using a workaround, you can track when it gets resolved to a permanent solution.
- And more on the RISC Zero developer website!
§Crate Feature Flags
The following feature flags are supported.
Note that in order to use risc0-zkvm
in the guest, you must disable the
default features by setting default-features = false
.
Feature | Target(s) | Implies | Description |
---|---|---|---|
client | all except rv32im | std | Enables the client API. |
cuda | prove, std | Enables CUDA GPU acceleration for the prover. Requires CUDA toolkit to be installed. | |
disable-dev-mode | all except rv32im | Disables dev mode so that proving and verifying may not be faked. Used to prevent a misplaced RISC0_DEV_MODE from breaking security in production systems. | |
metal | macos | prove, std | Deprecated - Metal GPU acceleration for the prover is now enabled by default on Apple Silicon. |
prove | all except rv32im | std | Enables the prover, incompatible within the zkvm guest. |
std | all | Support for the Rust stdlib. |
Modules§
- The RISC Zero zkVM’s guest-side RISC-V API.
- recursion
Non- target_os="zkvm"
andprove
Prover implementation for the recursion VM. - Serialization and deserialization tools for the RISC Zero zkVM
- SHA-256 hashing services
Macros§
- Construct a SyscallName declaration at compile time.
- Used for defining the guest’s entrypoint and main function.
Structs§
- ApiClient
( client
orprove
) and non-target_os="zkvm"
andclient
A client implementation for interacting with a zkVM server. - ApiServer
prove
and (client
orprove
) and non-target_os="zkvm"
A server implementation for handling requests by clients of the zkVM. - An assumption made in the course of proving program execution.
- A list of assumptions, each a Digest or populated value of an Assumption.
- Bonsai
Prover bonsai
andclient
and non-target_os="zkvm"
An implementation of a Prover that runs proof workloads via Bonsai. - Bytes
Non- target_os="zkvm"
and (client
orprove
)A cheaply cloneable and sliceable chunk of contiguous memory. - A receipt composed of one or more SegmentReceipt structs proving a single execution with continuations, and zero or more InnerAssumptionReceipt structs proving any assumptions.
- Verifier parameters for CompositeReceipt.
- Executor
Env client
and non-target_os="zkvm"
The Executor is configured from this object. - Executor
EnvBuilder client
and non-target_os="zkvm"
A builder pattern used to construct an ExecutorEnv. - Executor
Impl prove
and non-target_os="zkvm"
The proving phase uses an execution trace generated by the Executor. - External
Prover client
and non-target_os="zkvm"
An implementation of a Prover that runs proof workloads via an externalr0vm
process. - A fake receipt for testing and development.
- File
Segment Ref prove
and non-target_os="zkvm"
A basic implementation of a SegmentRef that saves the segment to a file - Groth16
Proof Json Non- target_os="zkvm"
andprove
Groth16 Proof encoded as JSON. - A receipt composed of a Groth16 over the BN_254 curve
- Verifier parameters used to verify a Groth16Receipt.
- Groth16
Seal Non- target_os="zkvm"
Groth16 seal object encoded in big endian. - HalPair
prove
and non-target_os="zkvm"
A pair of Hal and CircuitHal. - Input field in the ReceiptClaim, committing to a public value accessible to the guest.
- Error returned when a
(system, user)
exit code pair is an invalid representation. - A record of the public commitments for a proven zkVM execution.
- Loader
Non- target_os="zkvm"
andprove
- Local
Prover prove
andclient
and non-target_os="zkvm"
- Null
Segment Ref prove
and non-target_os="zkvm"
Implementation of a SegmentRef that does not save the segment. - Output field in the ReceiptClaim, committing to a claimed journal and assumptions list.
- Prove
Info Non- target_os="zkvm"
Information returned by the prover including receipt as well as other information useful for debugging - Prove
Keccak Request client
and non-target_os="zkvm"
andunstable
A Keccak proof request. - Prove
Keccak Response client
and non-target_os="zkvm"
andunstable
A Keccak proof response - Prove
ZkrRequest client
and non-target_os="zkvm"
andunstable
A ZKR proof request. - Prover
Opts client
and non-target_os="zkvm"
Options to configure a Prover. - Error returned when the source value was pruned, and is not available.
- A receipt attesting to the execution of a guest program.
- Public claims about a zkVM guest execution, such as the journal committed to by the guest.
- Metadata providing context on the receipt.
- Redis
Params ( client
orprove
) and non-target_os="zkvm"
andclient
Determines the parameters for AssetRequest::Redis - Segment
prove
and non-target_os="zkvm"
The execution trace of a portion of a program. - Segment
Info ( client
orprove
) and non-target_os="zkvm"
andclient
Provides information about a segment of execution. - A receipt attesting to the execution of a Segment.
- Verifier parameters used to verify a SegmentReceipt.
- Session
prove
and non-target_os="zkvm"
The execution trace of a program. - Session
Info ( client
orprove
) and non-target_os="zkvm"
andclient
Provides information about the result of execution. - Session
Stats Non- target_os="zkvm"
Struct containing information about a prover’s cycle count after running the guest program - Simple
Segment Ref prove
and non-target_os="zkvm"
A very basic implementation of a SegmentRef. - A succinct receipt, produced via recursion, proving the execution of the zkVM with a STARK.
- Verifier parameters used to verify a SuccinctReceipt.
- Represents the public state of a segment, needed for continuations and receipt verification.
- Context available to the verification process.
Enums§
- Asset
( client
orprove
) and non-target_os="zkvm"
andclient
Determines the format of an asset. - Asset
Request ( client
orprove
) and non-target_os="zkvm"
andclient
Determines the format of an asset request. - An assumption attached to a guest execution as a result of calling
env::verify
orenv::verify_integrity
. - Exit condition indicated by the zkVM at the end of the guest execution.
- An enumeration of receipt types similar to InnerReceipt, but for use in AssumptionReceipt. Instead of proving only RISC-V execution with ReceiptClaim, this type can prove any claim implemented by one of its inner types.
- A lower level receipt, containing the cryptographic seal (i.e. zero-knowledge proof) and verification logic for a specific proof system and circuit. All inner receipt types are zero-knowledge proofs of execution for a RISC-V zkVM.
- Either a source value or a hash Digest of the source value.
- Receipt
Kind client
and non-target_os="zkvm"
An enumeration of receipt kinds that can be requested to be generated. - Trace
Event Non- target_os="zkvm"
andclient
An event traced from the running VM. - A type representing an unknown claim type.
Constants§
- ALLOWED_
CONTROL_ IDS Non- target_os="zkvm"
Control IDs allowed in the default set of recursion programs. Includes control IDs for the base set of recursion programs, and each power-of-two of the rv32im circuit, using Poseidon2. - ALLOWED_
CONTROL_ ROOT Non- target_os="zkvm"
Root of the Merkle tree constructed from ALLOWED_CONTROL_IDS, using Poseidon2. - Maximum segment size, as a power of two (po2) that the default verifier parameters will accept.
- Size of a zkVM memory page.
- POSEIDO
N2_ CONTROL_ IDS Non- target_os="zkvm"
Control IDs for each power-of-two of the rv32im circuit using Poseidon2. - RECURSION_
PO2 prove
and non-target_os="zkvm"
Number of rows to use for the recursion circuit witness as a power of 2. - Reports the current version of this crate.
Traits§
- Connector
( client
orprove
) and non-target_os="zkvm"
andclient
Connects a zkVM client and server - Coprocessor
Callback client
and non-target_os="zkvm"
andunstable
A trait that supports the ability to be notified of ZKR proof requests on-demand. - Executor
client
and non-target_os="zkvm"
An Executor can execute a given ELF binary. - Keccak
Coprocessor Callback client
and non-target_os="zkvm"
andunstable
A trait that supports the ability to be notified of keccak proof requests on-demand. - Prover
client
and non-target_os="zkvm"
A Prover can execute a given ELF binary and produce a Receipt that can be used to verify correct computation. - Prover
Server prove
and non-target_os="zkvm"
- Segment
Ref prove
and non-target_os="zkvm"
A reference to a Segment. - Session
Events prove
and non-target_os="zkvm"
The Events of Session - Trace
Callback Non- target_os="zkvm"
andclient
A callback used to collect TraceEvents.
Functions§
- Align address upwards.
- compute_
image_ id Non- target_os="zkvm"
Compute and return the ImageID of the specified ELF binary. - default_
executor client
and non-target_os="zkvm"
Return a default Executor based on environment variables and feature flags. - default_
prover client
and non-target_os="zkvm"
Return a default Prover based on environment variables and feature flags. - get_
prover_ server prove
and non-target_os="zkvm"
Select a ProverServer based on the specified ProverOpts and currently compiled features. - Reports the current version of this crate as represented by a semver::Version.
- is_
dev_ mode std
Returnstrue
if dev mode is enabled. - prove_
zkr prove
and non-target_os="zkvm"
Prove the specified program identified by thecontrol_id
using the specifiedinput
. - register_
zkr prove
and non-target_os="zkvm"
Registers a function to retrieve a recursion program (zkr) based on a control id. - seal_
to_ json Non- target_os="zkvm"
andprove
Convert a recursion VM seal (i.e. succinct receipt) into a JSON format compatible with thestark_verify
witness generator. - stark_
to_ snark Non- target_os="zkvm"
andprove
Groth16 a given seal of anidentity_p254
receipt into a Groth16Seal
. Requires running Docker on an x86 architecture.
Type Aliases§
Result<T, Error>