Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

STARK Protocol

This page describes how one shard is proved: the shard argument. Its inputs are the shard's chip traces (see Arithmetization) and its public values. The argument has four parts, run in this order under one Fiat-Shamir transcript:

  1. a commitment to all main traces of the shard with one jagged polynomial commitment;
  2. a LogUp-GKR argument that every bus balances;
  3. a zerocheck that every chip's constraints hold on every row;
  4. an opening of the committed columns at one random point, proved with WHIR.

The code is in crates/pcs/src/shard_level/ (prover and verifier), crates/pcs/src/jagged*.rs and crates/pcs/src/whir/.

Fields, hash and transcript

  • Base field: KoalaBear, \( p = 2^{31} - 2^{24} + 1 \).
  • Challenge field: the degree-5 extension by a root of \( X^5 + X^2 - 1 \), QuinticTrinomialExtensionField<KoalaBear>.
  • Hash: Poseidon2 over KoalaBear with width 16. Merkle trees use a padding-free sponge for leaves and a truncated permutation for internal nodes, with 8-element digests.
  • Transcript: a duplex challenger on the same permutation.

The wrap proof, which is verified inside a BN254 SNARK, uses a different hash and challenger (see STARK to SNARK).

Traces as multilinear polynomials

Each column of a chip trace with \( 2^n \) rows is read as the multilinear extension of its values over the Boolean hypercube \( \{0,1\}^n \). There are no cyclic domains, no "next row" and no quotient polynomial. A chip's constraints are polynomials \( C_j \) in the values of one row (main and preprocessed columns, plus public values), of degree at most 3.

Transcript prologue

The verifier observes the verifying key (the preprocessed commitment, the start pc and the chip layout). For each shard it then observes the public values, the global commitment of a shard that has one, the main commitment, and the number, heights and names of the chips present. A global proof, which opens the global rounds of several shards (see Memory Consistency Checking), has the same prologue, with the end of the global hash chain observed before everything else. Binding the heights before any challenge prevents the prover from choosing trace dimensions after seeing randomness.

Lookup argument

The first sub-argument proves that every bus balances. The prover grinds a proof of work, then runs LogUp-GKR over all interactions of all chips (see Lookup Arguments). It ends with claimed evaluations of the columns that appear in interactions, at a random point.

Zerocheck

The zerocheck proves that every constraint vanishes on every real row. Constraints are batched within a chip with powers of a challenge \( \alpha \), giving \( C(x) = \sum_j \alpha^j C_j(x) \), and across chips with powers of a challenge \( \lambda \). The GKR's column claims are folded into the same sum with a third challenge. The prover then runs one sumcheck for

\[ \sum_{b \in \{0,1\}^n} \mathrm{eq}(r, b) \cdot C(b) = \text{(the combination of the GKR claims)}, \]

where \( r \) is a random point and \( \mathrm{eq} \) is the multilinear equality polynomial. The cube is fixed per machine: \( 2^{22} \) rows for core shards and the wrap machine (CORE_MAX_LOG_ROW_COUNT), \( 2^{20} \) rows for the recursion and shrink machines (RECURSION_MAX_LOG_ROW_COUNT). The prover and the verifier take it from the machine, never from a proof, and both the host verifier and the recursion programs reject a chip whose claimed height is above it. A chip shorter than the cube is extended virtually, and the contribution of the virtual rows is removed analytically, so they need not satisfy the constraints.

The four lowest row variables are handled in one round, a univariate skip. Rows are grouped in blocks of 16, and each column is interpolated over a 16-point multiplicative subgroup within every block, so the first message is a univariate polynomial of degree at most 60 (61 coefficients): degree 15 per column, cubed by the constraints, times the interpolated \( \mathrm{eq} \) factor. The verifier checks that the message sums to the claim over the subgroup, which only needs the coefficients \( c_0, c_{16}, c_{32}, c_{48} \), and samples one challenge \( r_0 \). The prover folds every block of 16 rows once with the Lagrange weights \( L_b(r_0) \) and continues with ordinary rounds of degree 4 (degree 3 from the constraints, 1 from \( \mathrm{eq} \)), one per remaining row variable. A cube of \( 2^n \) rows therefore takes \( n - 3 \) messages instead of \( n \), and one 16-to-1 fold of the tables replaces the first four 2-to-1 folds.

The sumcheck ends with claimed evaluations of every column of every chip at one point \( z^* = (r_0, z_{hi}) \). Because of the skip this is not an ordinary multilinear point: row \( j \) has weight \( L_{j \bmod 16}(r_0) \cdot \mathrm{eq}(z_{hi}, \lfloor j / 16 \rfloor) \).

Jagged commitment

A shard has dozens of chips with different heights and widths. Committing each separately would cost one Merkle tree and one opening per chip. Ziren uses a jagged polynomial commitment (Jagged Polynomial Commitments). All columns of all chips are concatenated into one dense vector

