How does the two-coloured-balls (interactive ZK) example work, and why does repetition matter?
Alice is colour-blind and doesn't trust Bob's claim he can see colour. She uses two visually identical balls — one red, one blue — and an interactive game where she challenges Bob to consistently identify when she's swapped them or not.
The protocol:
- Alice holds a red ball in one hand, blue in the other (visually identical to her).
- She shows Bob both, then puts her hands behind her back.
- She either swaps the balls between hands or doesn't — Alice's secret choice, hidden from Bob.
- She brings her hands back out and asks Bob: "Did I swap or not?"
- Bob answers.
The reasoning:
- If Bob can see colour, he always answers correctly (because he sees which colour is in which hand).
- If Bob is lying (can't see colour), he must guess with 50/50 chance — gets it right half the time on average.
Why repetition is necessary: one correct answer proves nothing — Bob could have guessed. After n rounds, the chance Bob guessed every one correctly without actually seeing colour is 1/2ⁿ.
| Rounds | Chance of a liar passing |
|---|---|
| 1 | 50% |
| 10 | ≈ 0.1% (1 in 1024) |
| 20 | ≈ 1 in 1,000,000 |
| 30 | ≈ 1 in 1,000,000,000 |
After ~20-30 rounds, Alice is convinced beyond reasonable doubt.
Why this is "zero-knowledge": Alice never learns anything about how Bob distinguishes colours. She only learns the fact "Bob can distinguish them."
Important phrasing:
"Zero-Knowledge-Beweise basieren auf statistischen Garantien dafür, dass Alice nichts lernt."
ZK proofs are statistical, not absolute. With enough rounds the probability of error becomes negligible.
Tip: This is the template for almost every interactive ZK protocol — the prover commits, the verifier challenges, the prover reveals consistently if and only if they know the secret, and repetition drives the cheating probability to zero exponentially.