Circuits
The authorize, enroll and claim circuits: what each proves and its public inputs.
Once has three circuits, written in Circom 2 and proved with Groth16 over BN254 in the browser with snarkjs. Every hash inside them is circomlib's Poseidon over the BN254 scalar field. The proving artifacts for each are served by GET /v1/artifacts/{name}/{file}, where file is wasm, zkey or verification-key.
The two circuits the program verifies, enroll and claim, expose a single public input: a Poseidon digest of their statement. The program rebuilds that digest from values it reads from its own accounts and from the instruction, so each value is checked without a long list of public inputs.
authorize
14,750 R1CS constraints, 7 public inputs, compiled with Circom 2.2.3.
Proves that a blinded OPRF query comes from a valid credential. The OPRF nodes verify it before answering; the program never sees it.
| Public input | Value |
|---|---|
Bx, By | The blinded query B |
issuerX, issuerY | The issuer's public key |
holderX, holderY | The holder public key |
validUntil | The credential's valid-until time |
It checks that the 16 credential values hash to the root the issuer signed and that the signature verifies under the issuer key; that B = r·P where P is HashID hashed to the curve and r is the private blinding scalar; that the holder key is slots 8 and 9 of the credential; and that validUntil is slot 7 and fits 64 bits. Private inputs: the 16 values, the signature, r, and the hints the hash-to-curve needs.
enroll
37,257 R1CS constraints, 1 public input, compiled with Circom 2.2.3.
Proves that a person nullifier and a leaf come from a valid credential and a correct OPRF transcript under the registered key. Verified by the enroll instruction.
statement = Poseidon(N, leaf, issuerX, issuerY, registryDigest, validUntil, walletHi, walletLo)| Value in the digest | Where the program gets it |
|---|---|
N | The n argument, which also derives the person account's address |
leaf | The leaf argument, which is appended to the tree |
issuerX, issuerY | The issuer account passed to the instruction |
registryDigest | The OPRF registry account |
validUntil | The valid_until argument, checked to be in the future |
walletHi, walletLo | The signing wallet's address, split into two 16-byte big-endian halves |
Inside, it repeats the credential check of authorize; checks that the four registry points are in the prime-order subgroup and lie on one degree-one polynomial, and that their Poseidon digest is registryDigest; checks that the two answers come from two distinct shares, each with a valid DLEQ proof; checks that r·Q interpolates from the two answers; and computes s = Poseidon(Qx, Qy), N = Poseidon(2^128 + 0x504552534f4e, s) and Poseidon(s, k, expiry) with the place secret k as a private input. Binding the wallet keeps the proof from being replayed by another wallet.
claim
5,854 R1CS constraints, 1 public input, compiled with Circom 2.2.3.
Proves membership in the person tree and the scope nullifier for one scope. Verified by the claim instruction.
statement = Poseidon(root, n, scopeId, closesAt, binding)| Value in the digest | Where the program gets it |
|---|---|
root | The root argument, checked against the last 64 roots |
n | The n argument, which also derives the claim receipt's address |
scopeId | The scope account |
closesAt | The scope account |
binding | The binding argument, checked against the drop's payout note or the poll's option |
Inside, it computes the leaf Poseidon(s, k, expiry) from private inputs, walks the 20 sibling hashes with the bits of the leaf's index to root, checks closesAt < expiry over 64 bits, and computes n = Poseidon(s, scope_id). Private inputs: s, k, expiry, the siblings and the index.
Proof format
The API takes proofs as snarkjs writes them (pi_a, pi_b, pi_c as decimal strings). The program takes 256 bytes in the order the alt_bn128 syscalls use: A negated (64 bytes), B with the imaginary limb of each coordinate first (128 bytes), and C (64 bytes), each coordinate big-endian. proofBytes in @once/zk converts one to the other.
Proving keys
The localnet keys come from a single phase-2 contribution over the Hermez phase-1 transcript of power 16. Fingerprints of the files the program's verifying keys were built from:
| Circuit | R1CS SHA-256 | zkey SHA-256 |
|---|---|---|
authorize | 041c0ea506662e937183c3c3ec1ae23479190242a7b278f5ad1b40ff809e6bf0 | 1c6d3f7a9e9419ae1d68a965867280af8320bbb80bdfdb49134638d5510fa85d |
enroll | 5cc3694f92792977ce7ff3901d20117681284ce32c50fb5e570bfe246c84fe9a | c0c1668628719e8fef66c2a6779069ae46b0aa2cb969abd79a7b9782d760c6a9 |
claim | 34026fab2bba303626f0a2bdb61e8ad66dbb898749bac07323e3ab7fc6ea013e | f19dde2e7265ec00868ff0541cc04c0088579198ff4be685641967b3f9722c46 |
Proving times are on Measured figures.