Interactive proofs are complete and (statistically) sound, while interactive arguments are sound w.r.t computationally bounded prover (computational soundness).
Definition (SNARK). A succinct (preprocessing) non-interactive argument of knowledge (SNARK) is a triple of algorithms (S,P,V):
SetupS(C;r)=(pp,vp): Generates public parameters (pp,vp) for the prover and verifier respectively, given a circuit C.
ProveP(pp,x,w)=π: Produces a short proof π, where len(π)=sublinear(∣w∣)
VerifyV(vp,x,π): Fast to verify, with verification time: time(V)=Oλ(∣x∣,sublinear(∣C∣)),
that satisfy:
Completeness: For all x,w such that C(x,w)=0,Pr[π←P(pp,x,w):V(vp,x,π)=1]=1.
Knowledge Soundness: If V accepts, then P “knows” a witness w such that C(x,w)=0.
If the algorithms satisfy:
Zero-Knowledge: The (C,pp,vp,x,π) “reveals nothing new” about the witness w.
then the scheme is called a zk-SNARK.
Strong SNARK: all sublinear terms are log(∣C∣).
So in SNARK, prover can not simply send a w, for w might be long (∣w∣≤∣C∣) and it may be hard to verify C(x,w)=0.
Observe that S is randomized for setup phase. If r is revealed to P, it can prove false statements. This is because while vp is visible from P, it can hide some key structures invisible from P without knowing the random r.
The pre-processing has different types:
transparent setup: S(C) uses no random bit.
trusted but universal setup: S=(Sinit,Sindex), Sinit(r)=gp generates global parameters with secret r, Sindex(gp,C)=(pp,vp) is deterministic.
trusted setup per circuit: S(C;r) uses random bits for every circuit C.
Argument of Knowledge
Here we use trusted but universal setup.
Definition (Adaptive Knowledge Soundness). A preprocessing NARK (S,P,V) is (adaptively) knowledge sound for a circuit C if for every polynomial-time adversary A=(A0,A1) such that:
there exists an efficient extractor E (that uses A) such that:
gp←Sinit(1λ;r),(C,x,st)←A0(gp),w←EA(gp,C,x)
and
Pr[C(x,w)=0]>1/106−ϵ(for a negligible ε w.r.t. λ).
Adversary chooses (C,x) after seeing gp (adaptive), then produces a proof π. If A produces an accepting proof with non-negligible probability, then E can extract a valid witness w with essentially the same probability (up to negligible ε).
After intro, we proceed to constructing a SNARK, which uses 2 building blocks, one is functional commitment scheme, and the other is interactive oracle proof. The former is a cryptographic object and the latter is an information-theoretical object.
Building Blocks 1: functional commitment scheme
Definition (Commitment Scheme). A commitment scheme consists of
setup(1λ)→gp, outputs public parameters gp
commit(gp,f,r)→com, commitment to f∈F with r∈R randomly chosen
open(com,f,r): if com=commit(gp,f,r), then open(com,f,r)=1; otherwise open(com,f,r)=0
also defined as computational indistinguishability.
Note: the r in the open algorithm is the same as that in the commit algorithm.
After sender’s commitment, the sender should also send (x,r) for the receiver to verify. For example, if I want to play paper-scissors-rock with a friend remotely: first we determine our choices; then we send the commitments to each other; finally we send the choice and the random bits used and verify the commitments sent by one another.
To hide the message along the interaction (also, to make the proof short instead of (x,r)), we define functional commitment scheme.
Definition (Functional Commitment Scheme). A functional commitment scheme for F={f:X↦Y}:
setup(1λ)→gp, outputs public parameters gp
commit(gp,f,r)→comf , commitment to f∈F with r∈R, which is a binding (and hiding for zk-SNARK) commitment scheme for F
eval(P,V): for a given comf and all x∈X:
open(gp,f,x,r)→short proof π and value y∈Y
verify(gp,comf,x,y,π)→accept/reject
satisfying
Completeness: If f∈F and x∈X with f(x)=y, then Pr[V(gp,comf,x,y,π)=accept]=1.
Knowledge Soundness: (setup∥commit,open,verify) is knowledge sound.
The interaction within eval(P,V) is actually a SNARK for the relation (circuit)
whose witness is essentially (f,r). The proof π actually proves that f∈F, f(x)=y and comf is a commitment to f.
The definition above essentially illustrates an interactive process. It is like the verifier “queries” the oracle f at x with an additional cost of verifying.
IOP is a proof system that proves the prover knows w such that C(x,w)=0. The verifier uses oracles of f∈F, which is later replaced by functional commitments to construct a SNARK; here we use oracles.
Definition (F-IOP): An F-IOP is a proof system that proves ∃w,C(x,w)=0 and consists of
setup(1λ)→pp,vp=(Oraclef−s,…,Oraclef0)
At round i∈[t], prover P sends Oraclefi where fi is based on the interaction history from view of P; verifier sends ri$R unless i=t.
verifyOraclef−s,…,Oracleft(vp,x,r1,…,rt−1) uses (fi)i=−st as oracles and output the result.
which satisfies
Completeness: If∃w,C(x,w)=0, then the verifier is bound to accept
Knowledge Soundness: if we use comf’s for Oraclef’s, the extractor can use (fi)i=−st to compute w because the functional commitment scheme is knowledge sound (functional commitment scheme is actually a SNARK).
(Optional) Zero-Knowledge
Polynomial IOP for Circuit SAT
In this lecture we are going to construct a poly-IOP for circuit satisfiability. C is an arithmetic circuit with size S. The prover wants to prove that it knows the solution w to C(w)=y.
First, we label every gate of C with a bit string of length logS. Thus the computation of C(w)=y can be expressed in a form of function T:{0,1}logS↦F, which maps the label of some gate to the output of the gate with its output (notice that T(root)=y). Let h:FlogS↦F be the unique multilinear extension of T, satisfying h(x)=T(x) for all x∈{0,1}logS (the uniqueness is trivial by dynamic programming).
Why shall we extend the function T to a multilinear polynomial h? The necessity is shown in the part of the sum-check protocol.
Here V should have verified the h and T are the same on {0,1}logS. However V only has the commitment of h, so V verifies this by another approach shown below.
We use labels to denote gates, and define the polynomial gh:F3logS↦F as follows:
gh(a,b,c)=⎩⎨⎧h(a)+h(b)−h(c),h(a)h(b)−h(c),0,if c is an add gate with input a,b,if c is an mult gate with input a,b,otherwise.
which satisfies:
T is a correct assignment ⟺∀(a,b,c)∈{0,1}3logS,gh(a,b,c)=0(in F).
We shall modify a little in gh: we embed the result gh(a,b,c) into Z. So the condition above is equivalent to ∑x∈{0,1}3logSg~h(x)=0 where g~h:F3logS↦Z has the same values as gh on all inputs. Then P and V interact to let V believe that the sum is 0. If the sum is 0, V believes that P knows the correct T.
Here comes the usage of the sum-check protocol.
Sum-Check Protocol
The goal of the protocol is to check the answer C provided by prover satisfies:
C=x∈{0,1}n∑g(x)
where g is an n-variate polynomial over the field F and the sum is computed in Z (i.e. add them up without taking the modulo).
In setup phase, P sends the commitment of g to V. Then they interact for n rounds, and in the end V checks the final claim by querying the oracle of g for one time at a random point.
start:round 1:round 2:round n:Prover “I know s0=x∈{0,1}n∑g(x)” “Please verify the last step to compute s0”“I will proof s1(r1)=x∈{0,1}n−1∑g(r1,x), please verify...” “I will proof sn−1(rn−1)=x∈{0,1}∑g(r1,…,rn−1,x), please verify...” s0s1(X1)r1s2(X2)...sn(Xn)Verifier verify s1(0)+s1(1)=s0 and the next goal is to verify s1(X1)=x∈{0,1}n−1∑g(X1,x)“If indeed, then for most r∈F,s1(r)=x∈{0,1}n−1∑g(r,x). So I send a random r1.”... verify sn(0)+sn(1)=sn−1(rn−1) and the next goal is to verify sn(Xn)=g(r1,…,rn−1,Xn)rn$F, obtaining sn(rn). Then query the oracle of g at (ri)i=1n. Accept iff g(r1,…,rn)=sn(rn).
The probability that a cheating prover can make the verifier accept a false claim is at most ∣F∣ndeg(g) (by Schwartz-Zippel lemma, deg is the maximum degree in total, regardless of different variables). So we can make the soundness error negligible by choosing a large enough field.
Note that every polynomial from P is sent in its coefficients. Let d=deg(g) and it takes Tg time to verify/evaluate any g(x), we have
TV=O(nd+Tg),TP=O(2ndTg)
and the proof length is O(nd) .
For dense polynomial g , the time to evaluate its multilinear extension g~ on point x is at most O(2n) . Thus our prover has quadratic time. The [Libra] puts forwards a linear time sum-check prover.
This sum-check protocol is also used in the proof that IP=PSPACE. Define the decisional counting problem of 3CNF as:
so by translating the boolean formula into a multilinear polynomial, with the sum-check protocol we have (#SAT)D∈IP.
Suppose we have a TQBF formula ψ=∀x1∃x2…Qxn.φ(x1,x2,…,xn) , if we directly make ∀ into multiplication and ∃ into addition, the degree will skyrocket. Define for a p∈F[X1,…,Xn],
In analogy to the sum-check protocol, we can also define Xip:=pi←0+pi←1∈F[X1…Xi−1,Xi+1,…,Xn].
The idea is to linearize the polynomial after each multiplication. So the formula is described by the polynomial
A1L1E2L1L2A3L1L2L3…QnL1L2…Lnpφ=1
then the prover and verifier go through a O(n2) interaction to establish the protocol. Thus TQBF∈IP and IP=PSPACE.
PLONK IOP
Based on the lecture 4, we can encode a circuit problem into a polynomial. The sum-check protocol uses multi-variable polynomials with a large proof size (linear to n∼log∣C∣ even if we send commitments of polynomials instead of coefficients). PLONK is also used for circuit SAT with a different encoding, which uses univariate polynomials and has a proof size independent of n.
Small gadgets to build PLONK IOP
Let Ω=⟨ω⟩⊂Fp be a multiplicative subgroup of size k∣φ(p). And we want to provide protocols to prove that a committed polynomial f has some properties on Ω. The properties of given f,g∈Fp[X] include:
Zeroness: f(x)=0 for all x∈Ω
Sum/Product over Ω: ∑x∈Ω(f(x)−g(x))=0 or ∏x∈Ωg(x)f(x)=1
Permutation: (f(ωi))i=0k−1 is a permutation of (g(ωi))i=0k−1 . Warning: it is not enough to check ∏x∈Ωg(x)f(x)=1 ! The soundness relies on the random challenge by the verifier.
Prescribed permutation: f(y)=g(W(y)) for some known permutation W:Ω→Ω
Encoding a circuit into a polynomial
We again take C(x,w) as the circuit satisfiability problem. Let d=3∣C∣+∣x∣+∣w∣, and label each gate with a integer. And we have the d-th root ω, which satisfies ωd=1.
Setup phase outputs polynomial S and permutation W. The prover wants to prove that it knows w such that C(x,w)=0, so it interpolates a polynomial T∈Fp≤d[X] such that
T(ω−j)= the value of the j-th input
T(ω3i),T(ω3i+1),T(ω3i+2) are the left-input/right-input/output of the i-th gate, i=0,1,…,∣C∣−1
using FFT in time O(dlogd).
Then the prover proves the following:
The inputs are correct: T(ω−j)=xj for j=0,1,…,∣x∣−1
The math operations are correct: Use a public S(ω3i)=1 iff i-th gate is multiplicative; then, prove for all y∈{ω3i:i<∣C∣},
S(y)⋅T(y)⋅T(yω)+(1−S(y))⋅(T(y)+T(yω))−T(yω2)=0.
Wiring is correct: Use a public W to rotate the wires that share the same value; then, prove T(y)=T(W(y)) for all y∈{ωi:i<d}
The output is 0 : T(ω3∣C∣−1)=0
using the gadgets mentioned above.
Polynomial commitment based on discrete-log and pairing
KZG: pairing
We have G as a group of prime order p with generator g. We have a bilinear map e:G×G→GT where G≅GT≅Cp are p-order cyclic groups. We use F=Fp≤d[X], and the public parameters gp are generated as
(g,gτ,gτ2,…,gτd)←setup(λ,F;τ)
where τ is a random element in Fp; after computing, abort the random τ. To commit to a polynomial f(X)=∑i=0dfiXi, we compute
i=0∏d(gτi)fi←commit(gp,f).
In the evaluation phase, with input u, the prover sends v and a proof π for the verifier to verify f(u)=v using π. The idea is if f(u)=v, then f(X)−v is divisible by X−u. Let q(X)=(f(X)−v)/(X−u), then the proof is written as π=gq(τ) and (v,π)←open(gp,f,u). The verifier checks if e(gτ−u,π)=e(gvcomf,g). The verifier knows gτ−u because it knows gτ from the global parameter and it can compute gu from u.
Time: commit O(d) group exponentiations, open (including computing q) O(d) group exponentiations and O(d) group multiplications, verify O(1) pairings. Size: proof and commitment are both O(1) group elements.
The completeness is trivial. For soundness, if the prover outputs another (v′,π′) such that f(u)=v′ and e(gτ−u,π′)=e(gv′comf,g), then we have (denote δ=f(u)−v′):
where the operations on the exponent are in Fp which corresponds to the multiplication in the groups G and GT. This is the q-Strong Bilinear Diffie-Hellman** assumption, which says that it is hard to compute e(g,g)τ−u1 given (p,G,g,GT,e) and gp=(g,gτ,…,gτd).
Knowledge Soundness
The plain KZG is not knowledge soundness without assumptions like KoE or GGM. We will discuss the assumptions in the PCP-based SNARK.
Zero-Knowledge-ness
The plain KZG is not zk since the commit algorithm is deterministic. For example, you can use gf(τ) to test if f is a zero polynomial. Here, we denote the protocol modified to zk in the graph below.
Setup: sample τ,η$Fp and compute gp←(g,gτ,…,gτd,gη); then delete τ,η.Proverr$Fp,comf=gf(τ)+rη←commit(gp,f;r)r′$Fp,v←f(u),π=(gq(τ)+r′η,gr−r′(τ−u))←open(gp,f,u,r;r′)comfu∈Fpv,πVerifiere(π1,gτ−u)e(π2,gη)=?e(gvcomf,g)
The polynomial is hidden by the random r′.
Variants of KZG
For multivariate poly: f(x1,…,xk)−f(u1,…,uk)=∑i∈[k](xi−ui)qi(x1,…,xk) . Prover computes and sends πi=gqi(τ1,…,τn) . Prover time is O(km) group exponentials where m≤2k is the number of terms of f . [Chopin] claims to reduce the prover time to m+O(m) MSMs (compute ∏jgjaj ).
For batch query on u1,…,um: f(x)−h(x)=q(x)∏i∈[m](x−ui) where h(x) is the extrapolation of (ui,f(ui))’s.
For multi-party, each party has a private number for setup, and the public parameters are (for example, 2-party) gp=(g,gst,…,g(st)d). The parameters can be generated party after party, since g(st)i=(gsi)ti.
And it is worth noting that PLONK uses univariate KZG and plonk IOP, while vSQL uses multivariate KZG and sum-check protocol.
Bulletproofs: discrete-log
KZG requires trusted setup. Here we present Bulletproofs which has transparent setup. The goal of the prover is to convince the verifier that f(u)=v where f=∑i=0d+1fixi∈Fp[X]. The setup phase is just a random gp=(gp0,0,…,gp0,d)∈G and we assume d+1=2k is some exponential of 2. Then the prover and verifier go through a interaction shown below:
round 1:round 2:round k:final :Provercomf=i=0∏2k−1gp0,ifi←commit(gp,f)f=f0→fL+u2k−1fR,L=i=0∏2k−1−1gp0,i+2k−1f0,i,R=i=2k−1∏2k−1gp0,i−2k−1f0,i,vL=fL(u),vR=fR(u)f1←rfL+fRf1→fL+u2k−2fR,L=i=0∏2k−2−1gp1,i+2k−2f1,i,R=i=2k−2∏2k−1−1gp1,i−2k−2f1,i,vL=fL(u),vR=fR(u)...fk−1→fL+ufR,L=gpk−1,1fk−1,0,R=gpk−1,0fk−1,1,vL=fL(u),vR=fR(u)fk∈Fp←rfL+fRcomf,vL,R,vL,vRgp1,rL,R,vL,vR...L,R,vL,vRgpk,rVerifier“I verify f0(u)=v ”: v=?vL+vRu2k−1gp1←(gp0,ir−1gp0,i+2k−1)i∈[0,2k−1),r$Fp[X],v1←rvL+vR,comf1←LrRr−1comf“ I verify f1(u)=v1”: v1=?vL+vRu2k−2...“I verify fk−1(u)=vk−1 ”: vk−1=?vL+vRugpk←(gpk−1,0r−1gpk−1,1),r$Fp[X],vk←rvL+vR,comfk←LrRr−1comfk−1“ I verify fk=vk as a constant polynomial ”: comfk=?gpkvk
The r’s at every round is sampled randomly and independently. Then we apply Fiat-Shamir to the protocol. The gp’s should be computed by the verifier to prevent backdoor in parameters.
Time analysis
Setup: O(d) sampling
Commit: O(d) group exponentiations
Prover: O(d) group exponentiations
Verifier: O(d) group exponentiations
The proof size is O(logd) group elements, and the commitment size is O(1) group elements (this is the first commitment comf. Other commitments are computed by the verifier).
Soundness analysis.
Statistical soundness: we assume the prover does not know the correct v. The final fk is a multilinear polynomial of all the random r’s, say fk=gf(r1,…,rk) and the function gf is deterministic. Note that every f corresponds to a unique gf.
So, conditioned on the prover does not know the correct v but send a v∗=v instead, we can say v∗=f∗(u) for some f∗=f. Thus by the Schwartz-Zippel lemma, we have
because f(u)=uTFu′=∑i=0d−1∑j=0d−1fi,juid+j.
Setup phase samples a random hash function. Then in commit phase, the prover encode each row of F with a [n,d] linear code (this encoding is a public algorithm, e.g. Reed-Solomon code), represented by a matrix C∈Fpd×n. The result is a matrix of d×n:
P=f0Cf1C⋮fd−1C.
After encoding, use Merkle tree to generate the commitment with the hash function in the global parameters. The leaf nodes are the n columns of the matrix P. The root hash is the commitment of the function.
Then the prover and verifier go through the following interaction to verify f(u)=x:
Proverw←rTF(originally we send encoded version rTP, this is for optimization)Generate Merkle proof π that the s-th column of P equals to v∈Fpdw′←uTFGenerate Merkle proof π that the s-th column of P equals to v∈Fpdrwsπ,vw′sπ,vVerifierr$Fpdw←wC is indeed a codewords$Fpverify the proof π, and verify rTv=ws, then repeat sampling s multiple timesw′←w′C is indeed a codewords$Fpverify the proof π, and verify rTv=ws′, then repeat sampling s multiple timesw′u′=?x
Analysis of the protocol is as follows:
Keygen: O(1), transparent
Commit:
Encoding: O(dlogd) field multiplications using Reed-Solomon code, O(d) using linear-time encodable code
Merkle tree: O(d) hashes, O(1) commitment size
Prover time: O(d) field multiplications
Proof size: O(d)
Verifier time: O(d)
Fast Reed-Solomon IOPP
Intro: Merkle trees for univariate poly-commitment
An intuitive attempt is to commit to a vector of evaluations of a given polynomial f∈Fp≤d[X]. The leaves of the tree are {f(x):x∈Fp} and the tree hashes every neighboring 2 nodes to form a new layer. When V requires f(r), the prover sends the hash values along the path up to the root.
The Merkle tree for commitment requires O(pd) field multiplication (using Qin-Horner method) to commit, and the proof size is O(logp) hash values. The verifier takes O(logp) hashes. The setup only generates a hash function, so it is transparent.
There are 2 problems:
The field may be very large; and the time is linear to the max degree.
The verifier cannot know if f has degree at most d.
Fix the Problem 1
FRI commitment uses a multiplicative subset of Fp: Ω={ωi:ωn=1,i=0,1,…,n−1}, for example, {1,3,9,27,−1,−3,−9,−27} in F41. The leaves of the Merkle tree will be the values f(ωi).
We call the rate ρ=nd the FRI blowup factor.
Fix the Problem 2
round 1:round 2:round log2k:query :Proverf0=f,degf0≤k−1,Ω0={1,ω,…,ωn−1},n=ρ−1kf0(X)=f0,e(X2)+Xf0,o(X2)f1(Z)=f0,e(Z)+r1f0,o(Z),degf1≤2k−1,Ω1={x2:x∈Ω0}f1(X)=f1,e(X2)+Xf1,o(X2)f2(Z)=f1,e(Z)+r2f1,o(Z),degf2≤4k−1,Ω2={x2:x∈Ω1}...ft−1(X)=ft−1,e(X2)+Xft−1,o(X2)ft(Z)=ft−1,e(Z)+rtft−1,o(Z),degft=0,Ωt={x2log2k:x∈Ω0}对于每个jq,打开从第t=log2k层到第0层的路径:πt,jq←MerkleOpen(comt,jq)πt−1,jq+,πt−1,jq−←MerkleOpen(comt−1,对应的两个索引)...com0=MerkleCommit(f0∣Ω0)r1com1=MerkleCommit(f1∣Ω1)r2com2=MerkleCommit(f2∣Ω2)rtcomt=ft∣Ωt{jq}q=1s所有打开值+路径Verifierr1$Fpr2$Fp...rt$Fpverify that ft∣Ωt is a constant vector随机选择j1,…,js∈[0,∣Ωt∣−1]验证每条路径的一致性;同时,对于第t层: ft(ωtjq)是常数对于第i层: 检查fi+1(z)=?2xri+1+xfi(x)+−2xri+1−xfi(−x)其中z=x2,x=ωij,ωi是第i层的生成元
Remark.
It is easy from fi∣Ωi to fi+1∣Ωi+1. This is because fi+1(x2)=fi,e(x2)+ri+1fi,o(x2)=2fi(x)+fi(−x)+ri+12xfi(x)−fi(−x). Also, the verifying process relies on this equation.
To analysis the soundness, we introduce the relative Hamming distance HamΩ(f,g)=∣Ω∣∣{x∈Ω:f(x)=g(x)}∣ and δ=minh∈Fp≤k−1[X](HamΩ(f,h)), which is the distance on Ω of f to the closest degree-(k−1) polynomial.
We consider f such that δ≤1−ρ, which is to say, the f is far from any degree-(k−1) polynomial.
A cheating prover has a high (>k−1) degree polynomial f. In case the prover is accepted, either it folds incorrectly, or it folds correctly and is lucky to have those ri’s that reduce the degree to 0 eventually. In the first case, the accept probability is (1−δ)t; in the second case, the accept probability is at most pk. As a result, to reach an accept probability 2−λ (λ is the security parameter), s should be Ω(logρ−1λ).
(The security proof is problematic.)
Polynomial commitment from FRI
The FRI introduces another two problems:
Prover has only committed to evaluations on a subset Ω⊂Fp.
Verifier only knows that f is close to a low-degree polynomial (in the sense of Hamming distance), but not necessarily a low-degree polynomial.
There is an attack to the first problem: the prover can commit to a polynomial g that agrees with f on T⊂Ω with much lower degree (∣T∣=k). Then δ<1−ρ<1−ρ and the soundness is broken.
Then to confirm that f(r)=v where f∈Fp≤d[X], the prover applies FRI on the polynomial (f(x)−v)/(x−r), which has degree at most d−1.
Fiat-Shamir transform
Definition. (Interactive Security) A poly-commitment scheme runs at λ bits of interactive security if and only if: assume P cannot find a collision of the hash function in the global parameters, then for every P∗, the probability that P∗ can make the verifier accept a false claim is at most 2−λ.
To find out if a challenge is lucky, the prover should interact with the verifier at least 2λ times in average. It is unlikely that V continues to interact after rejecting the same prover so many rounds. So following is the
Definition. (Non-interactive security) A poly-commitment scheme runs at λ bits of non-interactive security if and only if: for every P∗ willing to compute 2k hashs, the probability that P∗ can make the verifier accept a false claim is at most 2k−λ.
In this scheme, a lying P can propose the grinding attack silently, without interacting. This definition is weaker than the interactive security, i.e., if a prover breaks the interactive security of one interactive protocol, then it can also break the non-interactive security of the Fiat-Shamir transform of that protocol.
We show that Fiat-Shamir transform may be insecure. Consider a protocol of the empty language. In this protocol, P sends a nonce, and then V sends a random bit r, and accepts iff r=1. The V accepts iff every round it accepts, so the soundness error is 2−λ with λ rounds. However, the Fiat-Shamir transform of this protocol is insecure, since the prover can grind for a nonce 2 times per round in average, in order to find a nonce that leads to r=1 for every round. The cost is 2λ in average, which is much smaller than 2λ and the protocol does not satisfy the non-interactive security.
Applying Fiat-Shamir to a many-round interactive protocol can lead to a huge loss in security, whereby the resulting non-interactive protocol is totally insecure. So we need “round-by-round” soundness to describe the security of an interactive protocol, which means that for every prover in every round, if the prover is not “lucky” enough to make the verifier accept, then the probability that the prover can make the verifier accept in the next round is at most 2−λ.
The sum-check protocol is round-by-round sound, so its Fiat-Shamir transform is secure.
Linear PCP-based SNARK
Here is another paradigm for SNARKs: a cryptographic tool and a linear PCP builds a SNARK system. Before IOP and PCS paradigm was put forward, the main paradigm is PCP, e.g. Kilian’92 and Micali’00 is PCP+Merkle tree; IKO’07 is linear PCP; GGPR’13 uses QAP as linear PCP.
Quadratic Arithmetic Program (QAP)
QAP is another method to encode a circuit into a polynomial. Recall that in the first IOP for circuit SAT, we label each gate with a bitstring, and the satisfying value is encoded into a multilinear polynomial on the hypercube (interpolated to Fpn). In PLONK, we label each wire with an integer, and the satisfying value is encoded into a univariate polynomial on the roots of unity.
QAP labels all the input and output of all multiplicative gates. We label each gate with integers in [n] and each wire (except output wires of additive gate) with integers in [m]. The value of wire i is ci. Then we define li(x) by li(ωj)=1,ωn=1, iff ci is the left input of the gate j; and the same as ri(x), oi(x) for the right input and output.
Note that we say i is the left input of gate j also if i passes several additive gates before it is the left input of gate j. Then we have: the value on the circuit is proper iff
exactly encodes the left-input, right-input and output of gate j with Lc(ωj), Rc(ωj), and Oc(ωj).
Thus, the statement that P knows w such that C(x,w)=0 holds iff P knows a vector c such that Lc(x)Rc(x)−Oc(x)=q(x)∏i∈[n](x−ωi)=q(x)V(x).
Constructing SNARK: [PGHR13] and [Groth16]
The global parameter is gp=((gτi)i∈[n],(gli(τ))i∈[m],(gri(τ))i∈[m],(goi(τ))i∈[m],gq(τ)) where τ is a random element (later deleted) in Fp.
With KZG in our hands, we reach to a simple protocol: The prover can compute πl=gLc(τ), πr=gRc(τ), πo=gOc(τ), and π=gq(τ) by homomorphically combining the global parameters. The verifier checks if e(πl,πr)=e(πo,g)e(π,gV(τ)).
However, the protocol is far from the real protocol.
Problem 1: How to make sure that πl is computed from gli(τ)?
KoE Assumption. We use gp=(gli(τ),gαli(τ))i∈[m]. If the prover can compute π1=g∑icili(τ) and π2=gα∑icili(τ) without knowing α, then there is an extractor that can extract ci’s from the prover. The Pinocchio [PGHR13] uses KoE assumption.
GGM Assumption. Any prover can only compute linear combinations of gli(τ)’s, i.e., if the prover can compute π=g∑icili(τ), then it must know every ci. [Groth16] uses GGM assumption.
Problem 2: How to make sure every π share the same ci’s?
We use another random β for setup (also deleted after setup). We add gβ(li(τ)+ri(τ)+oi(τ)) and gβ to the global parameters.
Problem 3: How to handle the public input and the expected output?
Recall that all the wires except the output of add gates are labelled. So the input wire and output wire (if not labelled, add a multiply 1 gate) are labelled with Iio . The idea is to split Lc apart, and let verifier compute ∑i∈Iiocili(x).
Analysis
Setup: O(n) group exps, since there is a unique j that makes li(ωj)=1 , if we label different wires with a same output gate with different labels.
Prover: O(nlogn) for NTT. The prover computes the values of polynomial q on the unity set ⟨ω⟩ and uses NTT to get its coefficients. Only with coefficients can the prover compute gq(τ) . Also, O(n) group exps.
Proof size: O(1)
Verifier: O(1) for pairing, O(∣Iio∣) group exps.
Recursive SNARKs
Recall if the circuit size is n:
Pinocchio and Groth16: prover time O(nlogn) and proof size O(1)
PLONK-KZG: prover time O(nlogn) (every gadgets the prover should compute NTT) and proof size O(1)
FRI-based: prover time and proof size O(log2n)
How can we achieve the better one in both prover time and proof size? The recursive proof provides a “proof of proof”. Let the inner system be (S,P,V) , which proves that the prover knows the w such that C(x,w)=1 . Suppose that the prover and verifier P and V is fast but the proof π is long, the idea is to construct another proof system (S′,P′,V′) proving that the prover knows the π such that V(vp,x,π)=1 . This outer system has slower prover, but since the verifier V is fast, the circuit of V is much smaller than that of the original C . So the outer prover P′ is not so slow, as we expected.
A simple argument shows that if (S,P,V) and (S′,P′,V′) are both knowledge sound, then the integrated proof system is also knowledge sound. The idea of proof is to regard the extractor E′ as a malicious prover of (S,P,V) . The probability gap is the sum of those of the original prove systems, thus negligible.
Suppose that a computation F is applied to initial state s0 recursively, each round takes an input wi . The prover wants to prove that it knows the wi ’s such that each computation step is correct. The verifier wants to verify that after n steps, the state s0 eventually becomes sn . (TODO)
Application 2: streaming proof generation
Suppose there is a bunch of transactions to be proved. We need not wait the transactions all to take place; rather, we generate proofs on every arrival of batches. For example if the batch size is 1 , first π1 proves the prover knows w1 that C(x1,w1)=0 ; then π2 proves that the prover knows w2 such that C(x2,w2)=0 . Then a proof is generated to prove that the prover knows π1,π2,… such that the verifier accepts them all.
Construction: alternating groups
Recall in KZG, the public parameter is a tuple (p,G,q,g,e) , where G is a group of order p with g its generator. And in this section, we regard the verifier algorithm as a circuit, so we had better embed G into some vector space over Fq .
Definition (Algebraic Groups). Group G≤Fqℓ is an algebraic group if and only if
there are polynomials f1,…,fℓ∈Fq[Xℓ] such that for all a,b∈G , a+b=(f1(a,b),…,fℓ(a,b)) ;
there is an efficient algorithm testing if a=b .
Can we make ∣G∣=p a subgroup of Fpℓ ? No, because the discrete log is trivial in such groups. Take Smart Attack in the anomalous curve for an example.
The idea is to construct a group chain that: ∣G1∣=p , G1<Fqℓ ; ∣G2∣=q , G2<Frℓ . The original circuit C is over Fp . The KZG PCS will help us understand this recursive SNARK, because in that scheme, an exponentiation embeds every elements in Fp into G1<Fqℓ . Now that V is a circuit over Fq , the proof that the prover P′ knows a proof π1 involves group arithmetic on Fq . Since G2 has order q , then P′ sends a proof in G2 .
However it is inefficient to have two pairing groups. For one pairing group and another non-pairing group, we can use KZG for one and bulletproofs for the other. The Halo is based on two non-pairing groups, i.e. elliptic group E(Fp) and E(Fq) of the elliptic curve y2=x3+5 . Details https://eprint.iacr.org/2019/1021.pdf
Construction: folding
Another idea is homomorphic commitment, which we can compute a commitment of an addition simply by adding the commitments. We use this to prove two circuits at once (generate one proof for the two circuits) . More precisely, all circuits can be written in R1CS form (Az)∘(Bz)=Dz . An idea to prove two instance z1=(x1,w1),z2=(x2,w2) of the same R1CS at one time is to randomly choose an r and prove for some R1CS, the combination z1+rz2 is feasible. However, we cannot have (Az1+rAz2)∘(Bz1+rBz2)=D(z1+rz2) if z1,z2 are feasible inputs. Thus we turn to modify the definition and put forward Relaxed R1CS.
HW
❎ Knowledge soundness is a meaningful notion when a prover claims that there are no satisfying assignments to a system of constraints
❎ Knowledge soundness is a meaningful notion for the sumcheck protocol
✅ Knowledge soundness (as defined in lecture 2) implies soundness
❎ Non-interactive implies publicly verifiable
❎ Vector commitments are as expressive as polynomial commitments
✅ Polynomial extensions are distance amplifying encodings
✅ Multivariate polynomial encoding reduces the total degree by an exponential factor compared to univariate polynomial encoding
✅ The verifier in the sum-check protocol is oblivious to the polynomial g whose evaluations are being summed until the last step
❎ The uniqueness of multilinear extensions is crucial for the soundness of the sumcheck protocol
❎ The claim f(x) = g(x) for all k-bit inputs, where f and g are low degree polynomials over a large field, can be reduced to the following sumcheck claim: _{x ^k} (f(x)-g(x)) = 0
❎ The polynomial IOP for SAT (from lecture 4) can be transformed into a SNARK with verifier complexity independent of circuit size
✅ The polynomial IOP for SAT (from lecture 4) has optimal prover complexity
✅ Extending the polynomial IOP for SAT in the natural way to support gates with n inputs will result in a sumcheck protocol over (n+1) * logS variables