<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: arukh89</title>
    <description>The latest articles on DEV Community by arukh89 (@arukh89).</description>
    <link>https://dev.to/arukh89</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4255466%2F1aff3046-bcb0-433b-82e2-6e78d1eafd88.png</url>
      <title>DEV Community: arukh89</title>
      <link>https://dev.to/arukh89</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/arukh89"/>
    <language>en</language>
    <item>
      <title>Before I let my agent sign anything, I make it prove the verdict — building MintGuard for zkVerify Agent Games</title>
      <dc:creator>arukh89</dc:creator>
      <pubDate>Fri, 20 Nov 2026 10:21:32 +0000</pubDate>
      <link>https://dev.to/arukh89/before-i-let-my-agent-sign-anything-i-make-it-prove-the-verdict-building-mintguard-for-zkverify-2e6e</link>
      <guid>https://dev.to/arukh89/before-i-let-my-agent-sign-anything-i-make-it-prove-the-verdict-building-mintguard-for-zkverify-2e6e</guid>
      <description>&lt;h1&gt;
  
  
  AgentGames
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;An honest build log: a pre-signing guard for BSC agent transactions,&lt;br&gt;
built and deployed in one day for the Wildcard track. Every number below&lt;br&gt;
comes from runs I actually did. Where something is still open, I say so.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem in one sentence
&lt;/h2&gt;

&lt;p&gt;My AI agent holds a wallet and signs transactions for me — free NFT&lt;br&gt;
mints on BSC, mostly — and until this week it checked &lt;em&gt;nothing&lt;/em&gt; before&lt;br&gt;
signing. One unlimited &lt;code&gt;approve()&lt;/code&gt;, one &lt;code&gt;setApprovalForAll(true)&lt;/code&gt;, one&lt;br&gt;
call to an unverified contract, and the wallet is empty.&lt;/p&gt;

&lt;p&gt;So I built the check that runs before the signature: &lt;strong&gt;MintGuard&lt;/strong&gt;.&lt;br&gt;
Live at &lt;a href="https://mintguard-psi.vercel.app" rel="noopener noreferrer"&gt;https://mintguard-psi.vercel.app&lt;/a&gt;. Public repo:&lt;br&gt;
&lt;a href="https://github.com/arukh89/mintguard" rel="noopener noreferrer"&gt;https://github.com/arukh89/mintguard&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it does
&lt;/h2&gt;

&lt;p&gt;Send it a transaction — &lt;code&gt;POST /analyze&lt;/code&gt; with &lt;code&gt;{ chainId, to, data, value }&lt;/code&gt; —&lt;br&gt;
and it answers &lt;code&gt;ALLOW&lt;/code&gt;, &lt;code&gt;REVIEW&lt;/code&gt;, or &lt;code&gt;BLOCK&lt;/code&gt;, with a risk score and named&lt;br&gt;
reasons. Two real calls from the live endpoint:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A real free mint — ALLOW, score 0.&lt;/strong&gt; Meow Cards on BSC&lt;br&gt;
(&lt;code&gt;0xb8164afefc53910d7a74cece15a60a9e0c86089e&lt;/code&gt;), &lt;code&gt;mint(1)&lt;/code&gt;, value 0.&lt;br&gt;
The contract is source-verified on Sourcify, the calldata is a known&lt;br&gt;
mint selector, no value moves. Nothing to object to.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;An unlimited approval to an unverified contract — BLOCK, score 85.&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;approve(spender, 2^256-1)&lt;/code&gt; to &lt;code&gt;0x1111…1111&lt;/code&gt;: +40 for the unverified&lt;br&gt;
contract, +45 for the unlimited approval. That is the shape that drains&lt;br&gt;
wallets, and the guard names both halves of it.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it decides (the whole policy fits in one file)
&lt;/h2&gt;

