The Three Rules
A conversation can be convincing and still not count as a real zero-knowledge proof. For it to count, cryptographers want it to satisfy three rules. Miss any one of them and what you've built isn't a proper ZKP, however clever it looks.
The rules themselves are easy enough to say out loud. We'll go through each one in plain language and then connect it back to the Ali Baba Cave, a story where Peggy shows she knows a magic password without ever saying the word.
Rule 1 — Completeness
Honest people always pass.
If Peggy really does know the secret, and both of them play by the rules, then Victor should come away convinced every single time. No bad luck, no random misfires. When the prover is honest, the proof just works.
In the cave, Peggy knows the password that opens the magic door between the two tunnel branches. Victor shouts out a side at random, and Peggy always walks out from the side he asked for, because whenever she needs the door, she can open it. An honest Peggy never lets an honest Victor down.
The question completeness is really asking is whether the protocol is any use to the people who actually know the secret. If honest Peggy could still fail, then it's failing exactly the people it was built for.
Rule 2 — Soundness
Cheaters get caught, as long as you check enough times.
If Peggy doesn't know the secret, she shouldn't be able to keep fooling Victor. She might slip through once on luck, but running the protocol again and again makes getting caught nearly certain.
In the cave, a cheating Peggy who doesn't know the password can't open the door. She has to commit to one branch at the start and then she's stuck down there. Victor calls a side at random, so there's a 50% chance he names the branch she isn't on, and she's caught. A single round isn't enough to be sure of anything, but the chance a cheater keeps surviving drops off quickly once you stack up a few rounds:
| Rounds | Chance a cheater is not caught yet | Victor's confidence |
|---|---|---|
| 1 | 50% | 50% |
| 5 | about 3% | about 97% |
| 10 | about 0.1% | about 99.9% |
| 20 | tiny | almost certain |
Soundness is asking whether a liar can just talk their way through forever. Without the secret, they shouldn't be able to.
Rule 3 — Zero-Knowledge
The verifier learns nothing except that the claim is probably true.
This is the rule that gives the whole field its name. Once Victor has watched a proof go through, he shouldn't have picked up anything that helps him work out the secret for himself. He believes Peggy knows it, but he's no closer to knowing it.
In the cave, Victor watches Peggy go in, hears himself call "Side A" or "Side B," and sees her come back out from the right side. Does that help him guess the password at all? It doesn't. Victor could have made up the exact same scene on his own: pick a side, picture Peggy stepping out from it, jot it down. Since he could fake something that looks just like a real run, the real run can't have told him anything new about the password.
The question here is whether checking the proof leaked the secret. If Victor walked away having learned something useful about it, the protocol fails this rule, even if Peggy passed every check along the way.
| Rule | One-line version | Protects against… |
|---|---|---|
| Completeness | Honest provers always convince. | Useless proofs that fail the people who tell the truth |
| Soundness | Liars are caught with enough rounds. | Fakers who do not actually know the secret |
| Zero-knowledge | Checking reveals nothing about the secret. | Leaking the secret while trying to prove it |
All Three Together
A real zero-knowledge proof has to pull off all three at once. It helps to see what happens when one of them is missing:
- Plenty of completeness but weak soundness, and honest people pass fine, except so do the liars. The whole thing is useless.
- Plenty of soundness but weak zero-knowledge, and Victor catches every cheater, but he also walks away knowing the secret. That's not zero-knowledge anymore.
- Plenty of zero-knowledge but weak completeness, and the secret stays safe, except honest Peggy keeps failing for no good reason. Broken.
The demos on this site let you watch all three rules play out for yourself. The Ali Baba Cave is the gentlest place to start. No math, just a story and a button to click.