ZKP Sequence Diagram and Spec
RISC Zero offers a computational receipt for any code that runs within the RISC Zero zkVM, which serves to verifiably link the code that ran to the asserted output. RISC Zero's receipts are built on the shoulders of several recent advances in the world of Zero-Knowledge Cryptography: zk-STARKs, PLONK, and DEEP-ALI.
In this document, we present a succinct introduction to the RISC Zero Proof system, including a sequence diagram and a step-by-step description of the RISC Zero Non-Interactive Argument of Knowledge. We encourage readers to follow along with STARK by Hand for a more concrete description of the protocol.
To invite collaboration and open source development, this is an early-release of documentation-in-progress. The implementation in code can be seen here. If you have questions/feedback or if you find errors, please let us know on Twitter or Discord.
The RISC Zero Proof System: A Step-By-Step Description
Phase 1: Committing the Execution Trace
- The Prover runs a computation in order to generate an
Execution Trace
.- The
trace
is organized intocolumns,
and the columns are categorized ascontrol columns
,data columns
, andPLONK columns
.- The
control columns
handle system initialization and shutdown, the initial program code to load into memory before execution, and other control signals that don't depend on the program execution. - The
data columns
contain the input and the computation data, both of which are private. These columns are committed in two orderings:- in order of program execution, and
- re-ordered by register first and clock cycle second. The re-ordered columns allow for efficient validation of RISC-V memory operations.
- The
PLONK columns
are used to show the validity that the re-ordered data columns are a valid permutation of the original data, as per the PLONK permutation argument.
- The
- After computing the
data columns
andPLONK columns,
the Prover adds some randomnoise
to the end of those columns in order to ensure that the protocol is zero-knowledge.
- The
- The Prover encodes the
trace
as follows:- The Prover converts each
column
into a polynomial using aniNTT
. We'll refer to these asTrace Polynomials
, denoted . - The Prover evaluates the
data polynomials
and thecontrol polynomials
over an expanded domain and commits the evaluations into two separate Merkle Trees. - Using these Merkle roots as an entropy-source, we use Fiat-Shamir to choose
PLONK mixing parameters,
using a SHA-2 CRNG. - Then, the Prover uses the
PLONK mixing parameters
to generate thePLONK columns
, interpolates them to form thePLONK polynomials,
evaluates those polynomials over a larger domain, and commits those evaluations to a Merkle tree (see the PLONK paper for details). - The Prover sends the Merkle root of each tree to the Verifier.
- Using these three Merkle roots as an entropy-source, we use Fiat-Shamir to choose a
constraint mixing parameter
, using a SHA-2 CRNG.
- The Prover converts each
Phase 2: Validating the Trace: the Core of the STARK Proof
The Prover uses the
constraint mixing parameter
, theTrace Polynomials
, and theRule Checking Polynomials
to construct a fewLow Degree Validity Polynomials.
The details are as follows:By writing publicly known
Rule Checking Polynomials
, , in terms of the privateTrace Polynomials
, the Prover generatesConstraint Polynomials
, .- The key point about these polynomials is that for each of the rules and each input that's associated with the trace, will return 0 if the trace "passes the test," so to speak.
Using the
constraint mixing parameter
, the Prover combines theConstraint Polynomials
, into a singleMixed Constraint Polynomial
, , by computing- Note that if each returns 0 at some point , then will also return 0 at .
Using a publicly known
Zeros Polynomial
, the Prover computes theHigh Degree Validity Polynomial
, .- The
Zeros Polynomial
is a divisor of any honest construction of . In other words, an honest prover will construct to be a polynomial of lower degree than . We call "high degree" relative to the Trace Polynomials, .
- The
The Prover
splits
theHigh Degree Validity Polynomial
into 4Low Degree Validity Polynomials
, .The Prover evaluates the
Low Degree Validity Polynomials
, encodes them in a Merkle Tree, and sends the Merkle root to the Verifier.We use Fiat-Shamir to choose the
DEEP Test Point
, .
Phase 3: The DEEP Technique
- The Verifier would like to check the asserted relation between , , and at the
DEEP Test Point,
. Namely, the Verifier would like to confirm that .- The Prover sends the evaluations of each at , which allows the Verifier to compute .
- Computing is slightly more complicated. Because
rule checks
can check relationships across multiplecolumns
and multipleclock cycles
, evaluating requires numerous evaluations of the form for varyingcolumns
andcycles
. The Prover sends thesenecessary evaluations
of each to allow the Verifier to evaluate . We refer to thenecessary evaluations
as thetaps
of at . - The Verifier can now check .
- Although these asserted evaluations have no associated Merkle branches, the DEEP technique offers an alternative to the usual Merkle proof.
- The Prover constructs the DEEP polynomials using the
taps
:- Denoting the
taps
of at as , the Prover constructs the DEEP polynomial where is the polynomial formed by interpolating the taps of . The Prover computes , runs an iNTT on the result, and sends the coefficients of to the Verifier. Using this technique, the Prover constructs and sends a DEEP polynomial for each and each .
- Denoting the
- At this point, the claim of trace validity has been reduced to the claim that each of the DEEP polynomials is actually a low-degree polynomial.
To conclude the proof, the Prover mixes the DEEP polynomials into the
FRI Polynomial
using aDEEP mixing parameter
and use the FRI protocol to show that theFRI Polynomial
is a low-degree polynomial.
Phase 4: The FRI Protocol
- We omit the details of the FRI Protocol for brevity.
Thanks for reading! If you have questions or feedback, we'd love to hear from you on Discord or Twitter.