leonardoaguiar.com

Zero-Knowledge Lab

Prove it without showing it.

Zero-knowledge proofs, played by you and computed for real in your browser. Shout which side of the cave Peggy must come out of and watch a bluffer's chances halve; prove you coloured a graph without showing the colours; lock values in hash boxes, flip a coin over the phone with someone you do not trust, sign with Schnorr and pull a secret out of a reused nonce. Then build the real thing: a circuit, its constraint matrices, the polynomial they become, a pairing, a setup ceremony, and a Groth16 zk-SNARK proved and verified on this page, including the forgery that only the toxic waste allows. Proofs of age, a private coin and a rollup, run end to end.

  • Web
  • Free
  • Private
  • 9 areas, from a cave to a zk-SNARK
  • 36 live experiments, each with the code it runs
  • 54 challenges that light up as you go
  • 0 bytes sent to a server

Nine steps from a story about a cave to a proof of 99 bytes, with real cryptography under every one.

Every hash, curve point, commitment and proof on the page is computed in your browser with the same equations the real systems use: SHA-256 round by round, Schnorr on a 254-bit curve, Merkle trees, Pedersen commitments, a pairing, KZG and Groth16 with its setup ceremony. The stories at the start are illustrations and say so; from the commitments on, the numbers are real. In most experiments you are the verifier, choosing the challenges; in some you are the prover, with a secret to keep. A transcript shows what crossed the wire, and a tag on every screen says how far to trust it.

The idea

Ali Baba's cave as a game you play as the verifier, with the chance of a lucky bluffer halving each round. Find Waldo and prove it with a board that shows only him. Tell a colour-blind Victor whether he swapped two balls. Then the three promises every proof keeps, with a game you cannot win: telling a real transcript from a simulated one.

Colouring

Colour a graph with three colours, then run the 1986 protocol that proved every puzzle has a zero-knowledge proof: commitments on every node, one edge of your choice opened, the colours renamed each round. Catch a cheater on the edge she botched, watch a simulator forge a passing round with no colouring at all, and do the same with a Sudoku.

Commitments

SHA-256 as 256 squares, half of them flipping when one input bit does, round by round. A coin flipped over the phone with a hash box that cannot be reopened to the other call. A Merkle proof verified hash by hash, and a root that changes when one note does. Pedersen commitments on the curve that add: two hidden amounts, one commitment to their sum.

Sigma protocols

Schnorr's three messages in a group of eleven elements you can count, then on a real curve with 254-bit numbers. Fiat-Shamir turns the challenge into a hash and the protocol into a signature; change one letter of the message and it fails. The extractor that pulls the secret out of two answers with one nonce, as happened to the PlayStation 3, and the simulator that proves no secret leaked.

Circuits

x³ + x + 5 = 35 flattened into gates with the values flowing through for the x you type; the three matrices of its rank-1 constraint system and the witness that satisfies them, row by row. The gadgets real circuits are made of: a comparison through seven bits, a non-zero check through an inverse, a hash through cubes. And what each one costs in constraints.

Polynomials

Two polynomials over a field of 101 elements that agree only where a cheat arranged it: pick one point and catch the lie. Drag points and watch the one polynomial through them follow. Turn the five constraints into one identity, A·B − C = h·t, with a remainder that appears the moment the witness is wrong. Commit to a whole polynomial with one curve point and open it with a pairing.

The SNARK

The pairing that multiplies two hidden numbers in the exponent, checked on real points. A powers-of-tau ceremony you contribute to, with the pairing checks and the rule that one honest participant is enough. Groth16 proving your witness in a few hundred milliseconds, each stage on a step player, and a verifier that rejects any flipped byte or wrong input, and accepts a forged proof of a false statement if you hand it the toxic waste.

In the world

Get past a bouncer with a 99-byte proof that you are over 18, your year of birth never leaving your side. Spend a note from a private pool with a real proof of the coin circuit, and get caught by the nullifier when you try it twice. Roll a thousand transfers into one proof for the chain to check. The proof systems in use, placed by proof size and verification time.

The map

Nine myths about zero knowledge against what the page showed, a timeline from the 1985 paper to proofs on every chain, your challenges in one board, and where to go on from this page.

Nothing leaves your browser.

Every hash, every proof and every secret you type stays on your machine. Your challenges are kept in this browser only, and you can clear them.

  • Every calculation runs in the browser
  • Your progress stays in this browser, and you can clear it
  • No account, no camera, no microphone

Requirements

Runs in
Any modern browser, on a computer or a phone
Areas
The idea, Colouring, Commitments, Sigma protocols, Circuits, Polynomials, The SNARK, In the world, The map
Code
Python, circom and snarkjs, shown beside the experiments
Controls
Mouse or touch: click edges, nodes and challenges, drag points, sliders for the rest
Account
Not needed
Price
Free

Questions

Do I need to know cryptography or mathematics?

No. Each experiment starts with something to click, shout or drag, and the ideas come after. The code is there for those who want it, and dotted words explain themselves when you point at them or tap them.

Is the cryptography real?

From the commitments on, yes. SHA-256, the curve arithmetic, Schnorr, Pedersen, Merkle trees, MiMC, the pairing, KZG and Groth16 are implemented in the page with the equations from the papers, and the proofs you make are verified by the same code that would reject a forged one. The curve is a small pairing-friendly one chosen so that everything runs in a browser; it is not one you should protect money with.

What is a story and what is a calculation?

A tag on every screen says. The cave, Waldo and the two balls are illustrations of the idea; the colouring protocol, the boxes, the signatures and the SNARK are exact; the rollup uses a stand-in circuit for the state transition and says so.

Can I prove something of my own?

The circuits are fixed, but their inputs are yours: your x, your year of birth, your password, your note in the pool. The code panels show how the same thing is written in circom and proved with snarkjs.

Can I share what I am looking at?

Yes. The address follows the experiment and the settings you changed, so a link opens the same tab with the same values.

Is anything sent anywhere?

No. Everything runs in your browser, and your progress lives in this browser's storage.

Privacy · Terms of Service