Skip to content

Zero-Knowledge Proofs

A zero-knowledge proof lets one party (the prover) convince another party (the verifier) that a statement is true, without revealing any information beyond the fact that it's true. This chapter gives an introductory, intuition-first treatment, enough to understand why ZK rollups and privacy-preserving protocols use this primitive, and where to go for the full mathematical depth this book does not cover in detail.

The problem

Consider proving you know the private key corresponding to a public key, without revealing the private key itself. This is, in fact, exactly what a digital signature already accomplishes, and it is, at its core, a specific and limited kind of zero-knowledge proof (proving knowledge of a discrete logarithm, without revealing it). But the general question goes further: can you prove any computational statement ("I ran this program on some secret input and it produced this specific, publicly known output") without revealing the secret input, and without the verifier needing to redo the computation themselves to check it?

This generalized version is what modern zero-knowledge proof systems (zk-SNARKs, zk-STARKs, and related constructions) provide, and it underlies two very different use cases covered elsewhere in this book: privacy (proving a transaction is valid without revealing its amount or parties) and scaling (proving a batch of thousands of transactions was processed correctly, letting a verifier check one small proof instead of re-executing every transaction, see Validity Proofs).

The three required properties

A valid zero-knowledge proof system must satisfy:

  • Completeness: if the statement is actually true, an honest prover can always convince an honest verifier.
  • Soundness: if the statement is false, no dishonest prover (no matter how much computational power or cleverness they have) can convince the verifier it's true, except with negligible probability.
  • Zero-knowledge: the verifier learns nothing beyond the fact that the statement is true, not the secret input, not any intermediate values, nothing that would help them derive the secret.

Building intuition: the cave analogy

The classic, widely used illustration (known as "Ali Baba's Cave," from a 1989 paper by Jean-Jacques Quisquater and colleagues) describes a circular cave with a single entrance and a locked door blocking a passage between its two forks, opened only with a secret password. Peggy (the prover) wants to convince Victor (the verifier) she knows the password, without revealing it.

Victor waits outside while Peggy walks into the cave and randomly picks one of the two fork paths. Victor then walks to the entrance and shouts which fork he wants Peggy to emerge from. If Peggy genuinely knows the password, she can always comply, walking through the locked door if she happens to be on the wrong side. If she does not know the password, she can only comply if she happened to guess correctly which side Victor would call, a 50% chance per round. Repeating this many times, each round independently having a 50% chance of "catching" a bluffing Peggy, drives the probability of a dishonest Peggy succeeding every single round down toward zero (after 20 rounds, roughly one in a million), while Victor learns nothing about the actual password at any point, only that Peggy consistently demonstrates the ability to open the door.

This captures the shape of an interactive zero-knowledge proof: repeated rounds of challenge and response, each ruling out a dishonest prover with some probability, converging toward overwhelming confidence without ever revealing the secret.

From interactive to non-interactive

The cave analogy requires back-and-forth interaction between prover and verifier. Real blockchain applications generally need non-interactive proofs, a single, self-contained proof a prover can generate once and broadcast, which any number of verifiers can check independently without any live back-and-forth. This is what the "NI" in constructions like zk-SNARK stands for: Zero-Knowledge Succinct Non-Interactive Argument of Knowledge. Converting an interactive proof into a non-interactive one generally relies on cryptographic techniques (the Fiat-Shamir heuristic being the most common) that replace the verifier's random challenges with values derived from hashing the prover's own messages, similar in spirit to how Schnorr signatures derive their challenge from a hash rather than requiring a live interactive exchange.

SNARKs versus STARKs, at a glance

This book does not cover the underlying mathematics of these constructions in depth, that would require a dedicated treatment of polynomial commitments, elliptic curve pairings, and error-correcting codes well beyond this introductory chapter's scope. The high-level distinction worth knowing, since both terms appear throughout Layer 2:

  • zk-SNARKs produce very small, cheap-to-verify proofs, but most constructions require a trusted setup, a one-time ceremony generating certain public parameters, where anyone retaining "toxic waste" from that ceremony could potentially forge false proofs, and most practical implementations also rely on elliptic curve cryptography, which is not believed to be secure against a sufficiently powerful quantum computer.
  • zk-STARKs avoid any trusted setup entirely and are believed to be quantum-resistant (relying on hash functions rather than elliptic curves for their core security), at the cost of larger proof sizes than SNARKs typically produce.

Both are used in production blockchain systems today, see zkSync and Starknet for specific implementations and their design choices.

Tradeoffs

Zero-knowledge proofs let a verifier gain confidence in a computation's correctness (or a statement's truth) without redoing the computation or learning the underlying secret data, which is genuinely powerful for both privacy and scaling. The cost is proof generation complexity: producing a zero-knowledge proof is typically far more computationally expensive than the underlying computation itself (often by several orders of magnitude), even though verifying the resulting proof is cheap. This asymmetry is deliberate and useful (you generate a proof once, and many parties can cheaply verify it many times), but it means zero-knowledge systems shift real, sometimes substantial computational cost onto whoever generates the proofs (in a ZK rollup's case, the sequencer) rather than eliminating that cost.

Common misconceptions

"Zero-knowledge" does not mean "no information is transmitted." A proof itself is data that gets transmitted and verified; the "zero-knowledge" property specifically means no information about the secret input leaks, not that the proof is informationless.

Zero-knowledge proofs are not the same thing as encryption or as blockchain-specific technology. The underlying cryptographic theory predates blockchain by decades (the foundational papers, including work by Shafi Goldwasser, Silvio Micali, and Charles Rackoff, date to 1985) and has applications well beyond cryptocurrency, including in traditional identity verification and secure computation research.

Further reading


← Previous: Commitments · Back to Cryptography · Next: Distributed Systems Basics →