← Back

Zero-Knowledge Proofs

Ali Baba's Cave - Proving you know a secret without revealing it

Ali Baba's Cave Protocol

Peggy wants to prove she knows the magic word to open the door between paths A and B.
0
Successful Proofs
0
Total Rounds
Probability Peggy is lying: 100%

After n successful rounds: (1/2)^n

How The Cave Protocol Works

  1. 1. Peggy enters the cave and randomly chooses path A or B
  2. 2. Victor waits outside (doesn't see which path Peggy took)
  3. 3. Victor randomly shouts "Come out from path A!" or "Come out from path B!"
  4. 4. If Peggy knows the magic word, she can always exit from the requested path
  5. 5. If Peggy doesn't know the word, she has only 50% chance of being on the correct side

After 10 successful rounds, the probability that Peggy is lying drops to about 0.1%. After 20 rounds, it's less than 0.0001%. Victor becomes convinced Peggy knows the secret, but learns nothing about what the secret actually is!

Zero-Knowledge Proof Properties

Completeness: If the statement is true, an honest prover can convince the verifier.

Soundness: If the statement is false, no cheating prover can convince the verifier (except with tiny probability).

Zero-Knowledge: The verifier learns nothing beyond the fact that the statement is true.

ZK proofs are used in blockchain (Zcash), authentication systems, and privacy-preserving credentials.