Generating the proof
After arithmetization, both the prover and verifier have a system of polynomial constraints that has the following property:
A good prover knows the correct witness , because it has executed the program. Suppose we encode as a polynomial such that via interpolation. We call this polynomial the witness polynomial. For the zero knowledge property to hold, the prover does not want to reveal the witness to the verifier. The witness could have secret values. The goal of is to convince that he knows such that for all , without revealing . Let's see the whole protocol and then understand how it works.
Protocol
Commitment phase
- computes
- computes such that .
- Commit witness: sends to .
- Commit quotient: sends to .
Challenge and open phase
- sends a challenge to .
- opens and sends the proofs and results to .
Verify phase
- verifies and using the proof following the PCS.
- computes and .
- checks that .
Note: The name of the phases are not common to ZK literature, they where chosen in this text for educational purposes. is sometimes called the quotient polynomial.
Why it works
Commitmment phase
In the commitment phase the prover computes a polynomial called the zerofier. has all the roots we want our polynomial to have. Note that for all if and only if is a valid witness for the program logic encoded in . If is a good prover with a valid witness, then such that can be computed, because divides exactly . After that, the prover commits and and cannot change them anymore. Note that do not reveal any information about the polynomials. These are only commitments.
Challenge phase and open
In the challenge phase, sends a challenge . A challenge it's just a random field element, that cannot know in advance. Note that has committed to and before knowing . cannot have used to craft malicious polynomials during the commitment phase. Now, using the PCS, can send the values and the proof, without revealing any additional information of the polynomial. Special care must be taken, because could choose in order to reveal secret values of . For this purpose, is normally chosen out of the domain .
Verify phase
Note that the verifier could ask for for all using the polynomial commitment scheme. Then, could check that , and infer that is a valid witness, meaning that knows the correct execution of the program! But this has two problems. First, it would not be zero-knowledge, because would reveal the witness to . Second, it would not be succint, because the proof size would be proportional to the witness, which is large. To account for this the Schwartz-Zippel lemma is used. This lemma implies that if you compare two polynomials at a random value and it happens that , then and are the same polynomial with overwhelming probability. This is one of the reasons why we expressed the logic of our computation as a system of polynomial constraints. We want to use this lemma.
First of all, uses the PCS to verify the points and come from the committed polynomials in the first phase, and they have not been changed by a malicious after sending the challenge . Then computes . At this moment, is making sure that the logic of the agreed program is used. also computes the zerofier at , . Next, the verifier checks that . If the prover was good, then this equation must hold. Remember that the constraint system works by discriminating if is a valid witness or garbage. So if divides exactly , then must correspond to a valid witness. The trick for succintness is that we can check that for all , by just checking one equality at holds, by using polynomial division and the Schwartz-Zippel lemma.
Non-interactiveness
The protocol we showed is interactive, in the sense that and talk to each other. We can make this protocol non-interactive if we can get to output the complete proof without asking for a challenge . The challenge step is sometimes replaced with a trick called the Fiat-Shamir heuristic. This is just a way for to sample randomness without asking for it. For this to work, uses the unpredictable output of a hash function over things can't control: the public input, the result of the commitments, etc... The structure used in the algorithms to deliver this randomness is sometimes called the transcript.