This document is a self-contained, incremental course on how the PoL relation is turned into a single STARK proof over the Goldilocks field with Rescue-Prime Optimized (RPO) as the hash. It starts from the relation, introduces the one STARK tool we need (how a per-row rule becomes a polynomial), then builds the circuit one block at a time — a single hash, a chain of hashes, a Merkle path, the derived note identifier, the lottery — and finally assembles them into the full trace. The later sections are complete reference tables (every column, mask, constraint, assertion, and trace row) plus the soundness argument and benchmarks. A reader should be able to validate and re-implement the circuit from this text alone.

Here is an overview of the final circuit:

air_matrix.svg

Color legend used throughout:

meaning
🟦 RPO permutation round rows
🟩 load / wiring row: routes values into the next permutation’s input
🟪 persistent binding: a witness value carried unchanged and linked once
🟨 range-check band: bit-peel accumulators (the < comparison)
🟧 lottery bind row: ticket split + threshold + difference
🟥 boundary assertion: a public input/output is pinned
⬜ padding: state at rest

What we prove, and why

A leader wants to convince every validator that they control an eligible note that won the slot lottery, while revealing nothing that links the proof to their identity or stake. “Eligible” means the note exists in the ledger now (unspent) and existed at the start of the previous epoch (aged enough); “won” means a per-note lottery ticket fell below a stake-scaled threshold. The proof must be tiny and cheap to verify, because every validator checks it and we want leadership to be maximally decentralized. A transparent STARK fits: no trusted setup, post-quantum assumptions, fast verification.

The whole statement is proven in one STARK proof. Nothing is split across proofs and nothing that should be private is revealed.

The PoL relation, precisely

There exist private values sk (secret key), v (the note value), tx_hash, out_num, and two Merkle authentication paths, such that:

pk        = RPO_PK(sk)    # knowledge of sk (pk is INTERNAL)
note_id   = RPO_NID(pk, v, tx_hash, out_num)
root_aged   = MerklePath_aged(note_id,   path_aged)    # in ledger_AGED
root_latest = MerklePath_latest(note_id, path_latest)  # in ledger_LATEST
ticket    = RPO_LEAD(epoch, slot, note_id, sk)         # lottery ticket
threshold = v*(t0 + t1*v)                              # lottery check
ticket_lo < threshold                                  # take 32 bits of rng
entropy   = RPO_NONCE(slot, note_id, sk)               # entropy contribution

v is the note’s value: it is committed inside note_id and it is the quantity that scales the lottery threshold: one and the same field element, not two. The subscripted RPO_* denote the same RPO permutation run under distinct domain separators (Domain separation ), the in-field analogue of the spec’s LEAD_V1 / NONCE_CONTRIB_V1 tags.

Public inputs

(prover and verifier agree on these):

symbol size role
P_LEAD 4 leader block-signing key bound to the proof, no constraint (P_LEAD )
root_aged 4 ledger_AGED Merkle root
root_latest 4 ledger_LATEST Merkle root
entropy 4 leader’s entropy contribution
epoch, slot 1+1 the contested slot
t0, t1 1+1 epoch difficulty coefficients (precomputed off-circuit)

Private inputs

(witness, never revealed):

symbol role
sk secret key = RPO preimage
v note value (a Goldilocks element); committed in note_id and used in the threshold
tx_hash, out_num note transaction hash and output index (note_id inputs)
path_aged, path_latest 32 sibling digests + 32 order bits each

The note’s own public key pk = RPO(sk) is derived in-circuit and consumed by note_id; it is not a public input (publishing it would link a note’s proofs and leak stake).

Choosing the field and the hash