\[ q = [\, T_0[:,0] \mid T_0[:,1] \mid \cdots \mid T_N[:,w_N - 1] \,] \]

without padding the columns to a common height. Prefix sums \( t_k \) of the column heights record where each column starts. The sparse "table of all columns" is related to \( q \) by

\[ p(z_r, z_c) = \sum_j q(j) \cdot \mathrm{eq}(\mathrm{row}(j), z_r) \cdot \mathrm{eq}(\mathrm{col}(j), z_c), \]

where \( \mathrm{col}(j) \) and \( \mathrm{row}(j) \) are the column and row that position \( j \) belongs to according to \( t \). For the zerocheck's point the row factor is the skip weight above instead of \( \mathrm{eq}(\mathrm{row}(j), z_r) \); the reduction and the verifier's evaluation of the jagged indicator use the same weights.

The dense vector is cut into stripes of \( 2^{21} \) values (the stacking height, DEFAULT_LOG_STACKING_HEIGHT). Each stripe is Reed-Solomon encoded, and all stripes of a round are committed in one Merkle tree. The preprocessed traces form a round committed at setup, whose root is in the verifying key; the main traces form a round committed per shard. A shard whose chips have global lookups also commits those chips in a global round before its main round.

To open the columns at \( z^* \), a sumcheck reduces the per-column claims to one claim about \( q \) at a random point. The verifier evaluates the jagged indicator from the heights it already observed. The heights are part of the transcript, so the verifier checks the layout it was committed to. The claim about \( q \) is proved with WHIR.

WHIR

WHIR is a multilinear polynomial commitment built on Reed-Solomon proximity testing. The stripes of all committed rounds (preprocessed, the global round if present, main) are batched into one virtual polynomial \( F = \sum_i \mu^i \cdot \mathrm{stripe}_i \), and \( \mu \) is drawn after the claims are fixed. The prover grinds before the batching challenge. WHIR then alternates folding sumchecks, commitments to the folded codeword at a lower rate, out-of-domain samples and queries into the previous codeword. Each query opens a Merkle path, and a round-0 query opens the same row of every stripe.

The production schedule for a core shard (core_whir_config in crates/pcs/src/whir/jagged.rs) is:

ParameterValue
Stacking height\( 2^{21} \)
Starting rate\( \rho = 2^{-1} \); each committed round divides it by 8
Folding factors3, then 6, 6
Queries per committed round256, 60 (final: 33)
Out-of-domain samples2 per committed round
Query grinding22 bits (ZIREN_WHIR_QUERY_GRINDING_BITS)
Folding grindingnone in the first round, then 4 to 11 bits per folding challenge
Batching grinding14 bits (ZIREN_WHIR_BATCH_GRINDING_BITS)
LogUp-GKR grinding22 bits (ZIREN_LOGUP_GRINDING_BITS)

The query counts are not listed in the code but solved. The first oracle, the stripe trees, is counted in the unique-decoding regime, where a query into a code of rate \( \rho \) is worth \( -\log_2((1 + \rho)/2) \) bits. The oracles committed later are counted under the Johnson bound with multiplicity \( m = 3 \), where a query is worth \( -\log_2(\sqrt{\rho},(1 + 1/(2m))) \) bits. A round with \( q \) queries and \( g \) grinding bits gives \( q \) times the bits of a query, plus \( g \). The solver picks the least \( q \) that reaches the per-component target, ZIREN_SOUNDNESS_TARGET_BITS (default 128). At the defaults:

OracleRateRegimeBits per queryQueriesGrindingTotal bits
Stripe trees (round 0)2-1unique decoding0.41525622128.25
Round 0 fold (round 1)2-4Johnson, m = 31.7786022128.66
Round 1 fold (final queries)2-7Johnson, m = 33.2783322130.16

One query fewer in any row falls below 128 bits.

Under the Johnson bound a folding challenge has to beat the list of codewords near the oracle, so each folding challenge of the later rounds grinds what its own error needs to reach the target. The first round folds an oracle with one codeword in range and needs no grinding.

The target applies to each component. A shard transcript has about two dozen components, and a union bound over them gives about 124 bits. Lowering a grinding parameter through the environment raises the query counts instead of weakening a round. These are bounds on the interactive protocol; the Fiat-Shamir transformation costs a further factor in the number of hash queries an adversary makes.

Verification

The verifier, verify_shard in crates/pcs/src/shard_level/verifier.rs:

  1. replays the prologue;
  2. checks the LogUp-GKR proof, using the public values for the endpoints of the State and global-memory control buses (a shard proof has no global lookups in its circuit; global proofs run the same check under the global challenge);
  3. checks the zerocheck sumcheck and recomputes every chip's batched constraint at \( z^* \) from the claimed column values;
  4. checks the jagged reduction and the WHIR proof against the preprocessed root in the verifying key and the shard's global-round and main commitments.

Checks between shards (the pc chain, shard numbers, memory address ranges, the global hash chain and the global sums) are not part of the shard argument. The recursion enforces them (see Recursive STARK).