Path: blob/main/frontier/10-snarks-starks/sage/10f-starks-vs-snarks.ipynb
483 views
Notebook 10f: STARKs vs SNARKs
Module 10: SNARKs and STARKs
Motivating Question. We've now seen two ways to prove computation: Groth16 (trusted setup, pairings, constant-size proofs) and FRI (transparent, hash-based, larger proofs). Which is "better"? The answer depends on what you value: proof size, trust assumptions, quantum resistance, or prover speed. This notebook puts them side by side so you can reason about the trade-offs yourself.
Prerequisites. You should be comfortable with:
The SNARK pipeline: circuit → R1CS → QAP → Groth16 proof (Notebooks 10a–10d)
The FRI protocol: folding, Merkle commitments, proximity testing (Notebook 10e)
Learning objectives. By the end of this notebook you will be able to:
Contrast the SNARK and STARK pipelines step by step.
Quantify the trade-offs in proof size, verification cost, and prover time.
Understand the trust model difference and why it matters.
Evaluate which proof system fits different real-world scenarios.
Know where the field is heading (universal SNARKs, folding schemes).
1. Two Pipelines, One Goal
Bridge from Notebook 10e. We've built both pipelines from the ground up. Now let's put them side by side.
Both SNARKs and STARKs prove the same thing: "I know a witness such that " where is an arithmetic circuit. The difference is how they prove it.
2. Trust Model: The Fundamental Divide
The deepest difference between SNARKs and STARKs is the trust model.
| Aspect | SNARK (Groth16) | STARK |
|---|---|---|
| Setup | Trusted, toxic waste must be destroyed | Transparent, no secrets at all |
| What if setup is compromised? | Attacker can forge proofs for ANY statement | N/A, there is no setup |
| Mitigation | MPC ceremony (many participants) | Not needed |
| Setup scope | Per-circuit, new circuit needs new ceremony | N/A |
| Cryptographic assumption | Pairing-based (knowledge of exponent) | Collision-resistant hash function |
Checkpoint 1. The trust model difference is not just theoretical. Zcash held a real ceremony with 6 participants in 2016 (Sprout) and a much larger one with 87 participants for Sapling. If all participants colluded or were compromised, they could mint fake ZEC. STARKs avoid this risk entirely, but at the cost of larger proofs.
3. Proof Size: Constant vs Polylogarithmic
This is where Groth16 shines, the proof is always 192 bytes, regardless of circuit size. STARK proofs grow logarithmically.
Misconception alert. "STARK proofs are huge." In absolute terms, a ~100 KB proof is still tiny compared to the computation being proved (which might involve millions of operations). The real question is whether the proof fits cheaply on-chain, and here Groth16's 192 bytes is hard to beat.
4. Verification Time
Groth16 verification is dominated by 3 pairing computations, constant regardless of circuit size. STARK verification involves checking Merkle paths, which grows logarithmically.
5. Prover Time: Where STARKs Win
While STARKs lose on proof size, they can win on prover time, especially for large circuits. The key reason: STARK arithmetic uses smaller fields (e.g., 64-bit Goldilocks vs 381-bit BLS12-381) and doesn't need expensive elliptic curve operations.
Checkpoint 2. The prover cost trade-off is subtle. Groth16 has fewer operations but each one involves 381-bit elliptic curve arithmetic. STARKs have more operations but use 64-bit field arithmetic and hashing. For circuits with > gates, STARKs often prove faster in wall-clock time.
6. Quantum Resistance
This is a critical forward-looking concern:
| System | Broken by quantum computer? | Why? |
|---|---|---|
| Groth16 | Yes | Relies on discrete log and pairing assumptions, broken by Shor's algorithm |
| STARKs | No | Relies only on collision-resistant hash functions, resistant to known quantum attacks |
A sufficiently powerful quantum computer could:
Recover the discrete log, breaking the CRS
Forge Groth16 proofs at will
STARKs remain secure because:
Grover's algorithm only gives a quadratic speedup for hash collision finding
Doubling the hash output size restores security (e.g., SHA-256 → 128-bit post-quantum security)
7. The Full Comparison
Here's the comprehensive side-by-side comparison:
8. Real-World Deployments
Let's look at who uses what and why.
Checkpoint 3. The "STARK proves, SNARK verifies" hybrid is increasingly popular. The prover gets STARK's fast proving and transparency, while the on-chain verifier gets SNARK's compact proofs. This is sometimes called a "STARK-to-SNARK wrapper" or "proof composition."
9. Beyond Groth16: Universal SNARKs
Groth16's per-circuit trusted setup is a major limitation. Universal SNARKs like PLONK and Marlin need only a single setup ceremony that works for any circuit up to a given size.
| Property | Groth16 | PLONK | Marlin | STARK |
|---|---|---|---|---|
| Setup | Per-circuit | Universal | Universal | None |
| Proof size | 192 B | ~400 B | ~800 B | ~100 KB |
| Verification | 3 pairings | ~10 pairings | ~10 pairings | Hash-based |
| Prover | MSM | FFT + MSM | FFT + MSM | FFT + Hash |
| Quantum safe | No | No | No | Yes |
10. The Frontier: Where the Field is Heading
The SNARK/STARK divide is narrowing. Key trends:
Folding schemes (Nova, Supernova, HyperNova):
Incrementally verify computation without full proof at each step
Very efficient for iterative/recursive computations
Can work with both SNARK and STARK backends
Lookup arguments (Plookup, LogUp):
Dramatically reduce constraint count for operations like range checks, hash functions
Used in both PLONK-based SNARKs and STARKs
Circle STARKs (Stwo):
Use the circle group instead of multiplicative subgroups
Work over Mersenne primes (M31 = ) for ultra-fast arithmetic
Even faster proving with comparable proof sizes
Proof aggregation and recursion:
Combine many proofs into one
STARK → SNARK wrappers for on-chain efficiency
Recursive verification enables constant-size blockchain (Mina)
Crypto foreshadowing. Module 11 (Homomorphic Encryption) and Module 12 (MPC) explore the other pillars of advanced cryptography. Together with ZK proofs, these form the foundation of programmable privacy: systems where computation is verifiable, encrypted, and distributed.
11. Exercises
Exercise 1 (Worked): Compute Verification Cost
Problem. For a circuit with gates, compute the approximate number of verification operations for both Groth16 and STARKs. Which is faster?
Solution:
Exercise 2 (Guided): Proof Size Break-Even
Problem. At what circuit size does a STARK proof exceed 1 MB? How does this compare to the Groth16 proof at the same circuit size?
Fill in the TODOs:
Exercise 3 (Independent): Design a Proof System
Problem. You're building a ZK application. For each scenario, argue which proof system you'd choose and why:
A privacy coin where every transaction needs an on-chain proof and gas costs matter.
A government voting system that must remain secure against future quantum computers.
A ZK-rollup processing 10,000 transactions per batch where proving speed is the bottleneck.
A recursive blockchain (like Mina) where each block verifies the previous block's proof.
For each, state your choice (Groth16 / PLONK / STARK / hybrid) and justify it with specific metrics from this notebook.
Summary
| Dimension | SNARK (Groth16) | STARK |
|---|---|---|
| Best at | Smallest proofs, fastest verification | No trust, quantum resistance, fast proving |
| Worst at | Trusted setup, quantum vulnerability | Large proofs, on-chain cost |
| Ideal for | On-chain verification, recursion | Computation integrity, long-term security |
| Real use | Zcash, Filecoin, Mina | StarkNet, RISC Zero |
| Hybrid | \multicolumn{2}{c}{STARK prove + SNARK verify (zkSync)} |
Key takeaways:
There is no single "best" proof system, the right choice depends on your constraints.
The field is converging: universal SNARKs, STARK-SNARK hybrids, and folding schemes are blurring the lines.
Quantum resistance will become increasingly important as quantum computers mature.
Both SNARKs and STARKs rest on the same foundation: encoding computation as polynomial equations and proving those equations hold.
This completes Module 10. You've gone from arithmetic circuits all the way to understanding the two major families of zero-knowledge proofs.
Next module: Module 11: Homomorphic Encryption