+TITLE: Zero Knowledge Proofs
| file | Description |
|---|---|
| Pre-Course | Course Prep |
| Lecture 1 | Notes: lecture 1 |
| Homework 1 | Homework 1 |
| Lecture 2 | Notes: lecture 2 |
| Homework 2 | Homework 2 (group theory, binary operators) |
| Lecture 3 | Notes: lecture 3 |
| Homework 3 | Homework 3 (EC point addition) |
| Lecture 4 | Notes from lecture 4 |
| Homework 4 | Homework 4 (ECDSA) |
| Lecture 5 | Notes: lecture 5 |
| Homework 5 | Homework 4 (EC calculations in Solidity) |
| Lecture 6 | Notes: lecture 6 |
| Homework 6 | Homework 6 (Pairings in Solidity) |
| Lecture 7 | Notes: lecture 7 |
| Homework 7 | Hw 7 (Arithmetic Circuits) |
| Lecture 8 | Notes: lecture 8 |
| Homework 8 | Homework 8 (R1CS) |
| Lecture 9 | Lecture 9 (QAP) |
| Homework 9 | HW9 (Lagrange interpolation, Schwartz-Zippel Lemma) |
| Lecture 10 | Notes: lecture 10 |
| Homework 10 | HW10 (R1CS to QAP) |
| Lecture 11 | Notes: lecture 10 |
| Homework 11 | HW11: Proving the QAP using EC points |
| Lecture 12 | Pinocchio and trusted setup |
| Homework 12 | Homework 12 |
| Homework 13 | Homework 13 |
The construction proceeds in 5 stages, each building on the last.
Stage 1: Arithmetic Circuits (lecture 7, homework 7)
The starting point is encoding a computational statement as an arithmetic circuit – a DAG of addition and multiplication gates over a finite field. The homework problems demonstrate this for graph coloring, subset sum, covering set, max, and power-of-two checks. The key insight: any computation can be “flattened” into constraints of the form
Stage 2: R1CS – Rank-1 Constraint System (lecture 8, homework 8)
Each multiplication gate becomes one row of three matrices
where
Stage 3: QAP – Quadratic Arithmetic Program (lectures 9-10, homeworks 9-10)
The R1CS matrices are converted to polynomials via Lagrange interpolation. Each column of
The R1CS identity
The prover computes
Stage 4: Trusted Setup + Elliptic Curve Commitments (lecture 11, homework 11)
The verifier shouldn’t reveal
A trusted party generates a Structured Reference String (SRS):
-
$\text{SRS}_1 = [τ^0 G_1, τ^1 G_1, τ^2 G_1, \ldots]$ for$l, o$ commitments -
$\text{SRS}_2 = [τ^0 G_2, τ^1 G_2, \ldots]$ for$r$ commitment -
$\text{SRS}_3 = [T(τ)τ^0 G_1, T(τ)τ^1 G_1, \ldots]$ for$h ⋅ T$ commitment
Then
Stage 5: Verification via Pairings (lecture 6, homework 6, homework 11)
The verifier checks the QAP identity in the exponent using bilinear pairings:
This works because $e(aG_1, bG_2) = gab$ where
Everything above gives a SNARK (Succinct Non-interactive Argument of Knowledge) but it is not yet zero-knowledge. The verifier learns the EC point commitments
The Pinocchio protocol / Groth16 approach adds ZK in layers:
The trusted setup includes random
The witness is split into public inputs and private inputs. Random
This is where actual zero-knowledge enters. The prover samples fresh random scalars
The cross-terms cancel in the pairing check, so verification still works. But now each proof is randomized – even for the same witness, every proof looks different. This makes the proof a perfect zero-knowledge simulator: given only the public inputs, one could generate indistinguishable “fake” proofs (with knowledge of
In short: the SNARK gives succinctness and soundness;