Modified: October 23, 2022
zero knowledge
This page is from my personal notes, and has not been specifically reviewed for public consumption. It might be incomplete, wrong, outdated, or stupid. Caveat lector.A zero-knowledge proof allows a prover to demonstrate that it possesses certain information, without revealing that information to the verifier.
Formally, the prover must convince a verifier that some object is in a set (formal language) . The prover possesses information, a witness , that demonstrates this. For example, may be a graph which the prover wants to demonstrate belongs to the set of three-colorable graphs. To do this it would serve to exhibit a three-coloring of : this is the witness . A zero-knowledge proof scheme allows the prover to demonstrate their claim without revealing .
We model the prover and verifier and as probabilistic polynomial-time algorithms that send a sequence of messages back and forth, ending with the verifier outputting either ACCEPT or REJECT.
Such a scheme is required to have three properties:
- Completeness: if and is the correct witness, then outputs ACCEPT.
- Soundness: if , then a 'dishonest' prover (any probabilistic polynomial-time algorithm ) will convince the verifier to ACCEPT only with some probability that goes to zero at a faster-than-polynomial rate (i.e., a negligible function of the interaction length).
- Zero-knowledge: the verifier doesn't learn anything except that . Formally, there must exist some probabilistic polynomial time algorithm , the 'simulator', such that for any , the simulator can generate a trace whose distribution is polynomial-time indistinguishable from that of a real prover-verifier interaction trace .
Note that the simulator doesn't have access to the witness (and being a poly-time algorithm, doesn't have the computational capability to discover it), so its traces cannot leak any information about . If these traces are indistinguishable from those of real interactions, then the real traces can't leak anything either. But since the interaction was supposed to prove access to , how is it possible to produce an indistinguishable trace without access to ? The key is that it's the interaction itself that is convincing, not the trace that it produces. The verifier knows that it is producing its challenges honestly, not colluding with the prover, but a third party viewing the trace will not know this. Because the simulator controls both sides of the trace, the simulated 'verifier' can generate 'random' challenges that always happen to correspond to what the simulated 'prover' is prepared to answer; equivalently, the prover can anticipate the verifier's challenges and prepare accordingly.
Given the crucial role of interaction in classic zero-knowledge proofs, it is somewhat surprising that non-interactive zero-knowledge proofs (zk-SNARKs) are possible, but they are, and this also turns out to be practically very impactful.
Zero-knowledge proofs for NP
We can show that all languages in NP admit zero-knowledge proofs by demonstrating a proof scheme for a particular NP-Complete problem: three-colorability of a graph.
Let be a three-coloring of a graph ; note that by permuting the colors one can actually generate six equivalent such colorings . A single round of the protocol works as follows:
- The prover secretly chooses one of the permutations at random, and uses a commitment scheme to commit to the color of each vertex in the graph without revealing these colors to the verifier.
- The verifier chooses a pair of adjacent vertices at random, and challenges the prover to reveal the colors of just those vertices.
- The prover reveals that the adjacent vertices have different colors.
It is easy to see that this scheme is complete: if the prover really does possess a three-coloring of the graph, they can go for as many rounds as the verifier requires. To see that the scheme is sound, consider a dishonest prover without access to a three-coloring: then the coloring it commits to has at least one edge pair with identical colors, so the chance that it 'gets lucky' and fools the verifier at each step is at most . The probability of fooling the verifier over independent rounds thus goes to zero exponentially quickly.
The fact that the proof is zero-knowledge follows from the hiding property of the commitment scheme --- so the verifier learns nothing other than the colors of the edge it asks about --- and from the random permutation of colors at each step, which prevents the verifier from building up a larger picture across multiple steps.