Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
duyuefeng0708
GitHub Repository: duyuefeng0708/Cryptography-From-First-Principle
Path: blob/main/frontier/09-commitments-sigma-protocols/README.md
483 views
unlisted

Module 09: Commitment Schemes and Sigma Protocols

View on nbviewer

How to prove you know a secret without revealing it. This is the foundation of zero knowledge.

Prerequisites

Learning Objectives

After completing this module you will:

  1. Understand the hiding and binding properties of commitment schemes

  2. Implement Pedersen commitments and verify their homomorphic property

  3. Grasp the three move sigma protocol structure (commit, challenge, response)

  4. Implement the Schnorr identification protocol and the Fiat-Shamir transform to make it non-interactive

Explore (SageMath Notebooks)

Work through these notebooks in order:

#NotebookWhat You'll Learn
aCommitment SchemesWhat "commit then reveal" means, hiding vs binding tradeoffs
bPedersen CommitmentsBuilding perfectly hiding commitments from discrete log, homomorphic addition
cSigma Protocols: IntuitionThe three move pattern and why it achieves zero knowledge
dSchnorr ProtocolInteractive proof of knowledge of a discrete log
eFiat-Shamir TransformReplacing the verifier with a hash to get non-interactive proofs

Implement (Rust)

Build these from scratch in rust/src/lib.rs:

#FunctionDescription
1pedersen_commitCommit to a value with a blinding factor using two generators
2pedersen_verifyVerify that a commitment opens to the claimed value and blinding factor
3schnorr_proveGenerate a Schnorr proof of knowledge of a discrete log
4schnorr_verifyVerify a Schnorr proof against a public key
5fiat_shamirDerive a non-interactive challenge by hashing the transcript

Run: cargo test -p commitments-sigma

Break

Try these attacks in the break/ folder:

  • Break Schnorr with bad randomness (nonce reuse). Extract the secret key when the prover reuses a nonce across two protocol runs.

  • Forge commitment with wrong binding. Demonstrate that a computationally unbounded adversary can open a Pedersen commitment two ways.

Connect

See where this shows up in practice (in the connect/ folder):

  • Schnorr signatures in Bitcoin Taproot. BIP 340 uses Schnorr signatures for simpler multisig and privacy preserving script spending.

  • Commitments as building blocks for ZK proofs. Pedersen commitments appear inside Bulletproofs, Groth16 inputs, and polynomial commitment schemes.


Next: Module 10: SNARKs and STARKs