This paper introduces Spartan, a new family of zero-knowledge succinct non-interactive arguments of knowledge (zkSNARKs) for the rank-1 constraint satisfiability (R1CS), an NP-complete language that generalizes arithmetic circuit satisfiability. A distinctive feature of Spartan is that it offers the first zkSNARKs without trusted setup (i.e., transparent zkSNARKs) for NP where verifying a proof incurs sub-linear costs—without requiring uniformity in the NP statement’s structure. Furthermore, Spartan offers zkSNARKs with a time-optimal prover, a property that has remained elusive for nearly all zkSNARKs in the literature.
The goal is the following pipeline:
- R1CS encoding => low degree (degree 3) multilinear extension polynomial (thm 4.1)
$Q$ to be proven via sumcheck:$$Q_{io}(t) = \sum_{x \in {0,1}^s} \widetilde{F}_{io}(x) \cdot \widetilde{e}q(t, x)$$ - section 5: Apply sumcheck to to obtain a (non-succinct NIZK) Prove the evaluations of
$Q_{io}$ transform the above polynomial constraints to a set of constraints to be checked via via the sumcheck polynomial - section 6: theoretically obtain a zkSNARK via a applying a polynomial commitment scheme to the prior NIZK
- section 7: design SPARK, a PCS designed to compile the sumcheck instance based on Hyrax
Jump forward to my section "understanding..." to speedrun this paper.
main theorem:
For any R1CS instance x = (F, A, B, C, io, m, n), there exists a degree-3 log m-variate polynomial G such that
Start with R1CS instance
The function
This is just a statement of R1CS as a product of polynomials. The result is not a polynomial itself; amended by taking a polynomial extension
This matches
Simply computing the sumcheck of
where recall the deg-1 ML poly outputs 1 if t=x:
$Q_{io}(t) = \tilde{F}{io}(t)$ for all $t \in {0,1}^s$, and $Q{io}$ is the zero polynomial if and only if $\tilde{F}{io}$ is zero on the boolean hypercube. Testing $Q{io}(\tau) = 0$ for random
The final polynomial
This polynomial is degree-3 in
C/S proofs follow from definitions of sumcheck, R1CS, and the schwarz zippel lemma.
Main theorem: Given an extractable polynomial commitment scheme for multilinear polynomials, there exists a public-coin succinct interactive argument of knowledge (NIZK) with security under the commitment scheme's assumptions and
To verify R1CS instance
To evaluate
-
$\tilde{eq}(\tau, r_x)$ - costs$O(\log m)$ operations in$\mathbb F$ -
$\tilde{F}_{io}(r_x)$ which requires:- Evaluating
$\tilde{A}(r_x,y)$ ,$\tilde{B}(r_x,y)$ ,$\tilde{C}(r_x,y)$ for all$y \in {0,1}^s$ - Each matrix evaluation costs
$O(n)$ operations as matrices have$n$ non-zero entries - Total cost
$O(n)$ operations in$\mathbb F$
- Evaluating
- Total verifier cost:
$O(n + \log m)$ =$O(n)$ operations in$\mathbb F$
An
Recall $G_{io,\tau}(x) = \tilde{F}{io}(x) \cdot \tilde{eq}(\tau, x)$, so $V$ needs $\tilde{F}{io}(r_x)$ and
where:
Naively, the prover could make three separate claims to verifier
$\mathcal{A}(r_x) = v_A$ $\mathcal{B}(r_x) = v_B$ $\mathcal{C}(r_x) = v_C$
Given these claimed values,
The verifier can compute
Recall that
This computation takes
Key insight: Prover claims values
This reduces to a more convenient second sumcheck instance over:
At end,
We want to evaluate
This means that the prover will commit to a poly
Protocol makes black-box use of polynomial commitment scheme, inheriting its security properties. Adding zero-knowledge and Fiat-Shamir transform yields NIZK family.
The proofs follow from commitment scheme properties and sumcheck protocol soundness.
Zooming in on the protocol described in detail now in a box in section 5:
-
$\mathcal{P}$ :$(C, S) \leftarrow \text{PC.Commit}(pp, \tilde{w})$ and send$C$ to$\mathcal{V}$ - The prover uses the the public parameters to commit to the witness. We commit to the witness so as to be able to open the witness at a challenge point
$r_y$ in step 11.
- The prover uses the the public parameters to commit to the witness. We commit to the witness so as to be able to open the witness at a challenge point
-
$\mathcal{V}$ :$\tau \in_R \mathbb{F}^{\log m}$ and send$\tau$ to$\mathcal{P}$ - Verifier returns the challenge to
$P$ . This will be compiled to NI by Fiat Shamir.
- Verifier returns the challenge to
- Let
$T_1 = 0, \mu_1 = \log m, \ell_1 = 3$ - Note the sumcheck parameters.
$T_1=0$ is the claimed sum (we want polynomial to sum to 0),$\mu_1$ is dimension of the hypercube,$\ell_1=3$ is the degree bound from Section 4's polynomial encoding.
- Note the sumcheck parameters.
-
$\mathcal{V}$ : Sample$r_x \in_R \mathbb{F}^{\mu_1}$ - verifier choses a random challenge value. To be fiat shamir'd.
-
First sumcheck: $e_x \leftarrow \langle\mathcal{P}{SC}(G{io,\tau}), \mathcal{V}_{SC}(r_x)\rangle(\mu_1, \ell_1, T_1)$
- recall:
$$G_{io,\tau}(x) = \tilde{F}_{io}(x) \cdot \tilde{eq}(\tau,x)$$ - prover computes sumcheck output
$e_x$ claimed to equal$G_{io, \tau}(r_x)$ . That is, the prover claims that the R1CS instance is satisfied. Verifier defers opening the sumcheck just yet, to avoid computing$G(r_x)$ , a polynomial linear in the size of witness$w$ . Note that opening$G$ is equivalent to opening some component polynomials, which we now do, in after a compressing linearization step.
- recall:
-
$\mathcal{P}$ : Compute$v_A = \mathcal{A}(r_x), v_B = \mathcal{B}(r_x), v_C = \mathcal{C}(r_x)$ ; send$(v_A, v_B, v_C)$ to$\mathcal{V}$ - Linearization (next 3 steps). The prover sends claimed evaluations of component polynomials to V, to be used to succinctly check the the above poly. The
$v$ 's represent random samplings of the multilinearization of the R1CS instance at$r_x$ . The verifier now will check that the sampling. That is, the claimed evaluations of the three key terms from $\tilde{F}{io}(r_x)$ at the sumcheck challenge point $r_x$. These will be used to verify $G{io,\tau}(r_x) = e_x$
- Linearization (next 3 steps). The prover sends claimed evaluations of component polynomials to V, to be used to succinctly check the the above poly. The
-
$\mathcal{V}$ : Abort with$b = 0$ if$e_x \neq (v_A \cdot v_B - v_C) \cdot \tilde{eq}(r_x, \tau)$ - Deny prover cheat: the sampled point of the multilinearized R1CS
$[v]$ must check out, forcing the claim to match poly$G_{io,\tau}(r_x)$
- Deny prover cheat: the sampled point of the multilinearized R1CS
-
$\mathcal{V}$ : Sample$r_A, r_B, r_C \in_R \mathbb{F}$ and send$(r_A, r_B, r_C)$ to$\mathcal{P}$ - These are random coefficients for linearizing the three polynomial evaluation claims into a single claim. They define the random linear combination used to compress three checks into one
- Let
$T_2 = r_A \cdot v_A + r_B \cdot v_B + r_C \cdot v_C, \mu_2 = \log m, \ell_2 = 2$ -
$T_2$ is the claimed value for the linear combination.$\mu_2$ is still dimension of hypercube, but$\ell_2=2$ is degree bound for$M_{r_x}$ polynomial (lower than first sumcheck!)
-
-
$\mathcal{V}$ : Sample$r_y \in_R \mathbb{F}^{\mu_2}$ . Second sumcheck: $e_y \leftarrow \langle\mathcal{P}{SC}(M{r_x}), \mathcal{V}_{SC}(r_y)\rangle(\mu_2, \ell_2, T_2)$- recall:
$$M_{r_x}(y) = r_A \cdot \tilde{A}(r_x,y) \cdot \tilde{Z}(y) + r_B \cdot \tilde{B}(r_x,y) \cdot \tilde{Z}(y) + r_C \cdot \tilde{C}(r_x,y) \cdot \tilde{Z}(y)$$ - the verifier now executes sumcheck over the polynomial
$M$ , where the$\t A, \t B, \t C$ terms are compressed by the verifier challenges$r_A, r_B, r_C$ . All that remains is to avoid having the verifier compute$\t Z$ which is depends on witness$\t w$ . We construct a component polynomial describing$\t Z$ in the next step.
- recall:
-
$\mathcal{P}$ :$v \leftarrow \tilde{w}(r_y[1..])$ and send$v$ to$\mathcal{V}$ - recall:
$$\tilde{Z}(r_y) = (1-r_y[0]) \cdot \tilde{w}(r_y[1..]) + r_y[0] \cdot \widehat{(io,1)}(r_y[1..])$$ - then
$v$ is an evaluation of the witness ml poly at the challenged$r_y$ values. The rest of the expression may be computed directly by$v$ from the R1CS values.
- recall:
- $b_e \leftarrow \langle\mathcal{P}{\text{PC.Eval}}(\tilde{w}, S), \mathcal{V}{\text{PC.Eval}}(r)\rangle(pp, C, r_y, v, \mu_2)$ ;
$\mathcal{V}$ : Abort with$b = 0$ if$b_e == 0$ - The verifier may now use the opening of
$\t w$ at$r_y$ to compute an opening to the second sumcheck at$r_y$ to compute the opening of the first sumcheck at$r_x$ , all underneath the PCS (denoted PC) This step verifies the claimed witness evaluation using the commitment from step 1. The PC.Eval protocol proves$v$ is correct evaluation.
- The verifier may now use the opening of
-
$\mathcal{V}$ :$v_Z \leftarrow (1-r_y[0]) \cdot \tilde{w}(r_y[1..]) + r_y[0] \cdot \widehat{(io,1)}(r_y[1..])$ - verifier computes the evaluation
$\t Z(r_y)$
- verifier computes the evaluation
-
$\mathcal{V}$ :$v_1 \leftarrow \tilde{A}(r_x, r_y), v_2 \leftarrow \tilde{B}(r_x, r_y), v_3 \leftarrow \tilde{C}(r_x, r_y)$ - Verifier evaluates R1CS matrices at challenge points - this is efficient as matrices are public. This step is not succinct, but can be rendered succinct via a PCS transformation, described in latter sections.
-
$\mathcal{V}$ : Abort with$b = 0$ if$e_y \neq (r_A \cdot v_1 + r_B \cdot v_2 + r_C \cdot v_3) \cdot v_Z$ - Verifier checks if claimed
$M_{r_x}(r_y)$ matches actual evaluation using all components.
- Verifier checks if claimed
-
$\mathcal{V}$ : Output$b = 1$
The remainder of the paper describes an efficient PCS for compressing the MLE opening for the prover, requiring a transformation from a dense MLE to a sparse MLE for efficiency.
That is, we now have an NIZK which we will render succinct via a constructed PCS, allowing the verifier to evaluate
The approach can be rendered ZK via commit and prove techniques ("Everything provable is provable in zero knowledge").
This step was SLOW
-
$\mathcal{V}$ :$v_1 \leftarrow \tilde{A}(r_x, r_y), v_2 \leftarrow \tilde{B}(r_x, r_y), v_3 \leftarrow \tilde{C}(r_x, r_y)$
but it's okay. We adjust with a PCS, including a pre-processing step committing to the R1CS instance as follows:
Encode Algorithm:
Encode(
Prover's Step:
Verification Protocol:
• $b_1 \leftarrow \langle\mathcal{P}{\text{PC.Eval}}(\tilde{A}, \perp), \mathcal{V}{\text{PC.Eval}}(r)\rangle(pp_{cc}, C_A, (r_x, r_y), v_1, 2\log m)$
• $b_2 \leftarrow \langle\mathcal{P}{\text{PC.Eval}}(\tilde{B}, \perp), \mathcal{V}{\text{PC.Eval}}(r)\rangle(pp_{cc}, C_B, (r_x, r_y), v_2, 2\log m)$
• $b_3 \leftarrow \langle\mathcal{P}{\text{PC.Eval}}(\tilde{C}, \perp), \mathcal{V}{\text{PC.Eval}}(r)\rangle(pp_{cc}, C_C, (r_x, r_y), v_3, 2\log m)$
•
The authors design SPARK to only incur subquadratic prover costs to compute eval in
Section 7 introduces SPARK, a PCS based in Hyrax.
Reader warning. The background fon this section is significant, and thorough understanding of Hyrax and "memory checking techniques" seems basically assumed. The section is described below at a high level, but a more precise, lower level description is beyond me at this moment.
Problem: For matrices
Naive Solution (SPARK-naive):
- Use existing commitment scheme (hyrax)
- For evaluation at
$r \in \mathbb{F}^{2\log m}$ , recall the defn of multilinear polynomial evaluation at$r$ :$$\tilde{M}(r) = \sum_{i \in {0,1}^{2\log m} : M(i)\neq 0} M(i) \cdot \tilde{eq}(i, r)$$ - Build
$O(\log m)$ -depth circuit with$O(n \cdot \log m)$ gates - Use Hyrax for verification
- Problem:
$O(n \log n)$ prover time
Better Solution (SPARK):
- Key insight: For
$M \in {A,B,C}$ , evaluation at$(r_x, r_y)$ can be rewritten:$$\tilde{M}(r_x, r_y) = \sum_{(i,j) \in ({0,1}^{\log m}, {0,1}^{\log m}) : M(i,j)\neq 0} M(i,j) \cdot \tilde{eq}(i, r_x) \cdot \tilde{eq}(j, r_y)$$ - Use offline memory checking to build
$O(n)$ -sized circuit - Employ multiset hash functions:
$$h_\gamma(a,v,t) = a\gamma^2 + v\gamma + t$$ $$H_\gamma(M) = \prod_{e \in M}(e - \gamma)$$ - Results in linear-time prover when combined with efficient commitment schemes; Sub-linear verification for sparse polynomials!
TODO
- Hyrax, a zkSNARK that achieves sub-linear verification costs for uniform circuits, specifically data-parallel circuits. The prover’s costs in Hyrax can be made linear in the circuit size using subsequent ideas. Furthermore, the verifier’s costs are O(d log n + e) where d is the depth of the circuit and e is the cost to the verifier to participate in PC.Eval to evaluate a log |w|-variate multilinear polynomial where w is a witness to the circuit.
- topic:: [[topic-Interactive Oracle Proofs (IOP)]]