Creator Track deep-dive — Agent Games Season 01, by Lince (@XL_coin). Part 2 of the Proof Gatekeeper build log. #AgentGames
Part 1 built it. Part 2 opens it up.
In Part 1 I wrote about building Proof Gatekeeper — a public endpoint that answers APPROVE or REJECT on proposed payments, with a Groth16 proof of every decision. The checklist, the 13 nameless circuit signals, the Poseidon commitment, the Railway lesson. That was the build log; this is the inside view.
This part answers a different question: what actually happens between the platform sending a task and the gatekeeper answering it — and what three scored rounds did to the scoreboard.
The numbers first, because they are the reason this part exists. After Rounds 04, 05, and 06, Proof Gatekeeper holds 232.0 points and sits at rank #212 of 495 agents. Round 04 added 80 points with 9 proofs verified; Round 05 added 70; Round 06 added 82. The rank climbed from #229 this time — Round 06 was the strongest round yet — but the leaders keep pulling away (the top two both gained 101 points in Round 05, a perfect round). That is the honest picture, and it is also why the mechanics below matter: in this competition, the difference between a good agent and a great one is not the cryptography. It is the discipline of never answering a question you were not asked, and never approving a payment you did not check.
The front door: HMAC before anything else
Every task arrives as a POST to /gatekeeper with one header: x-agent-games-signature. Its value is an HMAC-SHA256 of the raw request body, hex-encoded, computed with a secret the platform issued when the agent was registered.
The first thing the server does is verify that signature — before parsing any JSON, before reading any field. The code is short:
export function verifySignature(secret, rawBody, headerValue) {
if (!secret || typeof headerValue !== "string") return false;
const expected = hmacHex(secret, rawBody);
const a = Buffer.from(expected, "utf8");
const b = Buffer.from(headerValue.trim().toLowerCase(), "utf8");
if (a.length !== b.length) return false;
return timingSafeEqual(a, b);
}
Three details in there are doing real work:
Raw body, not parsed JSON. The HMAC covers the exact bytes the platform sent. Re-serializing a parsed object would change whitespace and key order, and the signature would never match. This is the kind of thing that fails silently in testing and loudly in production — the preflight handshake is what confirmed the format, because the documentation never spelled out that the digest is lowercase hex.
Constant-time comparison. timingSafeEqual means the check takes the same time whether the first byte is wrong or the last one is. A naive === leaks, byte by byte, how much of a forged signature is correct. Nobody is going to brute-force a 256-bit HMAC through a timing leak — but the point of a guard is that it does not rely on the attacker being lazy.
No secret, no service. The secret comes from exactly one place: the AGENT_GAMES_HMAC_SECRET environment variable, set from the dashboard's Rotate Secret. It is never logged, never committed, never pasted anywhere. If it is missing, the server answers 503 and refuses to judge anything. A guard that answers without its key is not a guard.
A bad signature gets a 401 and nothing else — no parsing, no decision, no proof. And the authentication is mutual: every response the gatekeeper sends carries its own x-agent-games-signature over the raw response body, so the platform can verify that the answer came from the registered agent and was not tampered with in transit.
The same endpoint also handles the preflight handshake — the platform sends {type: "agent-games.preflight.v1", agent_id, issued_at, nonce} and expects {ok: true, protocolVersion: "v1"}, signed. Preflight must pass before the agent is marked active. It is the cheapest possible proof that both sides agree on the signature format, and it caught the one format question the docs left open.
The decision engine: a pure function, in a fixed order
Once the signature checks out, the task is parsed and decided by a pure function. No language model, no judgment calls, no vibes. The checks run in a fixed order, and the first failure decides the outcome:
-
Malformed envelope → REJECT /
INVALID_TASK, with no proof. There is nothing provable about a task that cannot be read. - Task seen before → return the cached response. The task ID is the idempotency key: the platform retries after network failures, and a retry must get the same answer, not a second decision.
-
Proof already used by another task → REJECT /
PROOF_REUSED, with no proof. A proof is a receipt for exactly one task; reusing it is the oldest trick in the book, and the rules exclude these answers from the proof bonus anyway. -
Verification key substituted → REJECT /
VK_SUBSTITUTION. -
Balance below the minimum → REJECT /
THRESHOLD_MISMATCH. -
Recipient mismatch → REJECT /
RECIPIENT_MISMATCH. -
Amount above the maximum → REJECT /
AMOUNT_OVERFLOW. -
Condition expired → REJECT /
EXPIRED_CONDITION. -
Otherwise → APPROVE /
VALID_CONDITION.
The order matters. Idempotency comes before everything, because answering the same task twice is worse than answering it slowly. Proof-reuse comes before the field checks, because a reused proof is invalid no matter what the fields say. And the field checks are all simple comparisons — the whole decision is a handful of them. The expensive part is the proof, and it only starts after the decision is made.
Two encoding details are worth naming, because they are the kind of thing that breaks silently. The 256-bit verification-key hashes are reduced modulo the bn128 field prime before they enter the circuit — the registered key hash itself is larger than the prime, so the reduced value is what appears in the public signals. And the task ID string becomes a field element from its raw UTF-8 bytes. Neither encoding is documented anywhere; both were confirmed the only way that counts, by a practice proof the platform accepted.
Then there is the salt: a fresh random 128-bit value per proof, private, never logged, never returned. It feeds the Poseidon commitment from Part 1 — commitment = Poseidon(salt, taskId) — which is what binds a proof to exactly one task. A proof for task A cannot be replayed for task B, because the commitment would not match.
And the circuit itself is the referee. The gatekeeper template asserts the decision against the inputs: feed it a decision that contradicts the fields and the witness generation fails — no proof is produced at all. A wrong answer cannot be dressed up as a proven one. That is the difference between a server that claims it checked and a server that cannot lie about having checked.
The governing rule throughout is fail closed. Unknown input, expired input, unsigned input: all rejected. A guard that approves what it does not understand is not a guard.
The prover at runtime: 45 seconds of patience, then answer anyway
The proof is generated locally with snarkjs — groth16.fullProve against the official circuit files (1.7 MB wasm, 310 KB proving key) — and handed back for the platform to re-verify against its own registered key. No network, no keys, no spending: the proof is computed on the server and returned.
The platform allows 60 seconds per response. The gatekeeper gives proving an internal budget of 45 seconds. If proving ever exceeds it, the server answers the decision without a proof rather than timing out. That is a deliberate trade, and the scoring is why: a correct decision without a proof costs 2 points (12 for the correct call, minus 2 for the missing proof), while a timeout costs 2 points and decides nothing — a correct REJECT without proof still nets +10 on a trap task. Answering late is the only move that is always wrong.
In practice proving takes well under a second — 270–900 ms locally, 498 ms on the verified practice task — so the 45-second budget is a guardrail, not a routine. But guardrails are the product here. The server also runs a full self-test before accepting any traffic: it proves an APPROVE on the official sample task, verifies the proof locally, and checks that all 13 public signals are present. The /health endpoint reports the result truthfully from the first request — HMAC configured, circuit files present, self-test status — and GET /health?selftest=1 re-runs it on demand. If the self-test fails, the server still starts (so health can report the failure), but it logs the warning loudly. A guard that cannot prove its own readiness should say so.
Three scored rounds, honestly
Round 04 closed with 80.0 points and rank #197, with 9 proofs verified. Round 05 added 70 points, taking the total to 150.0 — but the rank slipped to #223 by the morning check and #229 on the dashboard a few hours later, because the agents ahead scored faster. Round 06 added 82 points, taking the total to 232.0 and the rank up to #212. The top three now: pecker at 479.9, Astrex-1 at 470.4, Bnova GateKeeper at 469.3. The gap to first is 247.9 points with two rounds left.
That is the honest picture, and it is worth saying plainly: the scoring rewards speed as much as correctness. A perfect round is 101 points — eight tasks at +12, plus the +5 reliability bonus — and the leaders are collecting them. Catching first place is now out of reach on points alone: even two perfect rounds (+202) would take us to 434, still below first place's current 479.9. The realistic goal for Rounds 07–08 is to finish strong, keep the rejection record clean, and let the receipts speak.
One piece of scoring design deserves attention, because it explains the whole architecture: a wrong APPROVE costs −6, a wrong REJECT costs −3. Approving a bad payment is punished twice as hard as rejecting a good one. That asymmetry is why fail-closed is not just a principle — it is the optimal strategy under these rules. When the inputs are ambiguous, the correct move is to reject, take the −3 at worst, and never hand the platform a proven approval for a payment that should not have happened. The gatekeeper's conservatism is not caution for its own sake. It is arithmetic.
The server itself held up: uptime 99.9% through the round windows, health checks clean, the HMAC secret configured, every task answered inside the deadline. The boring stack from Part 1 — plain Node.js, no framework, Railway — did exactly what boring is supposed to do.
What it never does
For completeness, and because it is the point: this server never holds a wallet key, never signs a transaction, never spends anything. The only secret it holds is the platform HMAC secret. Its on-disk state holds only proof-transaction hashes and task IDs — no secrets, nothing spendable. The gatekeeper judges and proves. That is all it can do, and that is the guarantee.
What's next
Rounds 07–08 run nightly, 17:30–03:30 WIB, eight tasks each. The work from here is keeping the endpoint up through every window and letting the checklist do what it does. Creator Track submissions close 21 November, 22:00 UTC.
Agents will move money. The question is not whether we trust them, but whether we can stop needing to. A guard that proves every rejection — and every approval — is one concrete answer. #AgentGames
Proof Gatekeeper — receipts, not promises. Built for Agent Games by zkVerify. Repo: github.com/lince00/agent-games-gatekeeper · Live endpoint: gatekeeper-production-96ab4a9e.up.railway.app/gatekeeper · Part 1: Receipts, Not Promises: Building a Payment Guard That Proves Every Decision
Top comments (0)