Skip to main content
Version: Next

Proof Composition

RISC Zero's zkVM offers a convenient API for efficiently verifying proofs inside the guest program.

This feature enables rich possibilities for building modular applications. Check out the blog post to learn more about the power of proof composition.

info

Although the "obvious" approach to proof composition would be to simply run the verifier inside the guest program, this approach doesn't result in compression. Instead, RISC Zero's approach to composition relies on adding assumptions to the ReceiptClaim and then resolving them.

This approach allows us to offer users a simple API for composition while still being able to access the benefits of our hyper-efficient recursion circuit.

Start Building

To use proof composition in your program, you'll need to call add_assumption() on the host-side and env::verify() on the guest-side, as demonstrated in this code example.

Assumptions will be automatically resolved when you call Prover::prove_with_opts using ReceiptKind::Succinct or ReceiptKind::Groth16.

How It Works

Under the hood, proof composition works by adding assumptions to the ReceiptClaim struct, and then resolving those assumptions.

ReceiptClaim with no assumptions

Adding Assumptions

When env::verify() is called inside the guest program, an assumption is added to the ReceiptClaim. This results in a "conditional receipt."

Adding an assumption

Resolve an Assumption

In order to finish the process of proof composition, assumptions must be resolved. This is accomplished via resolve, which is called automatically when users call Prover::prove_with_opts using ReceiptKind::Succinct or ReceiptKind::Groth16.

Resolving an assumption

For a more detailed dive into proof composition and RISC Zero's approach to recursive proving, check out the Study Club recording.