Path: blob/main/frontier/10-snarks-starks/connect/groth16-zcash.ipynb
483 views
Connect: Groth16 in Zcash Shielded Transactions
Module 10 | Real-World Connections
Every Zcash shielded transaction uses a Groth16 proof to verify validity without revealing sender, receiver, or amount.
Introduction
Zcash is a cryptocurrency that supports shielded transactions: transfers where the sender, receiver, and amount are all hidden from the public blockchain. The blockchain still needs to verify that transactions are valid (no double-spending, no money creation).
How? Every shielded transaction includes a Groth16 proof that the transaction is valid, without revealing any private details.
| Bitcoin | Zcash (shielded) |
|---|---|
| Sender visible | Sender hidden |
| Receiver visible | Receiver hidden |
| Amount visible | Amount hidden |
| Verified by inspecting values | Verified by Groth16 proof |
| Transaction ~250 bytes | Transaction ~2 KB (includes 192-byte proof) |
The Statement Being Proved
Each shielded spend proves (in zero knowledge) the conjunction of:
Spend authority: "I know the spending key for this note"
Note existence: "The note I'm spending exists in the commitment tree" (Merkle path)
Nullifier correctness: "I computed the nullifier correctly" (prevents double-spending)
Value balance: "Input values = output values + fee" (no money created)
The circuit encoding all of this has roughly 100,000 R1CS constraints (Sapling). Yet the proof is only 192 bytes and verification takes ~5 ms.
Let's build a toy analogy that captures the core structure.
The Zcash Trusted Setup
Zcash has conducted two major trusted setup ceremonies:
| Ceremony | Year | Participants | Circuit |
|---|---|---|---|
| Sprout | 2016 | 6 participants | ~2,000 constraints |
| Sapling (Powers of Tau) | 2018 | 87 participants (phase 1) + hundreds (phase 2) | ~100,000 constraints |
The Sapling ceremony was split into two phases:
Phase 1 (Powers of Tau): circuit-independent, reusable for any Groth16 circuit
Phase 2: circuit-specific, tied to the Sapling circuit
Security guarantee: as long as any one participant in the ceremony destroyed their share of the toxic waste, no one can forge proofs.
Concept Map: Module 10 Concepts in Zcash
| Module 10 Concept | Zcash Application |
|---|---|
| Arithmetic circuit | The Sapling circuit: Pedersen hashes, Merkle paths, range checks |
| R1CS constraints | ~100,000 constraints encoding spend validity |
| QAP polynomial encoding | Circuit compiled to polynomials for the Groth16 prover |
| Trusted setup (CRS) | Powers of Tau + circuit-specific phase 2 ceremony |
| Toxic waste | destroyed after ceremony |
| Proof elements () | 3 BLS12-381 curve points = 192 bytes |
| Pairing check | |
| Zero-knowledge | Sender, receiver, and amount are hidden |
| Soundness | No double-spending, no money creation |
What's Next
Zcash is evolving beyond Groth16:
Orchard (2022): uses Halo 2 (recursive, no trusted setup)
The Zcash community is moving toward transparent proof systems
This mirrors the broader industry trend from trusted-setup SNARKs toward transparent systems (STARKs, Halo, Plonk with FRI).
Summary
| Concept | Key idea |
|---|---|
| Sapling circuit | Encodes transaction validity as ~100,000 R1CS constraints |
| QAP encoding | The circuit is compiled to polynomials and evaluated at the secret tau from the ceremony |
| Groth16 proof | 192 bytes (3 BLS12-381 curve points), constant regardless of circuit size |
| Verification | Every full node checks 3 pairing equations in ~5 ms |
| Trusted setup | Multi-party ceremony with hundreds of participants, secure if even one is honest |
| Zero-knowledge | Sender, receiver, and amount are all hidden from the blockchain |
Every concept from this module (arithmetic circuits, R1CS, QAP, pairings, trusted setup) is load-bearing in Zcash. None of it was abstract for its own sake.
Back to Module 10: SNARKs and STARKs