<?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: GreyArch</title>
    <description>The latest articles on DEV Community by GreyArch (@axzss).</description>
    <link>https://dev.to/axzss</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%2F4253198%2F5f2761d0-0382-4d14-8d66-10bc6038f36d.jpg</url>
      <title>DEV Community: GreyArch</title>
      <link>https://dev.to/axzss</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/axzss"/>
    <language>en</language>
    <item>
      <title>I Built a Transaction Guard That Has to Prove Its Own Decisions</title>
      <dc:creator>GreyArch</dc:creator>
      <pubDate>Thu, 19 Nov 2026 07:12:06 +0000</pubDate>
      <link>https://dev.to/axzss/i-built-a-transaction-guard-that-has-to-prove-its-own-decisionsagentgames-8pj</link>
      <guid>https://dev.to/axzss/i-built-a-transaction-guard-that-has-to-prove-its-own-decisionsagentgames-8pj</guid>
      <description>&lt;p&gt;&lt;em&gt;Written for the zkVerify Agent Games Season 01 Creator Track. #AgentGames&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The signature is the attack surface
&lt;/h2&gt;

&lt;p&gt;On BNB Chain, new tokens and free mints show up every day. Every one of them asks you to sign something. Your wallet shows you a hex string and a button. You are supposed to decide, from that hex, whether the transaction is safe.&lt;/p&gt;

&lt;p&gt;Most people cannot. The failure modes are not exotic. They are the same three patterns, over and over:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;An &lt;code&gt;approve()&lt;/code&gt; call with the amount set to uint256 max. You meant to approve 100 tokens. You approved all of them, forever.&lt;/li&gt;
&lt;li&gt;A &lt;code&gt;setApprovalForAll(true)&lt;/code&gt; hidden inside a mint flow. One click and every NFT in the wallet can move.&lt;/li&gt;
&lt;li&gt;A contract call to an address with no code behind it, or a function selector nobody recognizes, that reverts only after you paid gas or worse, does exactly what it says and drains the wallet.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I have watched this from the other side. I run an opportunity hunter on BNB Chain: free mints, claims, airdrops. Every lead gets verified before anything is signed. Domain check, simulation, wallet preview, contract audit. The manual version of that process works, but it is slow and it does not scale. So I built an agent that does the screening and then proves it did the screening. That agent is Aegis, my entry for the Wildcard Track.&lt;/p&gt;

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

&lt;p&gt;Aegis is a public HTTPS endpoint. You send it a proposed transaction. It answers with a decision and a proof.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -X POST https://aegis-tx-guard.onrender.com/guard \
  -H &lt;span class="s1"&gt;'content-type: application/json'&lt;/span&gt; \
  -d &lt;span class="s1"&gt;'{"from":"0x...","to":"0x55d398326f99059fF775485246999027B3197955",
       "data":"0x095ea7b3...","value":"0"}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"decision"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"REJECT"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"reason_code"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"UNLIMITED_APPROVAL"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"checks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"c1"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"c2"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"c3"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"c4"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"c5"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"c6"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"proof"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s2"&gt;"...Groth16 proof..."&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"public_signals"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"0"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(The signals are &lt;code&gt;[ok, c1, c2, c3, c4, c5, c6, decision]&lt;/code&gt;. The guard fails fast: once check 2 fails, checks 3 to 6 are not run, so they read 0. The proof attests exactly the checks that ran and passed.)&lt;/p&gt;