&lt;p&gt;The policy is a pure function — &lt;code&gt;lib/guard.js&lt;/code&gt;, no model calls, no&lt;br&gt;
reputation lists, no allow-lists. Points add up; 0–29 ALLOW, 30–59&lt;br&gt;
REVIEW, 60+ BLOCK:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Rule&lt;/th&gt;
&lt;th&gt;Points&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Unverified contract (Sourcify)&lt;/td&gt;
&lt;td&gt;+40&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Verification check failed / timed out&lt;/td&gt;
&lt;td&gt;+15 (never treated as a pass)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unlimited approval (&lt;code&gt;&amp;gt;= 2^255&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;+45&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Any approval above zero&lt;/td&gt;
&lt;td&gt;+10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;setApprovalForAll(true)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;+40&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;permit()&lt;/code&gt; (signed off-chain approval)&lt;/td&gt;
&lt;td&gt;+25&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;multicall()&lt;/code&gt; (hides the real calls)&lt;/td&gt;
&lt;td&gt;+20&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unknown calldata selector&lt;/td&gt;
&lt;td&gt;+25&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mint/claim carrying value&lt;/td&gt;
&lt;td&gt;+20&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Value above 0.1 BNB on BSC&lt;/td&gt;
&lt;td&gt;+15&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Three design rules, and I wrote them down before I wrote code:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Fail closed.&lt;/strong&gt; Anything unknown raises the score. Unknown is never
silently trusted.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deterministic.&lt;/strong&gt; Same inputs, same verdict, every time. That is the
checkable claim: &lt;code&gt;POST /verify&lt;/code&gt; recomputes any verdict from the
inputs and the recorded chain facts, and tells you whether the claimed
verdict and the HMAC receipt match. I verified the round-trip live:
verdict matches, receipt valid.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Honest scope.&lt;/strong&gt; &lt;code&gt;/verify&lt;/code&gt; proves the verdict follows from the
inputs under this policy. It does &lt;em&gt;not&lt;/em&gt; re-prove the chain facts
themselves — and the response says that in plain text.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The bug the tests caught before users did
&lt;/h2&gt;

&lt;p&gt;I wrote the selector table from memory. Three of fifteen entries were&lt;br&gt;
wrong: &lt;code&gt;safeMint(address,uint256)&lt;/code&gt;, &lt;code&gt;safeMint(address)&lt;/code&gt;, and &lt;code&gt;claim()&lt;/code&gt;&lt;br&gt;
all had incorrect 4-byte selectors. A wrong selector means the guard&lt;br&gt;
misreads the call — the exact failure it exists to prevent.&lt;/p&gt;

&lt;p&gt;The test suite recomputes every selector as &lt;code&gt;keccak256(signature)[0:4]&lt;/code&gt;&lt;br&gt;
and asserts it equals the table. It failed on the first run, I fixed the&lt;br&gt;
three entries from the computed values, and it has passed since — 20&lt;br&gt;
tests, all green, including the full &lt;code&gt;/analyze&lt;/code&gt; → &lt;code&gt;/verify&lt;/code&gt; round-trip&lt;br&gt;
with a stubbed Sourcify. The runtime itself is stdlib-only; no&lt;br&gt;
dependencies ship in production.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deployment notes (the unglamorous half)
&lt;/h2&gt;

&lt;p&gt;Vercel serverless, Node. The first deploy attempt failed with&lt;br&gt;
&lt;code&gt;missing_project_settings&lt;/code&gt; (new projects need &lt;code&gt;projectSettings&lt;/code&gt; in the&lt;br&gt;
payload — &lt;code&gt;{"framework": null}&lt;/code&gt; fixed it). Receipts are HMAC-SHA256&lt;br&gt;
keyed by a secret stored as an encrypted Vercel env var; without it the&lt;br&gt;
endpoint falls back to a dev default and &lt;em&gt;says so&lt;/em&gt; in the response&lt;br&gt;
(&lt;code&gt;receiptDevSecret: true&lt;/code&gt;). After setting the real secret I redeployed&lt;br&gt;
and confirmed live: &lt;code&gt;receiptDevSecret: false&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;One honest loose end: in the first minute after the first deploy, two&lt;br&gt;
&lt;code&gt;POST /analyze&lt;/code&gt; calls returned empty after ~30s while &lt;code&gt;GET /health&lt;/code&gt;&lt;br&gt;
worked. Every call since — a dozen across the session — answered in&lt;br&gt;
0.5–0.7s with correct verdicts. I could not reproduce it, so I report&lt;br&gt;
it instead of pretending it never happened.&lt;/p&gt;

&lt;h2&gt;
  
  
  The zkVerify half — done, with receipts
&lt;/h2&gt;

&lt;p&gt;The verdict is a checkable claim today (deterministic recomputation +&lt;br&gt;
signed receipt). And the Groth16 layer works: I encoded two real&lt;br&gt;
verdicts as inputs to the tournament's official gatekeeper circuit —&lt;br&gt;
&lt;code&gt;amount&lt;/code&gt; is the risk score, &lt;code&gt;maxTransfer&lt;/code&gt; is 29 (the ALLOW ceiling),&lt;br&gt;
&lt;code&gt;decision&lt;/code&gt; is 1 exactly when the score is in the ALLOW band — and&lt;br&gt;
generated proofs with &lt;code&gt;snarkjs&lt;/code&gt; against the official circuit files&lt;br&gt;
(&lt;code&gt;gatekeeper.wasm&lt;/code&gt; sha256 matches the published hash). Both verify&lt;br&gt;
against the registered verification key: ALLOW score 0 in 885 ms, BLOCK&lt;br&gt;
score 85 in 303 ms. The proof files and a one-command re-verifier live&lt;br&gt;
in the repo (&lt;code&gt;node scripts/verify-proof.js&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;One honest limit: the proof covers the &lt;em&gt;encoded verdict&lt;/em&gt;, not the&lt;br&gt;
guard's Sourcify lookup or selector decoding — those happen outside&lt;br&gt;
the circuit. A full in-circuit guard would need a custom circuit.&lt;br&gt;
The proof turns "the agent says it checked" into "here is the check,&lt;br&gt;
verify it yourself" for the part that fits in the circuit. That is the&lt;br&gt;
whole idea of the Agent Games: don't trust the agent, verify the&lt;br&gt;
gatekeeper.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limits, stated not hidden
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Only BSC has the high-value threshold; other chains score the same
policy without it.&lt;/li&gt;
&lt;li&gt;A Sourcify timeout scores +15, not a block — and the receipt records
&lt;code&gt;verified: null&lt;/code&gt;, so a reviewer sees the gap.&lt;/li&gt;
&lt;li&gt;No &lt;code&gt;eth_call&lt;/code&gt; simulation: the guard reads calldata and verification
state; it does not simulate execution.&lt;/li&gt;
&lt;li&gt;It judges one transaction, not a session: it cannot see that a
harmless call is step 3 of a harmful sequence.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -s -X POST https://mintguard-psi.vercel.app/analyze \
  -H &lt;span class="s1"&gt;'content-type: application/json'&lt;/span&gt; \
  -d &lt;span class="s1"&gt;'{"chainId":56,"to":"0xb8164afefc53910d7a74cece15a60a9e0c86089e","data":"0xa0712d680000000000000000000000000000000000000000000000000000000000000001","value":"0"}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Wildcard submission goes in through the Agent Games dashboard before&lt;br&gt;
21 Nov 2026, 22:00 UTC. Judging is 23–30 Nov.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Draft status: ready to publish. Post on dev.to with the &lt;code&gt;#AgentGames&lt;/code&gt;&lt;br&gt;
tag; if cross-posted to X, also tag @ZKVProtocol.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>agentgames</category>
      <category>zkverify</category>
      <category>ai</category>
      <category>web3</category>
    </item>
  </channel>
</rss>
