Circuit
Every signal and constraint of the post circuit, the public signal order, the artifacts and how the keys were made.
The post circuit is talaria.circom: one template, TalariaPost, instantiated with a tree height of 26. It proves that one pass in the pool authorizes one payload for one relay on one day. Circom 2.2.3, Groth16 over BN254, with circomlib's Poseidon and comparators. The proof explains what it states in plain terms.
Signals#
Every signal is a BN254 field element. They are listed in the order the template declares them.
Public#
- rootfield
- A root of the pool. The program accepts it only if it is in the accepted root history.
- dayfield, 64 bits
- The day the post is for: Unix time divided by the day length, rounded down. The program requires today.
- nullifierfield
Poseidon(secret, day, counter).- payloadHashfield, 248 bits
- The first 31 bytes of SHA-256(payload), big-endian. The program computes it from the payload.
- relayLowfield, 128 bits
- The low 128 bits of the relay's address read as a big-endian integer.
- relayHighfield, 128 bits
- The high 128 bits of the same integer.
Private#
- secretfield
- The pass secret.
Poseidon(secret)is the pass'sid_commitment. - limitfield, 64 bits
- The pass's daily limit.
- expiryDayfield, 64 bits
- The last day the pass is valid.
- counterfield, 64 bits
- Which of today's messages this is, from
0. - pathElements[26]field[26]
- The sibling at each level of the Merkle path, leaf upward.
- pathIndices[26]bit[26]
- At each level,
0if the path's node is the left child,1if it is the right. - boundPayloadHashfield
- A private copy of
payloadHash. - boundRelayLowfield
- A private copy of
relayLow. - boundRelayHighfield
- A private copy of
relayHigh.
Intermediate#
nodes[27] holds the node at each level from the leaf (nodes[0]) to the computed root (nodes[26]). left[26] and right[26] hold the two inputs of each level's hash.
Constraints#
| Constraint | What it enforces |
|---|---|
Num2Bits(64) on limit, counter, day, expiryDay | Each fits in 64 bits, so the comparisons below are sound. |
LessThan(64): counter < limit | Today's counter is below the daily limit. |
LessEqThan(64): day ≤ expiryDay | The pass has not expired. Expiry is inclusive. |
leaf = Poseidon(Poseidon(secret), limit, expiryDay) | The leaf is formed exactly as buy_pass forms it. |
pathIndices[i] × (pathIndices[i] − 1) = 0 | Each path index is a bit. |
left[i], right[i] select the node and its sibling by pathIndices[i]; nodes[i + 1] = Poseidon(left[i], right[i]) | Each level hashes the pair in path order. |
nodes[26] = root | The leaf is under the public root. |
Poseidon(secret, day, counter) = nullifier | The nullifier follows from the pass, the day and the counter. |
boundPayloadHash = payloadHash, boundRelayLow = relayLow, boundRelayHigh = relayHigh | The private copies equal the public values. |
Num2Bits(248) on boundPayloadHash; Num2Bits(128) on each relay limb | The payload hash fits 248 bits and each limb 128 bits. |
The last two rows keep a non-linear constraint on every external binding. Equal private copies alone would be removed by the compiler's linear simplification. secret is not range-checked; the SDK derives it in [1, p − 1] of the BN254 scalar field.
The circuit has 7,941 non-linear constraints and 7,967 wires, compiled with --O2.
Public signal order#
The verifier sees the public signals in this order, with no outputs before them:
root, day, nullifier, payloadHash, relayLow, relayHigh
On chain each is 32 big-endian bytes. The program assembles them from the post arguments, the payload it hashes and the relay that signed. The proof shows how each is formed.
Artifacts#
The prover artifacts ship in the backend's packages-out/prover/:
| File | Bytes | SHA-256 |
|---|---|---|
talaria.wasm | 2,487,805 | f3f002b0628c390855063074022c83943aeb8709d8bfd0ca8c4420e7f473b8a3 |
final.zkey | 4,513,207 | 7ca4bc916ca6e50550fa0cb370e06b571e21067e2c384357109fbad5e07b9b85 |
verification_key.json | 4,135 | ebec900723cde0b3f971f6fdc089516b51cc9b6d59174d103a49640f5839cc7d |
manifest.json | Names the circuit, compiler, scheme, curve, tree height, constraint and wire counts, the public signal order, the setup and the hash of each file above. |
talaria.wasm computes the witness, final.zkey is the proving key the browser loads, and verification_key.json is the key the program's verifier is generated from. The program carries the same key as compiled Rust, along with the 27 empty-tree nodes the pool starts from.
A proof leaves the prover as 256 bytes: A with its y coordinate negated (64), B (128, each coordinate's two halves in the order the syscall reads them), C (64), every coordinate 32 big-endian bytes.
How the keys were made#
The keys in this build come from a development phase 2 with one contributor:
Phase 1
The public Perpetual Powers of Tau transcript at power 13,
ppot_0080_13.ptau, the smallest power that fits the circuit, checked against SHA-256ccee28086e4b81d81a6e16fdee054d1dbd5276362e2662d4205d31de45cb930f.Phase 2
snarkjs groth16 setupon the compiled circuit, then one contribution from fresh operating-system randomness, written asfinal.zkey.Check
The proving key was verified against the circuit and the transcript (
ZKey Ok!), and the verification key exported from it.
The manifest records this as single-contributor-development. Running the setup again makes new keys, and the program is then rebuilt with the newly exported verification key. The launch keys come from a multi-party ceremony, and the program ships with the verification key it produces.
Source#
pragma circom 2.2.3;
include "circomlib/circuits/poseidon.circom";
include "circomlib/circuits/comparators.circom";
// One anonymous pass authorizes one payload for one relay on one day.
template TalariaPost(height) {
signal input root;
signal input day;
signal input nullifier;
signal input payloadHash;
signal input relayLow;
signal input relayHigh;
signal input secret;
signal input limit;
signal input expiryDay;
signal input counter;
signal input pathElements[height];
signal input pathIndices[height];
signal input boundPayloadHash;
signal input boundRelayLow;
signal input boundRelayHigh;
component limitBits = Num2Bits(64);
component counterBits = Num2Bits(64);
component dayBits = Num2Bits(64);
component expiryBits = Num2Bits(64);
limitBits.in <== limit;
counterBits.in <== counter;
dayBits.in <== day;
expiryBits.in <== expiryDay;
component withinLimit = LessThan(64);
withinLimit.in[0] <== counter;
withinLimit.in[1] <== limit;
withinLimit.out === 1;
component unexpired = LessEqThan(64);
unexpired.in[0] <== day;
unexpired.in[1] <== expiryDay;
unexpired.out === 1;
component identity = Poseidon(1);
identity.inputs[0] <== secret;
component leaf = Poseidon(3);
leaf.inputs[0] <== identity.out;
leaf.inputs[1] <== limit;
leaf.inputs[2] <== expiryDay;
signal nodes[height + 1];
signal left[height];
signal right[height];
component branches[height];
nodes[0] <== leaf.out;
for (var level = 0; level < height; level++) {
pathIndices[level] * (pathIndices[level] - 1) === 0;
left[level] <== nodes[level] + pathIndices[level] * (pathElements[level] - nodes[level]);
right[level] <== pathElements[level] + pathIndices[level] * (nodes[level] - pathElements[level]);
branches[level] = Poseidon(2);
branches[level].inputs[0] <== left[level];
branches[level].inputs[1] <== right[level];
nodes[level + 1] <== branches[level].out;
}
nodes[height] === root;
component spent = Poseidon(3);
spent.inputs[0] <== secret;
spent.inputs[1] <== day;
spent.inputs[2] <== counter;
spent.out === nullifier;
// Range constraints retain a non-linear relation for every external binding.
// Equal private copies alone would be removed by linear simplification.
boundPayloadHash === payloadHash;
boundRelayLow === relayLow;
boundRelayHigh === relayHigh;
component payloadBits = Num2Bits(248);
component lowBits = Num2Bits(128);
component highBits = Num2Bits(128);
payloadBits.in <== boundPayloadHash;
lowBits.in <== boundRelayLow;
highBits.in <== boundRelayHigh;
}
component main { public [root, day, nullifier, payloadHash, relayLow, relayHigh] } = TalariaPost(26);