Most Web3 agents still run on "trust the server." An endpoint tells you it checked a payment request or screened a transaction for drainers, and you have no way to verify what logic actually ran.
For zkVerify #AgentGames, I built and deployed two agent services:
-
0xginn(zkverify-agent), a dual-track agent competing in Proof Gatekeeper and Steal the VFY. -
zkGuard(zkguard-wildcard), a pre-signing EVM/BSC transaction guard for the Wildcard track.
Instead of letting an LLM make the final call, both services separate request parsing from deterministic policy code and attach a Groth16 proof (snarkjs on BN128) to every verdict.
1. Transport and Auth First
Every request to /agent is signed by the platform with x-agent-games-signature. Before parsing JSON, the server computes HMAC-SHA256 over the raw request buffer and checks it with crypto.timingSafeEqual. Any mismatch returns 401 immediately.
2. Proof Gatekeeper: Deterministic Checks + Groth16
In Proof Gatekeeper, the agent has 60 seconds to approve or reject a simulated payment request. Even when an incoming request carries a valid proof, it can fail one of six policy checks:
-
VK_SUBSTITUTION(proof_vk !== registered_vk) -
THRESHOLD_MISMATCH(public_balance < minimum) -
EXPIRED_CONDITION(current_block >= expiry_block) -
RECIPIENT_MISMATCH(recipient !== condition_recipient) -
AMOUNT_OVERFLOW(amount <= 0oramount > max_transfer) -
PROOF_REUSED(proof_txwas already accepted in an earlier task)
One detail I ran into while testing gatekeeper.wasm (nPublic: 13, zkVerify mainnet vk_hash: 0x6b79c6012a6d8651f3e13bc4d2a20370280ab49700c90c5316d4168bfbad77b0): the circuit enforces the five arithmetic/field checks, including current_block >= expiry_block as expired, while PROOF_REUSED is an off-chain replay check tracked per mode (competition vs practice) in local storage.
In Practice Mode, 0xginn caught PROOF_REUSED (REJECT) and returned a VERIFIED Groth16 proof in 1,167 ms.
3. Steal the VFY: Committing a Policy With Poseidon
Steal the VFY is a 20-turn head-to-head match where both agents pick HOLD, FORTIFY, or EXTRACT N simultaneously. Before Round 1 pairs, you commit a Poseidon hash of your private parameters (strategyParams[0..7] plus a random salt) on-chain:
const hash = poseidon([...params, salt]); Every turn, vfy-policy.wasm (nPublic: 9, zkVerify mainnet vk_hash: 0x6c56509f1c56fd1fd4e9737f906d2220f4b95f1d507f1adf6899085bd74be047) proves that your chosen move matches your committed thresholds for selfBalance and opponentBalance, and binds the proof to matchId and turnNumber so old proofs cannot be replayed.
One schema gotcha worth noting: HOLD and FORTIFY must omit action.amount completely. Passing amount: 0 gets rejected.
4. zkGuard: Applying This to EVM/BSC Wallet Security
For the Wildcard track, I used the same pattern to build zkGuard, a pre-signing guard for EVM and BSC transactions.
Before signing, POST /analyze decodes raw calldata selectors (0x095ea7b3 approve, 0xa22cb465 setApprovalForAll, 0xd505accf permit, 0xac9650d8 multicall), flags unlimited approvals (>= 2^255) to unknown spenders, checks value caps and recipient mismatches, and outputs a 0-100 risk score.
When wiring the risk score into gatekeeper.wasm, passing raw 18-decimal wei values hit Num2Bits bit-width limits in the circuit. Scaling the verdict to the bounded 0-100 risk score (amount = riskScore, maxTransfer = 39) solved it cleanly so every APPROVE / REJECT decision produces a locally verified Groth16 proof regardless of token decimals.
Source and Live Demo
- Competition agent (
Proof Gatekeeper+Steal the VFY): https://github.com/DaddyUnikii/zkverify-agent -
zkGuard(Wildcardwallet security agent): https://github.com/DaddyUnikii/zkguard-wildcard - Live
zkGuarddemo: https://previous-meaning-sunrise-ink.trycloudflare.com
Submitted for zkVerify #AgentGames.