Structs§
- Proof
Bundle - JSON shape of a proof emitted by the prover.
- Public
Inputs - JSON shape of the public inputs (verifier-visible).
- Witness
Input - JSON shape of a witness file (private inputs to the prover).
Constants§
- D
- TREE_
DEPTH - Tree depth — limits the maximum number of leaves to 2^TREE_DEPTH. v1 ships TREE_DEPTH=4 (supports up to 16 leaves) for demo-scale. The schema cap (10,000 leaves per epoch) is wider — production would re-run the SNARK setup with TREE_DEPTH=14 (supports 16,384). Trade-off is named in DEVNOTES/zk-snark.md.
Functions§
- build_
circuit - Build the circuit: prove “I know the leaf at index i in a Merkle tree whose root is R, where R + epoch_id + context_id + nonce are public.”
- build_
merkle_ tree - Compute the Merkle root over a vector of leaf hashes (each a HashOut). Returns the root as a HashOut and the MerkleTree for proof generation.
- compute_
epoch_ root - Compute the epoch Merkle root from the same leaf set the prover sees.
This is the function
polaris_web/zk.py’s “compute_root” subcommand shells out to. - prove
- Generate a proof. Returns the serialized proof bytes + the public inputs.
- verify
- Verify a proof. Returns true iff the proof is valid AND the public inputs in the proof match the claimed (epoch_root, epoch_id, context_id, nonce).