Modern Cryptography Part 2: Zero-Knowledge Proofs and Privacy

cryptography zero-knowledge-proofs zk-snarks privacy blockchain

Proving Without Revealing

Prove you know a password without revealing it. Prove you’re over 21 without showing your birthdate. Verify a computation without re-running it.

This is Zero-Knowledge Proofs (ZKPs) - one of modern cryptography’s most profound innovations.

Part 2 of a 3-part series from encryption fundamentals to cutting-edge applications.


What Are Zero-Knowledge Proofs?

A ZKP lets a prover convince a verifier that a statement is true without revealing any information beyond the statement’s validity.

The three properties:

  1. Completeness: If true, honest prover convinces honest verifier
  2. Soundness: If false, cheating prover can’t convince verifier (except negligibly)
  3. Zero-Knowledge: Verifier learns nothing except statement validity

The Ali Baba Cave

Classic example: A circular cave with two paths meeting at a magic door that opens with a secret word.

Protocol: Prover enters, randomly chooses left or right path → Verifier (outside) shouts “left!” or “right!” → Prover must appear from requested path (using magic door if needed) → Repeat 20+ times

Result: With secret (100% success rate) • Without secret ((1/2)^20 = 0.0001% success rate) • Verifier never sees the secret used

Non-Interactive ZKPs: Single message proof via Fiat-Shamir heuristic (replace verifier’s challenges with hash function output) enables blockchain applications where anyone can verify anytime.


ZK-SNARKs vs ZK-STARKs

SNARKs: Succinct Non-Interactive Arguments of Knowledge

Strengths: Tiny proofs (~200 bytes) • Fast verification (~10ms) • Battle-tested (Zcash, Filecoin)

Weaknesses: Requires trusted setup (“toxic waste” risk) • Quantum-vulnerable (elliptic curve pairings)

Systems: Groth16 (smallest proofs, most deployed) • PLONK (universal setup) • Halo 2 (no trusted setup)

STARKs: Scalable Transparent Arguments of Knowledge

Strengths: No trusted setup (transparent) • Post-quantum secure (hash-based) • Better scalability

Weaknesses: Large proofs (100-200 KB vs 200 bytes) • Less mature ecosystem

Comparison

FeatureSNARKsSTARKs
Proof Size~200 bytes~100 KB
Verification~10ms~10-100ms
Trusted SetupYesNo
Post-QuantumNoYes
Best ForBlockchain txLarge computations

Real-World Applications

1. Private Transactions (Zcash)

Problem: Bitcoin transactions are traceable - full history public.

Solution: Zcash uses zk-SNARKs for shielded transactions.

Proven: Sufficient balance, no double-spend, valid transaction • Hidden: Sender, receiver, amount

2. Scalability Solutions (zk-Rollups)

Problem: Ethereum processes ~15 transactions/second.

Solution: zk-Rollups batch thousands of transactions off-chain, post single proof on-chain.

How: Layer 2 processes 1000s of transactions → Generates single zk-SNARK proving all valid → Posts proof + compressed data to Ethereum → Ethereum verifies in milliseconds

Results: 100-1000× throughput increase • 90%+ cost reduction • Inherits Ethereum security

Examples: StarkNet, zkSync, Polygon zkEVM

3. Privacy-Preserving Authentication

Traditional: Server asks for password, user reveals it (server breaches leak passwords)

Zero-knowledge: Server asks for proof of password knowledge, user generates ZKP (server never learns password)

Benefits: Server breaches don’t leak passwords • User can’t be phished • Replay attacks prevented

4. Selective Disclosure

Prove specific attributes without revealing everything:

  • Age: “I am over 21” (no birthdate, no exact age)
  • Credit: “Score > 700” (no exact score, no history)
  • Credentials: “I have medical degree” (no school, no date)

5. Verifiable Computation

Use case: Cloud computing on sensitive data

ZKP solution: Client provides encrypted data → Server runs computation, generates ZKP of correctness → Client verifies proof, extracts result

Benefits: Don’t trust server • Verify without re-running • Data stays encrypted

Implementations: zkVM (RISC Zero, Miden VM, Valida)


When to Use ZKPs

Good use cases: Privacy requirements (financial, medical, identity) • Scalability (batch verification cheaper) • Verifiable computation (outsourced processing) • Compliance (prove regulatory compliance without revealing data)

Not ideal: Simple authentication (traditional methods simpler) • No privacy requirements • Interactive protocols acceptable • Performance-critical (ZKPs computationally expensive)


Key Takeaways

ZKPs enable: Privacy without sacrificing verifiability • Scalability through batch verification • Selective disclosure of attributes • Verifiable computation on encrypted data

Tradeoffs: SNARKs (small proofs, trusted setup, quantum-vulnerable) • STARKs (transparent, post-quantum, larger proofs) • Both (computationally expensive to generate)

Applications: Private transactions (Zcash) • Blockchain scaling (zk-Rollups) • Secure authentication • Identity verification • Cloud computing verification


Resources

Learn: ZKP MOOCRareskills ZK BookZK Hack

Tools: Circom (zk-SNARK circuits) • Noir (Rust-like ZK language)


Series Navigation


Zero-knowledge proofs transform the fundamental tradeoff between privacy and verifiability. For the first time in history, we can prove things are true without revealing why. This unlocks private yet public blockchains, verifiable yet confidential computations, and selective disclosure of attributes.