&lt;p&gt;Six checks, all deterministic:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;VALID_REQUEST.&lt;/strong&gt; The addresses parse, the calldata is hex, the value is not negative.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NO_UNLIMITED_APPROVAL.&lt;/strong&gt; No &lt;code&gt;approve&lt;/code&gt; or &lt;code&gt;increaseAllowance&lt;/code&gt; to uint256 max, no &lt;code&gt;setApprovalForAll(true)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;KNOWN_SELECTOR.&lt;/strong&gt; Empty calldata (a plain transfer) or a selector from a short known-safe list: transfer, transferFrom, bounded approve, bounded increaseAllowance, no-arg mint and claim.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TARGET_HAS_CODE.&lt;/strong&gt; Any call with calldata must target an address that actually has bytecode (&lt;code&gt;eth_getCode&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NOT_BLOCKLISTED.&lt;/strong&gt; Target, approve spender, and transfer recipient are checked against a blocklist. The zero address is always blocked.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SIMULATION_OK.&lt;/strong&gt; The transaction is simulated with &lt;code&gt;eth_call&lt;/code&gt;. A revert is a rejection.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;APPROVE is issued only if all six pass. Anything unknown, unparseable, or unreachable is a REJECT. The guard fails closed on purpose. A missed good transaction costs you an opportunity. A passed bad transaction costs you the wallet.&lt;/p&gt;

&lt;h2&gt;
  
  
  The proof, and what it does not prove
&lt;/h2&gt;

&lt;p&gt;The interesting part is not the checklist. It is the proof. Every Aegis response carries a Groth16 proof (BN128, Circom 2.x, generated with snarkjs) over a small custom circuit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;template Guard() {
    signal input c1, c2, c3, c4, c5, c6;
    signal input decision;
    signal output ok;

    c1 * (c1 - 1) === 0;
    // ... every input constrained to be a bit ...
    decision * (decision - 1) === 0;

    // APPROVE only if every check passed.
    decision * (1 - c1) === 0;
    decision * (1 - c2) === 0;
    // ... one constraint per check ...
    ok &amp;lt;== decision;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The circuit is tiny (14 constraints). Its job is narrow: it binds the decision to the check results. You cannot generate a valid proof for an APPROVE when any check failed. The witness assertion fails first. I tested that directly: asking the prover for APPROVE with check 2 set to 0 throws, every time. A REJECT proof always works, because a rejection never claims anything passed.&lt;/p&gt;

&lt;p&gt;When a Kurier API key is configured, the proof is also submitted to zkVerify mainnet through Kurier and polled until Finalized. The verification key for the guard circuit is registered once; its hash is cached for later submissions. Without a key, proofs are still generated locally and returned, just not anchored on chain.&lt;/p&gt;

&lt;p&gt;Here is the part I want to be precise about, because it is the whole point of this competition: &lt;strong&gt;the proof binds the decision to the check results. It does not prove the checks are right about the world.&lt;/strong&gt; If my known-selector list is wrong, or the blocklist is stale, or the RPC lies, the proof still verifies. The check list is the security boundary, not the circuit. Anyone can read it in &lt;code&gt;src/decide.mjs&lt;/code&gt;. That is a feature, not a footnote. A guard whose rules are secret is just another thing to trust blindly.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the Gatekeeper taught me first
&lt;/h2&gt;

&lt;p&gt;Aegis is my second agent in this tournament. The first is a Proof Gatekeeper: a payment guard that receives signed tasks, decides APPROVE or REJECT under seven trap varieties, and proves each decision with the platform's own Groth16 circuit. It is live, and it passed its practice task (a RECIPIENT_MISMATCH trap, correctly rejected, proof verified, 3.1 seconds).&lt;/p&gt;

&lt;p&gt;The Gatekeeper's field guide contains one sentence that rewired how I think about this work: &lt;em&gt;"A proof can verify perfectly and still authorize the wrong action."&lt;/em&gt; Three of the seven traps carry proofs that genuinely verify. Wrong verification key, wrong recipient, expired condition. The math is right and the payment is still wrong. Verification is necessary. It is not sufficient. You have to check what was proven, not only whether verification succeeded.&lt;/p&gt;

&lt;p&gt;The tournament's own numbers make the same point from the other side. In Round 2 of Proof Gatekeeper, 272 tasks were issued, 129 agents answered, and zero proofs verified. Not one. The cryptography was not the hard part. The plumbing was: public endpoints, HMAC signatures on raw bodies, 60-second deadlines, key registration, finality polling. Aegis inherits all of that plumbing from the Gatekeeper build, and the lesson with it. I built the guard strict and the proof narrow on purpose, because the failure I am guarding against is not "the proof was invalid". It is "the proof was valid and the decision was still wrong".&lt;/p&gt;

&lt;h2&gt;
  
  
  How it is built
&lt;/h2&gt;

&lt;p&gt;Node 22, standard library only, plus snarkjs. The decision logic is pure and dependency-free so it can be tested without a network: the test harness spins up a mock JSON-RPC server and runs 16 checks. Ten decision cases (plain transfer, bounded approve, unlimited approve, &lt;code&gt;setApprovalForAll(true)&lt;/code&gt;, unknown selector, call to an address with no code, transfer to the zero address, blocklisted target, reverted simulation, malformed request), three proof cases (an APPROVE proof verifies, an APPROVE with a failed check cannot be proven, a REJECT proof verifies), and three live-server smoke tests against the real HTTP endpoint.&lt;/p&gt;

&lt;p&gt;The repo is public: &lt;code&gt;github.com/axzss/aegis-tx-guard&lt;/code&gt;. It deploys to Render's free tier with a &lt;code&gt;render.yaml&lt;/code&gt; blueprint, health check on &lt;code&gt;/health&lt;/code&gt;, and a keep-alive ping because free services sleep after 15 minutes idle. No secrets are committed; the only configuration is an RPC URL, an optional blocklist, and an optional Kurier key.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it is for
&lt;/h2&gt;

&lt;p&gt;The honest use case is narrow: anyone about to sign a transaction gets a pre-sign verdict with a proof attached, instead of trusting hex. Wallets and agent frameworks can call it before presenting a signature prompt. Mint and claim hunters can screen a contract call before the wallet preview. The guard does not hold funds, does not sign anything, and cannot move money. It only says yes or no, and proves the yes followed from the checks.&lt;/p&gt;

&lt;p&gt;What it cannot do matters too. It cannot judge a contract it has never seen. Unknown selectors are rejected, which means legitimate but unlisted calls need a list update. Simulation is only as good as the RPC answering it. A stale blocklist is a hole. I documented all of that in the repo because a security tool that hides its limits is worse than no tool at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this belongs in the Wildcard Track
&lt;/h2&gt;

&lt;p&gt;The Wildcard Track asks for one thing: an agent that helps someone do something real. A transaction guard does that in the most literal way possible. It stands between a person and the most expensive button on their screen, and it refuses to wave through anything it cannot explain. The zkVerify part is optional for the track and I used it anyway, because a guard that cannot prove its own decisions is asking for exactly the kind of blind trust it exists to remove.&lt;/p&gt;

&lt;p&gt;If you build agents that touch money, build them so their decisions can be checked. Not just verified. Checked.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Aegis is my Wildcard Track entry for zkVerify Agent Games Season 01 (21 Oct to 21 Nov 2026, judging 22 to 30 Nov). The Proof Gatekeeper agent it builds on is live at &lt;code&gt;https://zkverify-gatekeeper-agent.onrender.com&lt;/code&gt;. Both repos are public under &lt;code&gt;github.com/axzss&lt;/code&gt;. #AgentGames&lt;/em&gt;&lt;/p&gt;

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