b2KIT

Zero-Knowledge Proof Demo

Interactive demonstration of zero-knowledge proofs. Prove you know a secret without revealing it using graph coloring and cave analogy.

Tested tool guide Tested browser tools Checked August 16, 2026

What Zero-Knowledge Proof Demo does, with a checked example

A zero-knowledge proof lets one party convince another that a statement is true - "I know a valid 3-coloring of this graph" - while revealing nothing that would let the verifier re-prove it. This tool makes the idea concrete with the two classic demonstrations: the Ali Baba cave, where the prover survives a path challenge only by knowing a secret word, and graph coloring, where the prover commits to a randomized coloring and the verifier inspects one edge per round. The surprise most users hit: one round proves nothing, because passing it can be luck; only many rounds give real evidence.

Worked example

A concrete input and expected output from the current implementation.

Input

Run the cave demo for 10 rounds, with the prover claiming to know the secret word.

Expected output

All 10 rounds pass and the verifier accepts. The confidence is on the impostor side: a prover without the word survives one round only by guessing which exit the verifier will demand (probability 1/2), so surviving all 10 has probability (1/2)^10 = 1/1024, under 0.1%.

An honest prover always complies, because the door is the only crossing in the cave, so the transcript is 10/10 deterministically. What makes the verdict strong is repetition: each round halves an impostor's survival odds.

How the result is produced

1

The cave walk

The cave is a loop with a locked door. The prover walks in, picks a branch, and the verifier shouts which branch to come back through; only a prover holding the word can always comply, because the door is the only way across. An impostor complies only when their guess matches, probability 1/2 per round, so the demo's repeated rounds turn a coin flip into near-certain detection.

2

Edge-by-edge graph coloring

The prover claims a graph is 3-colorable and proves it one edge at a time. Each round they re-color with a fresh random permutation of the three colors and commit, then the verifier names one edge and the prover opens exactly those two commitments. Adjacent endpoints must differ; an invalid coloring leaves at least one bad edge, so a cheater is caught with probability at least 1/E per round.

Good uses

  • Learning the fundamentals before approaching real systems such as zk-SNARKs or anonymous credentials, where proving a statement without revealing a witness is the core trick this demo makes visible.
  • Presenting zero-knowledge to a non-technical audience - management, clients, students - where a live cave walk and color checks land better than any equations.
  • Probing soundness by cheating on purpose: enter an invalid graph coloring or bluff at the cave, watch which rounds get caught, and raise the round count to see the impostor's survival odds collapse.

Limits and checks

  • It is a simulation, not cryptography: the commitments are visual props rather than cryptographically binding ones, so nothing here is strong enough to authenticate anyone in a real system.
  • Short runs mislead: a few green rounds can be pure luck (probability 1/2 per cave round, 2/3 per queried triangle edge with guessed colors), so a short transcript is not evidence; the verdict only means something over many rounds.
  • Zero knowledge has boundaries: the verifier does learn that a valid coloring exists, and the interactive many-round form is not how deployed systems work - real proofs compress it to a single message via the Fiat-Shamir transform, which this demo does not model.

Common questions

Why does the demo run so many rounds? Is one successful round not enough?

No. In one round a cheater can pass on luck - probability 1/2 in the cave, 2/3 for a queried edge of a triangle with guessed colors. Each extra round multiplies those odds: after 10 cave rounds an impostor survives with probability 2^-10, about 0.1%. The verdict is statistical, and the round count is the dial that sets how sure the verifier is.

Can the verifier learn the secret by watching many rounds?

No, and that is what makes the proof zero-knowledge. In the graph demo the prover applies a fresh random color permutation every round, so the values the verifier sees are uniform random triples that cannot be stitched together into the real coloring; the cave demo never exposes the word at all. Victor learns only that a proof exists, not how to make one.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools