Try   HackMD

Notes on Plonk Prover's and Verifier's Algorithm

Disclaimer: This documentation was written on July, 2021. It is intended to give readers a high-level understanding. The codebase is the canonical source of truth, and over time this document might fall behind the implementation details of the code.

Author: Arijit

This is a brief note about my understanding of the prover's and verifier's algorithms in the Plonk paper. The note directly jumps to Section 8.4 of the paper and tries to answer some questions which I had while going through the various steps of the algorithms. I would like to acknowledge the help and clarifications I got from Zac, Ariel, and Suyash in writing this note.

The goal of the prover is described in the language

Rsnark(λ) given in Section 8.3 of the paper. In the polynomial setting, this boils down to proving knowledge of the wire polynomials
a(X),b(X)
,
c(X)
, and the permutation polynomial
z(X)
such that,

  1. a(X)b(X)qM(X)+a(X)qL(X)+b(X)qR(X)+c(X)qO(X)+PI(X)+qC(X)=0
    holds for all
    XH
    , where
    H
    is the set containing the roots of unity.
  2. (a(X)+βX+γ)(b(X)+βk1X+γ)(c(X)+βk2X+γ)z(X)(a(X)+βSσ1(X)+γ)(b(X)+βSσ2(X)+γ)(c(X)+βSσ3(X)+γ)z(Xω)=0
    holds for all
    XH
    .
  3. (z(X)1)L1(X)=0
    holds for all
    XH
    .
    As explained in the paper, the first condition will validate the gate contraints (the witnesses satisfy the plonk circuit) and the second and third conditions will validate the copy constraints (all the connections of the plonk circuit are verified by the grand product argument). However, the prover should prove that the above conditions hold in zero-knowledge i.e. without revealing the polynomials
    a(X),b(X)
    ,
    c(X)
    , and
    z(X)
    . To do so the prover proceeds as follows.

Round 1:

The prover constructs the polynomials

a(X),b(X), and
c(X)
with some randomizations. Then it computes the commitments of
a(X),b(X)
, and
c(X)
as per the Kate's polynomial commitment scheme. Here the commitment
[k]1
to a polynomial
k(X)=ikiXi
is defined as the evaluation of the polynomial at the unknown SRS point
x
in the exponent of the generator
G1
of the first group i.e.,
[k]1=(ikixi)G1.

Note: The random parts of

a(X),b(X), and
c(X)
are,
b1X+b2,b3X+b4,b5X+b6,

respectively. Note that they have zero contributions when the polynomials are evaluated at the roots of unity. This is due to the multiplication with the vanishing polynomial
ZH(X)=Xn1
which has all
n
roots of unity as its roots.
Q: Why do we need two random scalars to randomize
a(X),b(X)
and
c(X)
.
A: The prover needs to send the commitments to
a(X),b(X)
, and
c(X)
and also their evaluations at
z
to the verifier. Roughly, the two revelations costs two random scalars for the protocol to satisfy the special honest-verifier zero-knowledge (SHVZK) property.

Round 2:

Like the wire polynomials, the permutation polynomial

z(X) is computed by adding some randomization. In Section 5 (Polynomial protocols for identifying permutations), it is explained what should be the value of
z(X)
for each roots of unity. Those values are set by using the Lagrange bases
Li(X)
s.
Q: Why do we need three random scalars to randomize
z(X)
.
A: Unlike
a(X),b(X)
, and
c(X)
, the permutation polynomial
z(X)
has been used to evaluate two opening proof polynomials
Wz(X)
and
Wzω(X)
. This costs three random scalars to ensure the SHVZK property of the protocol.

Round 3:

Q: What is the quotient polynomial

t(X) and why it is computed?
A: The quotient polynomial
t(X)
has four elements. The numerators of the four elements are from the three conditions given above that the prover has to satisfy. Each of them are divided by
ZH(X)
and added after some random scaling by
α
and
α2
. The fact that the prover has successfully computed a "valid" commitment to
t(X)
will ensure that
t(X)
does not have any
aiXi
term. This is because the SRS used to compute the commitment does not have any
xiG1
term.

This in turn proves that

ZH(X) divides all the numerator i.e. the numerators evaluate to zero at every roots of unity. Hence the three conditions given above are satisfied.

Instead of computing commitment to

