✅ Master ZK Circuit Design

Understand circuits, constraints, and proof generation for ZK rollups

Build zero-knowledge circuits for rollups

Key Takeaways

You've learned how ZK-Rollup circuits enable scalable blockchain computation through cryptographic proofs. Let's review the key concepts before testing your knowledge.

🔢 Circuit Fundamentals

ZK circuits are arithmetic circuits operating over finite fields (BN254), composed of addition and multiplication gates. Unlike boolean circuits, they work with field elements and algebraic constraints.

  • Multiplication gates are expensive—they create constraints
  • Addition gates are cheap—multiple can be combined linearly
  • Circuit size determines proving time (fewer gates = faster proofs)

📐 Constraint Systems

Three major constraint systems power modern ZK-Rollups, each with different tradeoffs:

  • R1CS/Groth16: Smallest proofs (128-192 bytes), trusted setup, 280k gas verification
  • PLONK: Universal setup, custom gates, larger proofs (384-512 bytes), 300k gas
  • STARKs/AIR: Transparent (no trusted setup), post-quantum, large proofs (45-200 KB), 5M gas

⚡ Proof Generation

Four-stage pipeline converts transactions into verifiable proofs:

  • Witness Generation: Execute circuit with private inputs to compute wire values
  • Polynomial Commitment: Commit to witness polynomial cryptographically
  • Proof Construction: Generate proof using FFTs and elliptic curve operations
  • Verification: Constant-time verification on L1 (~300k gas regardless of batch size)

📊 Performance Optimizations

Modern provers achieve 1000+ TPS through specialized hardware and algorithms:

  • GPU/FPGA acceleration for FFTs and Multi-Scalar Multiplication (70% of proving time)
  • Recursive proofs: aggregate multiple batches into one proof
  • Batching strategy: larger batches = lower cost per tx (300k gas ÷ batch size)

🚀 Real-World Impact

Production ZK-Rollups process millions of transactions daily:

  • zkSync Era: Plonk circuits, 2000+ TPS, $2B+ TVL
  • StarkNet: STARK proofs, Cairo language, post-quantum security
  • Polygon zkEVM: EVM equivalence, Plonk/FFlonk, Groth16 final proof
  • Cost reduction: From 21k gas per tx on L1 → 300-600 gas on L2 (35-70x cheaper)