Prove Without Revealing
Zero-knowledge proofs let you prove something is true without revealing why. This demo shows how commit-reveal schemes prevent cheating in a simple game.
// why_this_matters
In this game, both players commit to their choice before seeing the other's. The commitment is a cryptographic hash that locks in your choice.
When we reveal, anyone can verify: the hash of (choice + nonce) must equal the original commitment. If it doesn't match, you cheated.
This is the foundation of zero-knowledge systems. You prove you made a valid choice without revealing it until the right moment.
// real_world_applications
- >Medical data: Prove you don't carry a genetic mutation without revealing your genome
- >Age verification: Prove you're over 21 without revealing your birthdate
- >Credential checks: Prove you have a valid license without exposing your identity
- >Voting systems: Prove you voted validly without revealing your vote
Want to understand why identity-by-default is a problem and how ZKPs fix it?
Read: Identity by Default→This demo uses SHA-256 for commitments. Production ZKP systems like zk-SNARKs and zk-STARKs offer more powerful proofs with mathematical guarantees.