LOCAL-TRUE · not on-chain

Visual ZK · circuit explainer

Proof Playground

World-class educational studio for Midnight’s zero-knowledge intuition: pick a circuit, set private witnesses, watch the graph light from gates → public outputs, then run a simulated prove / verify theater — without claiming a real proof server or Compact runtime. By @kshot9000 · nightdream.xyz.

C Circuits P Prove V Verify ? Shortcuts D Donate
Honest scope: local HTML/JS simulation only. Does not run Compact, a proof server, Lace, or real ADA / DUST transfers. Does not claim GitHub Pages is live until Actions are enabled. Circuit diagrams and SHA-256 stand-ins are teaching visuals — verify against official Compact / Zswap crypto before shipping.

Proof journey

Labeled phases from idle → witnesses → circuit lit → proven → verified. Reject / fail is first-class.

  1. 1
    Idle Pick a circuit
  2. 2
    Witness Private inputs set
  3. 3
    Compiled Graph lit · public IO
  4. 4
    Proven Simulated proof blob
  5. 5
    Verified Check against public

Phase: idle — choose a circuit to begin.

What a Midnight-style proof is really saying

Observers see public outputs + a proof. Witnesses stay local. The circuit constrains what those witnesses are allowed to imply.

Private witnesses

Never leave the client in the dual-state model. Teaching stand-in: values you type below.

  • Secret amounts, salts, identities
  • Opening notes for commitments
  • Intermediate gate wires

Public outputs

What the simulated “ledger” / verifier is allowed to see.

  • Commitment hashes
  • Threshold / range flags
  • Selective disclose payloads (optional)

Witness rail

How veiled your private inputs stay after the last run.

100% private (no disclose)

Public rail

How much the verifier learned from public outputs.

0% public surface

Circuit catalog

Five teaching circuits. Each redraws the playground graph and witness form. Press C to focus.

Live circuit playground

Witnesses on the left · animated graph in the center · public preview on the right. Edges pulse during prove.

Circuit graph

Witnesses

Select a circuit above.

Public preview

No compile yet Public outputs appear here after compile — never the raw witnesses (unless you pick selective disclose).

Prove / verify theater

Simulated stages only — no proof server. Fail paths are intentional teaching moments.

  1. 1
    Bind witnesses
    hash private inputs locally
    —
  2. 2
    Constrain gates
    check circuit relations
    —
  3. 3
    Emit proof blob
    SIMULATED · SHA-256 stand-in
    —
  4. 4
    Verify vs public
    accept or reject
    —

0% — idle

No proof yet

—

LOCAL STUB · simulated proof blob only.

Theater log

Awaiting prove…

Gate cheat-sheet

GateRolePublic?
Select a circuit…

Proof history

Session history + witness presets · schema v2 localStorage · BroadcastChannel sync · JSON export/import. LOCAL-TRUE ≠ on-chain / ≠ proof server.

Runs: 0 Verified: 0 Rejected: 0

Anti-pattern vs safe pattern

Teaching sketches — not deployable Compact. Always verify against official docs.

✗ Anti-pattern — clear witnesses on-chain
// BAD: public ledger sees the secret
ledger {
  amount: Uint<64>;   // observers learn the tip
  salt: Bytes<32>;
}
✓ Safer sketch — commit + prove
// BETTER (sketch): public commitment only
ledger {
  commit: Bytes<32>;
  thresholdMet: Boolean;
}
witness amount: Uint<64>;
witness salt: Bytes<32>;
// prove amount >= T without publishing amount

These snippets are educational illustrations. Official Compact syntax, circuits, and Zswap commitments may differ — check Midnight docs before shipping.