t(X), the prover breaks
t(X)
into three parts
tlo(X)
,
tmid(X)
, and
thi(X)
and computes their commitments. This is done because of the folloing reasons.

  1. We want the max degree of our polynomials to be n.
  2. Kate opening proof
    Wz(X)
    computation (in terms of
    r(X)
    ) would require committing to size 3n polynomials which is very inefficient.

Round 4:

To prove the definition of

t(X),
a(X)
,
b(X)
,
c(X)
,
Sσ1(X)
,
Sσ2(X)
are evaluated at a random challenge point
z
which is generated non-interactively by Fiat-Shamir heuristic.
Q: Why every polynomial in
t(X)
is not evaluated?
A: This is because of the linearization trick (described in page 18) where a partial evaluation of polynomials is done to prove an identity involving them. This is to reduce the communication cost of the prover.
Q: Why
z(X)
is evaluated at a different point
zω
?
A: In
t(X)
, both
Z(X)
and
Z(Xω)
appear. We do not evaluate
Z(X)
to make use of the linearization trick and only evaluate
Z(X)
at
zω
. As
Z(X)
is opened in
zω
instead of
z
, we need a separate opening polynomial
Wzω(X)
for
Z(X)
defined in Round 5.

Round 5

Q: What is the linearization polynomial

r(X)?
A: To simplify, let
t(x)=tlo(X)+Xntmid(X)+X2nthi(X)=l(X)ZH(X).

This implies,
r(X)=l(X)parZH(z)(tlo(X)+zntmid(X)+z2nthi(X))
is zero if it is evaluated at
z
. Here
l(X)par
has a mixed form of polynomials and evaluations at
z
.

Note that the verifier can calculate the commitment of

r(X) using the elements of the proof
πSNARK
generated so far i.e.
([a]1,[b]1,[c]1,[z]1,[tlo]1,[tmid]1,[thi]1,a¯,b¯,c¯,s¯σ1,s¯σ2,z¯ω)
. Thus the prover does not have to send the commitment to
r(x)
to prove that it vanishes at
z
.

Now let us observe

Wz(X). Let,
Wz(X)=M(X)Xz

If the prover can compute the commitment to
Wz(X)
, then it is verified that
(Xz)
divides
M(X)
(As the SRS does not have negetive exponents of
x
). Now consider each part of
M(X)
. As
v
is random,
(Xz)
divides each term.
(Xz)
divides
r(X)
implies
r(z)=0
. Similarly
(Xz)
divides
(a(X)a¯)
implies
a¯
is the evaluation of
a(X)
at
z
.

To show that if

(Xz) divides
(a(X)a¯)
, then
a¯=a(z)
.
We have
(a(X)a¯)=q(X)(Xz)
. Putting
x=z
, we get
a¯=a(z)
.

This applies for other polynomials and their evaluations as well. In this way the commitment to

Wz(X) verifies every evaluations of the polynomials and also
r(z)=0
.

As discussed above, we need a separate opening polynomial

Wzω(X) to validate the evaluation
z¯ω
of the polynomial
z(X)
at
zω
.

Finally, the prover outputs commitments

[Wz]1,
[Wzω]1
to these two opening polynomials and construct the proof
πSNARK
.

Verifier's algorithm:

In steps 1 to 3, the verifier checks the sanity of different elements of

πSNARK. Steps 4 to 11 are the various steps that prepare the verifier for the pairing check.

Let

Wz(X)=M(X)Xz and
Wzω(X)=N(X)Xzω
. After rearranging we get,
XWz(X)=M(X)+zWz(X)XWzω(X)=N(X)+zωWzω(X)

Combining these two identities with the multi-point evolution challenge
u
gives,
X(Wz(X)+uWzω(X))=zWz(X)+uzωWzω(X)+M(X)+uN(X)

Step 12 checks the above identity in the exponent using pairing and all the commitments and the evaluations of polynomials sent by the prover. Using the polynomial commitments, the unknown SRS value
x
is used instead of the indeterminate
X
and accumulated in
F
. The components involving constant terms and evaluations are accumulated in
E
. This is similar to the batch verification of the Kate commitment scheme described in Section 3 of the paper.

This validates the opening commitments

[Wz]1,
[Wzω]1
and all the three statements to be proved by the prover are verified.