<?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: Edy Cu</title>
    <description>The latest articles on DEV Community by Edy Cu (@edycutjong).</description>
    <link>https://dev.to/edycutjong</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%2F3911089%2Fb24966e4-839d-4c19-8e2d-16c6a5c8838c.jpeg</url>
      <title>DEV Community: Edy Cu</title>
      <link>https://dev.to/edycutjong</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/edycutjong"/>
    <language>en</language>
    <item>
      <title>I aimed for 90% form-fill accuracy on-device and got 80.7%: what a code gate around Gemini Nano taught me</title>
      <dc:creator>Edy Cu</dc:creator>
      <pubDate>Wed, 25 Nov 2026 19:54:27 +0000</pubDate>
      <link>https://dev.to/edycutjong/i-aimed-for-90-form-fill-accuracy-on-device-and-got-807-what-a-code-gate-around-gemini-nano-3937</link>
      <guid>https://dev.to/edycutjong/i-aimed-for-90-form-fill-accuracy-on-device-and-got-807-what-a-code-gate-around-gemini-nano-3937</guid>
      <description>&lt;p&gt;Dewi (an invented shop owner) takes orders in chat. Every evening she retypes each message into a courier booking form: name, phone, address, a postal code. One wrong digit and a parcel comes back. Pasting the message into a cloud chatbot would fix the typing and send a stranger's name, phone and address to a third party.&lt;/p&gt;

&lt;p&gt;So I built &lt;a href="https://pastewise.edycu.dev" rel="noopener noreferrer"&gt;Pastewise&lt;/a&gt;: paste the message, press one button, and the form fills &lt;strong&gt;on the laptop&lt;/strong&gt; with Gemini Nano in Chrome, called through Firebase AI Logic. This post is about the three numbers I aimed for, missed, and published anyway. Source: &lt;a href="https://github.com/edycutjong/pastewise" rel="noopener noreferrer"&gt;github.com/edycutjong/pastewise&lt;/a&gt; (Apache-2.0) · &lt;a href="https://youtu.be/WShVNHWsBV0" rel="noopener noreferrer"&gt;2:59 demo video&lt;/a&gt; · &lt;a href="https://devpost.com/software/pastewise" rel="noopener noreferrer"&gt;Devpost entry&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The model is not allowed to decide what's right
&lt;/h2&gt;

&lt;p&gt;A small on-device model will sometimes write a value that looks right and isn't. A wrong value in a blue "done" box costs more than an empty box, so acceptance is code, not model confidence. A value is accepted only if it appears in the pasted text and passes the field's format check. Otherwise the box stays amber with a reason ("two numbers in your text — pick one").&lt;/p&gt;

&lt;p&gt;The on-device call has no cloud fallback by construction:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;deviceModel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;JsonSchema&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;GenerativeModel&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;getGenerativeModel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;firebase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ai&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;InferenceMode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;ONLY_ON_DEVICE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;onDeviceParams&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;createOptions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;DEVICE_CREATE_OPTIONS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;promptOptions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;responseConstraint&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;schema&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&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 &lt;code&gt;schema&lt;/code&gt; is built from the live form (a &lt;code&gt;&amp;lt;select&amp;gt;&lt;/code&gt; becomes an enum), so the model can only emit that form's fields. With Nano on the laptop, the cloud (&lt;code&gt;ONLY_IN_CLOUD&lt;/code&gt;) has one job: read the &lt;strong&gt;empty&lt;/strong&gt; form and write hints for boxes labelled &lt;code&gt;CNEE&lt;/code&gt; or &lt;code&gt;RMKS&lt;/code&gt;. It never sees the message. A laptop without Nano gets a notice and a sheet showing the exact message that would leave; nothing is sent until the person presses &lt;strong&gt;Send this one&lt;/strong&gt;, and then that one paste goes through &lt;code&gt;PREFER_ON_DEVICE&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three bars, three misses
&lt;/h2&gt;

&lt;p&gt;The targets were strict field accuracy at least 90%, wrong value shown at most 3%, warm median fill at most 2 s. The held-out set is 45 message/form pairs, written and hashed before any run on it, run once on the release build (the hints-on column ran with one uncommitted edit to the /bench page only, marked "dirty" there), three repeats, one M1 Max with Chrome 157:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Hints off&lt;/th&gt;
&lt;th&gt;Hints on (dirty, see below)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Strict field accuracy&lt;/td&gt;
&lt;td&gt;80.7% (80.3–81.5)&lt;/td&gt;
&lt;td&gt;81.5% (80.0–82.6)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Wrong value shown, all boxes&lt;/td&gt;
&lt;td&gt;5.9%&lt;/td&gt;
&lt;td&gt;5.3%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Wrong shown in name/phone/address/postal boxes&lt;/td&gt;
&lt;td&gt;2.0%&lt;/td&gt;
&lt;td&gt;1.3%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Warm p50 / p95&lt;/td&gt;
&lt;td&gt;2.34 s / 2.94 s&lt;/td&gt;
&lt;td&gt;2.40 s / 2.93 s&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;All three bars missed. Most of the 5.9% is free text (notes, remarks): any phrase that really is in the message passes the "in your text" check, and a strict comparison with one clerk's wording marks 27–38% of those wrong. In the boxes where a wrong value does damage it is 2.0%. The set is small, so the ranges are wide.&lt;/p&gt;

&lt;h2&gt;
  
  
  The wall: "found in your text" is not "in the right box"
&lt;/h2&gt;

&lt;p&gt;The gate catches invention, not misplacement. On the 180-pair bench the model picked the sender, a kinship word or an organisation as the recipient name: 10.6% wrong on one form, 8.3% on another. Both names were in the text, so the gate accepted them. My rule: a name, phone, address or postal box above 5% wrong-shown becomes always-amber. The release gate now never shows a recipient name as "found in your text":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;ALWAYS_CHECK_KEYS&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;ReadonlySet&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"cnee_nm"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// in gateField: if (r.state === "found" &amp;amp;&amp;amp; ALWAYS_CHECK_KEYS.has(field.key)) return amber("check_by_hand", ...)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The cost is measured and on the &lt;a href="https://pastewise.edycu.dev/bench/" rel="noopener noreferrer"&gt;/bench&lt;/a&gt; page: re-gating the same bench outputs offline takes wrong-shown in the four box types where a wrong value does damage (name, phone, address, postal code) from 2.9% to 1.0% and raises the share left amber from 7.9% to 15.6%.&lt;/p&gt;

&lt;h2&gt;
  
  
  The cloud teacher barely helped
&lt;/h2&gt;

&lt;p&gt;I expected the cloud-written hints for cryptic labels to add about 10 points on the hardest form. On the bench they moved strict accuracy from 78.28% to 78.39%. I report it as an experiment, not a feature.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I check "customer data never left"
&lt;/h2&gt;

&lt;p&gt;A receipt on the page counts words and numbers (four characters or more) from the paste found in any request the page's own code makes. A recorded browser network log is in the repo, and a planted canary request (a same-origin fetch carrying a demo paste) is caught by both the log and the in-page ledger. Separately, with Nano unavailable and consent given, the screen showed 682 bytes (a retry sent the 341-byte message twice) and Chrome's wire log agreed. Re-run five times with a fresh profile, 0 AI requests went out before the Yes in 5 of 5; the 4 runs that reached the cloud showed 341 bytes and 341 were on the wire, and the fifth hit an App Check throttle and sent nothing. On the hosted page, 4 on-device fills made 0 requests and 0 paste-word hits. Blind spots are stated: words shorter than four letters and encoded text such as base64 are not matched, and it measures this page's requests, not the browser.&lt;/p&gt;

&lt;h2&gt;
  
  
  Small things that mattered
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Nano can stall under load, so each batch has a 10 s default timeout (20 s on the first attempt of the first fill of a session) and one retry. A stalled fill leaves its boxes amber and says "timed out" instead of hanging.&lt;/li&gt;
&lt;li&gt;Every fill carries a badge from &lt;code&gt;response.inferenceSource&lt;/code&gt;, so a visitor can see where it ran.&lt;/li&gt;
&lt;li&gt;Two phone numbers in one message (an old dead one and a new one) always leave the box amber, whichever number the model picked. A model cannot guess between two numbers, so it is not asked to.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Limits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Chrome desktop with Gemini Nano only for the on-device path; a hosted web app, not an extension, so it fills its own forms and not other sites.&lt;/li&gt;
&lt;li&gt;Synthetic data, one machine, three repeats, mostly English messages.&lt;/li&gt;
&lt;li&gt;The Content-Security-Policy still allows &lt;code&gt;unsafe-inline&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Try it (free, no login): &lt;a href="https://pastewise.edycu.dev" rel="noopener noreferrer"&gt;pastewise.edycu.dev&lt;/a&gt;. Tests: 128 unit and 18 browser, plus 5 against the live URL, all run from the repo. (The hints-on column ran with one uncommitted edit, to the /bench page only; the prompt and the gate were unchanged, and the run file records &lt;code&gt;srcDirty: true&lt;/code&gt;.) The Devpost entry for #BuildHybridAI is at &lt;a href="https://devpost.com/software/pastewise" rel="noopener noreferrer"&gt;https://devpost.com/software/pastewise&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>webdev</category>
      <category>ai</category>
      <category>privacy</category>
    </item>
    <item>
      <title>Nano couldn't say "partly supported" (21/30), so I changed its job</title>
      <dc:creator>Edy Cu</dc:creator>
      <pubDate>Wed, 25 Nov 2026 19:54:26 +0000</pubDate>
      <link>https://dev.to/edycutjong/nano-couldnt-say-partly-supported-2130-so-i-changed-its-job-o8m</link>
      <guid>https://dev.to/edycutjong/nano-couldnt-say-partly-supported-2130-so-i-changed-its-job-o8m</guid>
      <description>&lt;p&gt;I built Footing, a web app that opens every link an AI answer cites and checks whether the page says what the sentence claims. The hybrid plan was simple: Gemini Nano triages each readable page on your laptop, and the cloud handles the rest. My first version gave Nano the whole verdict. That was wrong, and I measured how wrong before building further.&lt;/p&gt;

&lt;p&gt;Live: &lt;a href="https://footing.edycu.dev" rel="noopener noreferrer"&gt;https://footing.edycu.dev&lt;/a&gt; · Demo video (2:48): &lt;a href="https://youtu.be/1okeD78D7Nw" rel="noopener noreferrer"&gt;https://youtu.be/1okeD78D7Nw&lt;/a&gt; · Code (Apache-2.0): &lt;a href="https://github.com/edycutjong/footing" rel="noopener noreferrer"&gt;https://github.com/edycutjong/footing&lt;/a&gt; · Devpost: &lt;a href="https://devpost.com/software/footing" rel="noopener noreferrer"&gt;https://devpost.com/software/footing&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;AI answers come with links, and people treat the link as proof. Often the page is real and on topic but doesn't say what the sentence says: a figure changed, a clause added, a neighbouring fact. Nobody opens eight links per answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  The first design, and the number that killed it
&lt;/h2&gt;

&lt;p&gt;Nano would answer one of three things per (claim, passage) pair: &lt;code&gt;SUPPORTS&lt;/code&gt;, &lt;code&gt;PARTIAL&lt;/code&gt;, &lt;code&gt;NOT_SUPPORTED&lt;/code&gt;, with the quote it relied on. Before writing any UI I labelled 30 claims against real fetched pages and ran Nano on them in desktop Chrome (157, M1 Max).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;v1 prompt: &lt;strong&gt;21/30 = 70%&lt;/strong&gt; on the three-way verdict (raw rows in &lt;code&gt;evidence/p0c/&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My bar was 80%. Nano failed it. I read that as a task problem, not a wording problem. The graded middle, "says part of it", is exactly where a small model drifts.&lt;/p&gt;

&lt;h2&gt;
  
  
  The re-scope: binary triage on device, the cloud decides "partial"
&lt;/h2&gt;

&lt;p&gt;The same run, cut to a binary question (does any passage support the claim?), scored &lt;strong&gt;24/30&lt;/strong&gt;. That is a post-hoc cut of the same 30 claims, so it is not held-out, and I say so everywhere. So Nano's job became triage. In Firebase AI Logic that is &lt;code&gt;PREFER_ON_DEVICE&lt;/code&gt; with a &lt;code&gt;responseConstraint&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;triageModel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;FootingConfig&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"PREFER_ON_DEVICE"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"ONLY_ON_DEVICE"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;GenerativeModel&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;getGenerativeModel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;firebase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ai&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;mode&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"ONLY_ON_DEVICE"&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="nc"&gt;InferenceMode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;ONLY_ON_DEVICE&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;InferenceMode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;PREFER_ON_DEVICE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;onDeviceParams&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;createOptions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;TEXT_EN&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;promptOptions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;responseConstraint&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;triageConstraint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;quoteMaxChars&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;inCloudParams&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;triageCloudModel&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;generationConfig&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;responseMimeType&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"application/json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;responseSchema&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;TRIAGE_SCHEMA_CLOUD&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;temperature&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="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;CLOUD_REQUEST&lt;/span&gt;&lt;span class="p"&gt;)&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;And the three-way judgement moved to a cloud-only instance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;judgeModel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;FootingConfig&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;GenerativeModel&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;getGenerativeModel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;firebase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ai&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;InferenceMode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;ONLY_IN_CLOUD&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;inCloudParams&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;judgeModel&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;generationConfig&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;responseMimeType&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"application/json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;responseSchema&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;VERDICT3_SCHEMA&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;temperature&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="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;CLOUD_REQUEST&lt;/span&gt;&lt;span class="p"&gt;)&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 rule that fell out: Nano's &lt;code&gt;SUPPORTS&lt;/code&gt; is never final. Every Nano "yes" escalates to the cloud, which checks whether the source says all of the sentence or only part. A Nano "no" with no quote is settled on the laptop and shown as "not found on device (unconfirmed)", with one tap to confirm. A "no" that quotes related text escalates like a "yes". PDFs go to the cloud anyway because PDF input is cloud-only in AI Logic. JavaScript-only pages go there too, because there is no fetched text for Nano to read and the URL context tool is cloud-only. Those pages are always shown as &lt;code&gt;UNVERIFIED&lt;/code&gt;, since there is no source text to check the quote against.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code has the last word
&lt;/h2&gt;

&lt;p&gt;Models invent quotes. So whatever either model quotes must appear verbatim in the text it was given, and inside one segment, so a quote can't be stitched across two passages:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;gate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;quote&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;modelInput&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Given&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;boolean&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;normalize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;quote&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="no"&gt;MIN_QUOTE_CHARS&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nf"&gt;quoteHeld&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;quote&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;modelInput&lt;/span&gt;&lt;span class="p"&gt;)&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;If the gate fails, the verdict is &lt;code&gt;UNVERIFIED&lt;/code&gt;, never &lt;code&gt;SUPPORTS&lt;/code&gt;. A SUPPORTS or PARTIAL verdict is shown only if its quote passes. The gate proves the quoted words are in the source, not that the model read them correctly: on the fresh 20, 6 wrong cloud verdicts still carried a quote that was found.&lt;/p&gt;

&lt;h2&gt;
  
  
  Honest numbers
&lt;/h2&gt;

&lt;p&gt;On a fresh held-out set of 20 claims (labelled and committed before any model saw them), measured on an M1 Max with Chrome 157:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Nano binary triage&lt;/th&gt;
&lt;th&gt;Cloud judge (3-class)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;fresh 20, held-out&lt;/td&gt;
&lt;td&gt;13/20 = 65%&lt;/td&gt;
&lt;td&gt;14/20 = 70%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;original 30 (not held-out)&lt;/td&gt;
&lt;td&gt;24/30 = 80%&lt;/td&gt;
&lt;td&gt;23/30 = 76.7%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;On the fresh 20, Nano settled only 1 pair on the laptop and escalated 19. On the original 30 it settled 8 and escalated 22. So the honest summary is: the laptop does a cheap first pass, the cloud does most of the deciding, and code verifies every quote. Latency per claim from a separate benchmark run (20 held-out claims x 2 reps per route, source fetching excluded, the cloud judge reading a 24,000-character window): on device p50 1699 ms, p95 2067 ms; cloud p50 4095 ms, p95 11476 ms. End to end the hybrid is not faster: an escalated citation pays for both calls. Raw rows are in &lt;code&gt;evidence/&lt;/code&gt; in the repo; &lt;a href="https://footing.edycu.dev/eval" rel="noopener noreferrer"&gt;/eval&lt;/a&gt; lists the accuracy and settle numbers, and the latency rows are in &lt;code&gt;evidence/bench.json&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Footing checks citation faithfulness, not truth. It never searches for a better answer.&lt;/li&gt;
&lt;li&gt;20 and 30 claims are small sets. Treat the percentages as indicative.&lt;/li&gt;
&lt;li&gt;On-device inference needs desktop Chrome with Nano and about 22 GB free disk. Most readers will see the cloud path, which is badged separately, with a meter showing how many citations a Nano laptop would have read on-device first.&lt;/li&gt;
&lt;li&gt;The first on-device call starts a model download. In Auto mode Footing's router checks citations in the cloud while it runs, and the page shows the download progress. "On-device only" waits for the download instead.&lt;/li&gt;
&lt;li&gt;When a citation goes to the cloud, the sentence, the three best-matching passages and up to the first 24,000 characters of the page text are sent to a Gemini model through Firebase AI Logic. The fetch proxy itself never calls a model.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Open &lt;a href="https://footing.edycu.dev" rel="noopener noreferrer"&gt;https://footing.edycu.dev&lt;/a&gt; in desktop Chrome, press &lt;strong&gt;Check sources&lt;/strong&gt;, and click any citation to see your sentence beside the source's own words. If you find a citation it gets wrong, that is exactly the feedback I want.&lt;/p&gt;

&lt;p&gt;One more limit: Footing caps each answer at 10 automatic cloud checks (a Remote Config setting), and the sample answer I ship has 9 citations, so all 9 run without a tap. A longer answer would leave the extra citations behind a tap. I'd rather say that than hide it.&lt;/p&gt;

&lt;p&gt;The 2:48 demo video is at &lt;a href="https://youtu.be/1okeD78D7Nw" rel="noopener noreferrer"&gt;https://youtu.be/1okeD78D7Nw&lt;/a&gt;, and the Devpost entry for #BuildHybridAI is at &lt;a href="https://devpost.com/software/footing" rel="noopener noreferrer"&gt;https://devpost.com/software/footing&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>webdev</category>
      <category>ai</category>
      <category>javascript</category>
    </item>
    <item>
      <title>I let a model read CoinMarketCap's migration notices, and made code decide the verdict</title>
      <dc:creator>Edy Cu</dc:creator>
      <pubDate>Mon, 23 Nov 2026 20:53:59 +0000</pubDate>
      <link>https://dev.to/edycutjong/i-let-a-model-read-coinmarketcaps-migration-notices-and-made-code-decide-the-verdict-50dg</link>
      <guid>https://dev.to/edycutjong/i-let-a-model-read-coinmarketcaps-migration-notices-and-made-code-decide-the-verdict-50dg</guid>
      <description>&lt;p&gt;In the Successor repo, a language model reads the notice and code writes the verdict. I tried the other way first and could not defend it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The sentence that moves money
&lt;/h2&gt;

&lt;p&gt;CoinMarketCap records what happened to a renamed or migrated coin in a free-text &lt;code&gt;notice&lt;/code&gt; on &lt;code&gt;/v2/cryptocurrency/info?aux=notice&lt;/code&gt;. For Clearpool it says the coin "has rebranded to Clearpool (CLEAR) and undergone a 1:1 swap" and links the old and new contracts. Nothing in the API turns that into a successor id, a contract to compare, or a ratio to test. On a 2026-11-22 scan of the active top 2,000, 161 coins carry a notice, and 141 of those are migration-type by a regex classification.&lt;/p&gt;

&lt;p&gt;A holder wants one answer: swap, sell the old token, or write it off. That is &lt;a href="https://successor.edycu.dev" rel="noopener noreferrer"&gt;Successor&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flkhvwhxfqevwtyis562r.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flkhvwhxfqevwtyis562r.gif" alt="Successor on the live site: type AGIX, the agent proposes FET, code checks the ratio, SWAP (live re-run 2026-11-23 13:53 UTC, slowed)" width="600" height="530"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Split the job: the model proposes, code decides
&lt;/h2&gt;

&lt;p&gt;An LLM is good at reading the sentence. It is a bad judge of whether the sentence is true. So the agent is two parts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Reader&lt;/strong&gt; (Qwen &lt;code&gt;qwen4-max&lt;/code&gt;) turns the notice into structured proposals. The schema forces every field to carry the exact sentence it came from:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="s2"&gt;"evidence_quote"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"verbatim substring of the source text that states the value"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&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;A field with no verbatim quote is dropped. If the notice does not state the ratio, the Reader may follow the notice's own announcement link and read that page too (URL must appear verbatim in the notice, allow-listed, peer-checked per hop).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Inspector&lt;/strong&gt; is plain Python. It resolves the successor to a CMC id, compares the quoted contract with CMC's &lt;code&gt;platform.token_address&lt;/code&gt;, tests the stated ratio against CMC prices on the event date, values "swap" against "sell old" on &lt;code&gt;quotes/latest&lt;/code&gt;, and asks &lt;code&gt;market-pairs/latest&lt;/code&gt; whether the old token still trades. Then one function decides:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;decide&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Facts&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Decision&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;c2&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"refuted"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;Decision&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;NOT_VERIFIABLE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"R5"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"successor refuted by CMC's data: {f.c2_reason}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Eight ordered rules (R3 to R10) in this function, plus R1 and R2 for no notice and an unresolved holding in the flow, and no model call anywhere in them. A failed contract or ratio check blocks SWAP; the rules then pick NOT VERIFIABLE, SELL OLD or WRITE OFF and say why.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it said about CPOOL
&lt;/h2&gt;

&lt;p&gt;On a capture at 2026-11-22 03:49 UTC the old CPOOL token was worth 15.7% more than the 1:1 swap, so the verdict was SELL OLD. The notice implies a swap; CMC's own prices say otherwise. Captures later that day read 7.3% (05:58 UTC) and 10.4% (06:20 UTC), and at 23:43 UTC the margin was 4.6%, under the 5% that SELL OLD needs, so the same lookup read SWAP and said why. Verdicts move with the market, so every one on screen carries its capture time and a receipt: endpoint, parameters, credits, the verbatim CMC JSON, the model's prompt and raw output, and a curl.&lt;/p&gt;

&lt;p&gt;Reproduce it yourself:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -N &lt;span class="s1"&gt;'https://successor.edycu.dev/api/lookup?q=CPOOL&amp;amp;qty=10000'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  When the notice does not say enough
&lt;/h2&gt;

&lt;p&gt;AGIX's notice announces a merger into the Artificial Superintelligence Alliance but names no ratio. The Reader cannot invent one, because a field without a verbatim quote is dropped. In the captured run it follows the fetch.ai link the notice itself points to before its first proposal, reads 0.433350 FET per AGIX there, and the Inspector then checks that figure against CMC's prices at the event date (a difference of -0.6%, which confirms it). Ten thousand AGIX valued by a price tracker was $5,925 (2026-11-22 03:49 UTC capture) on a token that trades on $0 volume; at the swap ratio it was $463 of FET. That gap is the reason to check rather than trust the tracker's number.&lt;/p&gt;

&lt;h2&gt;
  
  
  Making the model's input hostile on purpose
&lt;/h2&gt;

&lt;p&gt;The notice and the pages it links are untrusted text, so the evals include a case where the text tries to instruct the model. The expected result is the ordinary verdict, and that is what it produces, because the model never decides one. Misread ratios and symbols are in the eval set too: the checks catch them offline and the verdict falls back to NOT VERIFIABLE. The link fetcher only follows URLs that appear verbatim in the notice, re-checks the peer address at every hop, and has a hard deadline.&lt;/p&gt;

&lt;h2&gt;
  
  
  The honest part
&lt;/h2&gt;

&lt;p&gt;Most notices cannot be confirmed. On the top-2,000 census (captured 2026-11-22), 161 coins carry a notice: 130 end NOT VERIFIABLE, 26 NOTHING TO DO, 3 WRITE OFF, 2 SWAP, 0 SELL OLD. Saying "I cannot verify this" is most of what the product does, and I think that is the right shape for something people may act on. The wording is "what CMC's data supports", never advice, and values exclude fees, gas and slippage.&lt;/p&gt;

&lt;p&gt;Other things that did not go to plan:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;CMC quirks, measured:&lt;/strong&gt; checksummed-address lookups on &lt;code&gt;info?address=&lt;/code&gt; return a misleading 400, &lt;code&gt;date_added&lt;/code&gt; is inherited from the old coin, and &lt;code&gt;convert=EUR&lt;/code&gt; scales supply and percent changes. Write-up in the repo's &lt;code&gt;docs/DX-REPORT.md&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Eval caveat:&lt;/strong&gt; the 10 counted eval cases replay recorded CMC rows and recorded Reader output. They test the checks, not the live model.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CI:&lt;/strong&gt; GitHub Actions never started while the repo was private (billing), so the early gates ran locally (&lt;code&gt;docs/proof/gates/&lt;/code&gt;). Since the repo went public the six-stage pipeline runs on every push to main and every pull request: on main it tests a staged Vercel deployment before promoting it, and a green run cuts a semantic release for the commit it tested.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Numbers
&lt;/h2&gt;

&lt;p&gt;88 tests (82% coverage), mypy/ruff/pip-audit/gitleaks clean. Cached lookup p50 0.796 s / p95 1.363 s (n=12); cold Reader read p50 15.44 s / p95 21.45 s (n=6), both 2026-11-22. With the CMC key removed, no verdict is produced, by design.&lt;/p&gt;

&lt;p&gt;Live: &lt;a href="https://successor.edycu.dev" rel="noopener noreferrer"&gt;https://successor.edycu.dev&lt;/a&gt; · Code: &lt;a href="https://github.com/edycutjong/successor" rel="noopener noreferrer"&gt;https://github.com/edycutjong/successor&lt;/a&gt; · Demo video (2:46): &lt;a href="https://youtu.be/O4n1ZgZMT7I" rel="noopener noreferrer"&gt;https://youtu.be/O4n1ZgZMT7I&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Built for CoinMarketCap's Build with CMC: API Hackathon, Round 2 (AI Agents and Automation track): &lt;a href="https://dorahacks.io/build/51741" rel="noopener noreferrer"&gt;DoraHacks BUIDL&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>ai</category>
      <category>webdev</category>
      <category>python</category>
    </item>
    <item>
      <title>I retracted my own headline: tokenised-stock supply doesn't show inflow until the chain agrees</title>
      <dc:creator>Edy Cu</dc:creator>
      <pubDate>Mon, 23 Nov 2026 20:53:50 +0000</pubDate>
      <link>https://dev.to/edycutjong/i-retracted-my-own-headline-tokenised-stock-supply-doesnt-show-inflow-until-the-chain-agrees-3a5d</link>
      <guid>https://dev.to/edycutjong/i-retracted-my-own-headline-tokenised-stock-supply-doesnt-show-inflow-until-the-chain-agrees-3a5d</guid>
      <description>&lt;p&gt;&lt;em&gt;I'm retracting my own headline: "tokenised stock supply is up, so money is flowing in" is a claim you can't make from the number alone. Here is what it took to say something checkable instead.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Live: &lt;a href="https://netmint.edycu.dev" rel="noopener noreferrer"&gt;https://netmint.edycu.dev&lt;/a&gt; · Code: &lt;a href="https://github.com/edycutjong/netmint" rel="noopener noreferrer"&gt;https://github.com/edycutjong/netmint&lt;/a&gt; · Demo video (2:45): &lt;a href="https://youtu.be/pdAQCRNSXoA" rel="noopener noreferrer"&gt;https://youtu.be/pdAQCRNSXoA&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fllh31d5kl3wdhanw7j05.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fllh31d5kl3wdhanw7j05.gif" alt="NetMint on the live site: the judge link opens the pinned NVDAB 30-day lookup, REAL INFLOW vs NOT VERIFIABLE, then the receipts" width="600" height="338"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The question
&lt;/h2&gt;

&lt;p&gt;CoinMarketCap lists tokenised stocks (NVIDIA, AMD and others wrapped as tokens on BNB Chain, Ethereum, Solana) with a daily circulating supply. Issuers mint tokens when someone creates them and burn them on redemption, so that supply series is a public trace of the primary market. An ETF flow table shows creations and redemptions in dollars. CMC shows the supply, but not the dollars created or redeemed.&lt;/p&gt;

&lt;p&gt;So I built NetMint: it turns the daily supply history into net creation and redemption in USD per wrapper, and stamps one verdict.&lt;/p&gt;

&lt;p&gt;On 2026-11-21 the case that made me stop and re-check was NVDAB (bStocks, BNB Chain). Over 30 days (2026-10-22 to 2026-11-21) CMC's supply went ×7.1 while the price fell 41%. That is +$202.83M of net creation at market price. Impressive, and also exactly the kind of number that can be an artefact.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wall 1: my first wording was wrong
&lt;/h2&gt;

&lt;p&gt;My first draft called this "inflow from holders". To check it I sampled the mint on the largest step days. Every sampled mint is an ERC-20 &lt;code&gt;Transfer&lt;/code&gt; from the zero address, and all 7 mints I sampled went to the same recipient. That is issuer-level creation. It says nothing about who bought. The app now says "net creation", the way an ETF flow table counts creations, and the verdict subline reads "issuer-level net creation, not buyer data".&lt;/p&gt;

&lt;h2&gt;
  
  
  Wall 2: CMC's supply is a sum over chains
&lt;/h2&gt;

&lt;p&gt;The first chain check read &lt;code&gt;totalSupply()&lt;/code&gt; on one chain and compared it with CMC. On NVDAon the BNB Chain leg alone showed 44% of CMC's supply, which looked like a data error. It wasn't: CMC's figure is the sum across chains. So the check sums every readable leg at the day boundaries (BNB Chain and Ethereum), and when most of a wrapper's supply sits on a chain with no historical supply source, the honest answer is not a verdict.&lt;/p&gt;

&lt;p&gt;Result for NVDAB: CMC's supply rose +1,209,739 units, the chain's &lt;code&gt;totalSupply&lt;/code&gt; rose +1,216,792, which is +0.6% apart against a ±10% tolerance. The 5 largest step days matched too.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wall 3: an API that scales your history
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;/v2/cryptocurrency/quotes/historical&lt;/code&gt; with &lt;code&gt;convert=&amp;lt;fiat&amp;gt;&lt;/code&gt; multiplies &lt;code&gt;circulating_supply&lt;/code&gt; by the exchange rate and scales &lt;code&gt;percent_change_24h&lt;/code&gt; the same way, while &lt;code&gt;quotes/latest&lt;/code&gt; with &lt;code&gt;convert=IDR&lt;/code&gt; is correct. The raw bodies are in the repo under &lt;code&gt;docs/proof/spike/convert-bug/&lt;/code&gt;. NetMint asks in USD only.&lt;/p&gt;

&lt;h2&gt;
  
  
  The verdict is fixed code
&lt;/h2&gt;

&lt;p&gt;No model decides it. The precedence is a plain function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// lib/flow/verdict.ts (excerpt)&lt;/span&gt;
&lt;span class="c1"&gt;// 5. directional verdicts&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;metrics&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;net&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
  &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;verdict&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'REAL_INFLOW'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reason&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;mint&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;reason&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;verdict&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'OUTFLOW'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reason&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;mint&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;reason&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;and it is only reachable after the chain check passed. The label stays REAL INFLOW because it means verified net creation at issuer level, which the subline spells out; it never claims who bought. An invariant test asserts that REAL INFLOW or OUTFLOW implies a passing mint check. The other outcomes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;RECOUNT&lt;/strong&gt;: CMC's supply moved and the chain did not.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NOT VERIFIABLE&lt;/strong&gt;: the move may sit on a chain nobody reads (Solana, Arbitrum, Base), or the check cannot certify it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;FLAT&lt;/strong&gt;: below the materiality threshold, not put to trial.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;NVDAX, a Backed/xStocks NVIDIA wrapper whose CMC supply rose ×3.98 over the same 30 days, comes out NOT VERIFIABLE: chain coverage 14.5% of CMC's total supply, with the rest on chains NetMint cannot read (Solana and others). Refusing is a feature.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the numbers look like
&lt;/h2&gt;

&lt;p&gt;Over 30 days on the top 20 underlyings (152 wrappers) the checks verified 6 REAL INFLOW and 3 OUTFLOW, flagged 12 RECOUNT and returned NOT VERIFIABLE for 107. One live lookup (NVDA, 30 days) is 5 CMC calls and 7 credits: p50 2.0 s, p95 2.6 s over 20 runs. 201 tests pass, and &lt;code&gt;npm run verify:flows&lt;/code&gt; re-derives 304 leaderboard rows from the stored CMC bodies with 0 differences. The receipt drawer in the app shows every CMC call verbatim: endpoint, parameters, UTC time, credit cost, raw JSON.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reproduce it without trusting me
&lt;/h2&gt;

&lt;p&gt;Everything above is read-only: no wallet, no transactions from me. Clone the repo, put a CMC key in &lt;code&gt;.env.local&lt;/code&gt;, and run &lt;code&gt;npm run demo -- NVDA&lt;/code&gt;. It makes 5 calls (7 credits, about 2 seconds) and prints the verdict with its proving rows: the CMC step, the chain step, and the mint transaction on BNB Chain (&lt;code&gt;0xa239f8886f2b7a4a61daa2787b0b53e58715c2c0dcd8d8f4ef84c8dfea15266c&lt;/code&gt;). If you don't have a key, &lt;code&gt;npm run verify:flows&lt;/code&gt; replays the committed CMC bodies from 2026-11-21 offline and has to match the leaderboard row for row. And &lt;code&gt;npm run verify:offline&lt;/code&gt; unplugs the network and must fail with a transport error, not print a verdict, so a stale cache can't pass for a live check.&lt;/p&gt;

&lt;p&gt;The window moves. The figures in this post are dated 2026-11-21; a fresh run will print a different hero number, and that is the point of printing the window and capture time beside every figure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Honest limits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The window sat inside a market stress period; read ×7.1 as a measurement of that window, not a trend.&lt;/li&gt;
&lt;li&gt;Dollars are at CMC's market price, not money that changed hands.&lt;/li&gt;
&lt;li&gt;Circulating supply has no per-chain split, so wrappers on unread chains stay NOT VERIFIABLE.&lt;/li&gt;
&lt;li&gt;It is not investment advice.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Try it: type a ticker at &lt;a href="https://netmint.edycu.dev" rel="noopener noreferrer"&gt;https://netmint.edycu.dev&lt;/a&gt; and open the receipt drawer. Source and evidence: &lt;a href="https://github.com/edycutjong/netmint" rel="noopener noreferrer"&gt;https://github.com/edycutjong/netmint&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Built for CoinMarketCap's Build with CMC: API Hackathon, Round 2 (Real World Assets track): &lt;a href="https://dorahacks.io/build/51745" rel="noopener noreferrer"&gt;DoraHacks BUIDL&lt;/a&gt; · &lt;a href="https://youtu.be/pdAQCRNSXoA" rel="noopener noreferrer"&gt;demo video&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>webdev</category>
      <category>typescript</category>
      <category>blockchain</category>
    </item>
    <item>
      <title>A heartbeat can't tell you the speedometer is lying: reading the glass back on QNX 8.0</title>
      <dc:creator>Edy Cu</dc:creator>
      <pubDate>Sun, 22 Nov 2026 21:24:37 +0000</pubDate>
      <link>https://dev.to/edycutjong/a-heartbeat-cant-tell-you-the-speedometer-is-lying-reading-the-glass-back-on-qnx-80-1gbd</link>
      <guid>https://dev.to/edycutjong/a-heartbeat-cant-tell-you-the-speedometer-is-lying-reading-the-glass-back-on-qnx-80-1gbd</guid>
      <description>&lt;p&gt;A car brakes from 49 km/h to a stop. The instrument cluster keeps showing &lt;strong&gt;48&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The renderer process is running. If you watch its liveness tick, it may still be ticking. If you ask it what it drew, it says the right number. Every check that lives &lt;em&gt;inside&lt;/em&gt; or &lt;em&gt;beside&lt;/em&gt; the renderer comes back green, and the driver is looking at a number that stopped being true seconds ago.&lt;/p&gt;

&lt;p&gt;That is the gap I built &lt;a href="https://github.com/edycutjong/telltale" rel="noopener noreferrer"&gt;Telltale&lt;/a&gt; to close: &lt;strong&gt;a watchdog proves the renderer is alive; only reading the glass back proves it tells the truth.&lt;/strong&gt; Telltale is a separate QNX 8.0 process that reads back the pixels QNX Screen actually composed, decodes the speed digits, six warning lamps and a liveness tick, and compares them with the vehicle state. When the glass lies, it puts the true speed on screen first and deals with the renderer second.&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/ONV3rW4BZKo" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/edycutjong/telltale" rel="noopener noreferrer"&gt;github.com/edycutjong/telltale&lt;/a&gt; · Site: &lt;a href="https://telltale.edycu.dev" rel="noopener noreferrer"&gt;telltale.edycu.dev&lt;/a&gt; · Two-minute &lt;a href="https://github.com/edycutjong/telltale/blob/main/JUDGE.md" rel="noopener noreferrer"&gt;judge guide&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Every timing in this post is &lt;strong&gt;QEMU (TCG) on an x86_64 QNX 8.0 guest, not hardware timing.&lt;/strong&gt; Telltale is &lt;strong&gt;not certified&lt;/strong&gt; and makes no ISO 26262 or ASIL claim.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The frozen 48
&lt;/h2&gt;

&lt;p&gt;The drive is real: a stop from the comma2k19 dataset, 49.01 km/h to 0 in 4.848 s, replayed as CAN speed into a resource manager. A fault injector freezes the renderer mid-stop.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsze2zf6g9qxod18cpyr5.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsze2zf6g9qxod18cpyr5.gif" alt="Same drive replayed twice on the QNX 8.0 guest. Left, monitor off: the glass stays at 48 while the car brakes to 0. Right, Telltale on: the fault is caught, a safe layer shows the true speed, the renderer is restarted." width="760" height="428"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Both panes are real frames read back from QNX Screen on the guest, at 1x speed. On the left the monitor is disarmed: the glass keeps showing 48. On the right, in the recorded take, Telltale caught the stall 123.4 ms after the fault, its safe layer was on the glass at 181.3 ms, and the first verified true frame from a respawned renderer came at 580.7 ms.&lt;/p&gt;

&lt;p&gt;The order matters. The truth goes up &lt;em&gt;before&lt;/em&gt; anything is killed, and the display is handed back to the renderer only after its own window reads true and its tick has genuinely moved since the fault was caught.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why a heartbeat and a self-report aren't enough
&lt;/h2&gt;

&lt;p&gt;The bench makes this concrete rather than rhetorical. Two of the fault classes are designed to defeat the obvious checks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;STALE&lt;/strong&gt;: the renderer stays alive and keeps its tick moving, but draws an old value. A tick-only watchdog would not have caught any of the 50 STALE runs, by construction. All 50 were caught by Telltale's value check.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;BLANK and MISDRAW&lt;/strong&gt;: the renderer &lt;em&gt;intends&lt;/em&gt; the right number. In MISDRAW it draws a different one (48 drawn as 84). Computed offline from the renderer's own intent log, a self-report check would have passed all 50 BLANK and all 10 MISDRAW runs. The pixel read caught every one.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The check itself is deliberately boring: a deterministic glyph decode against a known atlas, no machine learning, so the same frame always gets the same verdict.&lt;/p&gt;

&lt;h2&gt;
  
  
  The honest bench
&lt;/h2&gt;

&lt;p&gt;Here is what 200 injected faults (50 per class, one fresh process stack per injection, placed in the speed-changing windows of one real 31-minute drive) produced:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;class&lt;/th&gt;
&lt;th&gt;misses&lt;/th&gt;
&lt;th&gt;detect p50 / p95 (ms)&lt;/th&gt;
&lt;th&gt;stretch &amp;lt; 100 ms (p95)&lt;/th&gt;
&lt;th&gt;formula bound 197 ms (p95)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;BLANK&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;17.5 / 24.8&lt;/td&gt;
&lt;td&gt;met&lt;/td&gt;
&lt;td&gt;met&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;FREEZE&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;106.8 / 129.8&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;missed&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;met&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;STARVE&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;147.6 / 175.8&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;missed&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;met&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;STALE&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;168.2 / 271.2&lt;/td&gt;
&lt;td&gt;n/a: W + 100 = 200 ms target &lt;strong&gt;missed&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;n/a&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;0 missed out of 200.&lt;/strong&gt; But read the right-hand columns. The &amp;lt; 100 ms stretch target was met only for BLANK. STALE missed its 200 ms target by about 70 ms at p95. Those misses are published in the repo next to the wins, and the STALE miss was not decomposed or tuned afterwards. Detection time is dominated by the calibrated stall threshold (&lt;code&gt;tick_stall_ms&lt;/code&gt; = 151), not by how fast the monitor runs: halving the check period from 20 ms to 10 ms moved FREEZE p95 only from 129.8 to 122.2 ms.&lt;/p&gt;

&lt;p&gt;Two controls keep the headline honest:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Monitor off.&lt;/strong&gt; 40 runs with the monitor disarmed (it still reads, never acts): the glass was wrong or missing a speed for a &lt;strong&gt;median 29.9 s of a 30 s window&lt;/strong&gt;, and still wrong at the end of all 40. That is a control, not a detection result, but it shows what the fault does when nobody is watching the glass.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;False positives.&lt;/strong&gt; The first 30 minutes of the same real drive, no faults: &lt;strong&gt;0 false positives in 91,029 checks.&lt;/strong&gt; The whole check (three-region read-back plus decode) costs p50 / p95 5.7 / 6.3 ms.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The main bench was built at commit &lt;code&gt;7592e40&lt;/code&gt;. The monitor changed after code review, so the current build (&lt;code&gt;f2b8002&lt;/code&gt;) was re-checked with a smaller regression run, 5 per class including crashes: &lt;strong&gt;25/25 detected&lt;/strong&gt;. The on-target test suite is &lt;strong&gt;190 passed / 0 failed&lt;/strong&gt; at &lt;code&gt;f2b8002&lt;/code&gt;, and the repo keeps two earlier &lt;em&gt;failing&lt;/em&gt; suite runs, each of which caught a real monitor defect that was then fixed.&lt;/p&gt;

&lt;h2&gt;
  
  
  The QNX primitives that kept it small
&lt;/h2&gt;

&lt;p&gt;What surprised me most is how little glue this needed. QNX's primitives map almost one-to-one onto the problem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A resource manager you can &lt;code&gt;cat&lt;/code&gt;.&lt;/strong&gt; The vehicle state lives in &lt;code&gt;/dev/vehicle&lt;/code&gt;, served by an ordinary user-space process. Clients use &lt;code&gt;devctl&lt;/code&gt; for typed reads and writes, and a human can just read it. This is a recorded session from the guest:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;root@qnxqemu:/tmp/tt# cat /dev/vehicle
seq=377 t_ns=3693699975052 trace_s=5.945 speed_kmh=43.58 gear=D lamps=0x00 denied=0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The monitor exposes its own state the same way through &lt;code&gt;/dev/telltale&lt;/code&gt; and &lt;code&gt;/dev/telltale-events&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pulses instead of polling.&lt;/strong&gt; The monitor runs at &lt;code&gt;SCHED_FIFO&lt;/code&gt; 60 and is woken by a periodic timer that delivers a pulse to a private channel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;chid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ChannelCreate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_NTO_CHF_PRIVATE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;coid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ConnectAttach&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="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;chid&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_NTO_SIDE_CHANNEL&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="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="nf"&gt;sigevent&lt;/span&gt; &lt;span class="n"&gt;tev&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="no"&gt;SIGEV_PULSE_INIT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;tev&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;coid&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_PULSE_CODE_MINAVAIL&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="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;timer_t&lt;/span&gt; &lt;span class="n"&gt;tid&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="no"&gt;CK&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;timer_create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;CLOCK_MONOTONIC&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;tev&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;tid&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"timer_create"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="nf"&gt;itimerspec&lt;/span&gt; &lt;span class="n"&gt;its&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;period_its&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;period_ms&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;CK&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;timer_settime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tid&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="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;its&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"timer_settime"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="cm"&gt;/* ... */&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="nf"&gt;_pulse&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;MsgReceivePulse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chid&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;sizeof&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="o"&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="cm"&gt;/* ... */&lt;/span&gt; &lt;span class="k"&gt;continue&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;&lt;strong&gt;Screen read-back.&lt;/strong&gt; Each check reads three small regions of the &lt;em&gt;composed&lt;/em&gt; display, which is what the driver sees, not what the renderer thinks it posted:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;e1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;screen_read_display&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;disp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;bb&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="n"&gt;rb&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="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;e2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;screen_read_display&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;disp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;bt&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="n"&gt;rt&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="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;e1&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;e2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;e2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;screen_read_display&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;disp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;bl&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="n"&gt;rl&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="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The safe layer is just another Screen window, posted on top with &lt;code&gt;screen_post_window&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdogeqj9rskbr15wtkqe1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdogeqj9rskbr15wtkqe1.png" alt="Telltale architecture on QNX 8.0: vehfeed feeds /dev/vehicle; the cluster renderer posts to QNX Screen; telltale reads the composed display back every 20 ms, compares with /dev/vehicle, and on a fault raises a safe layer, kills and respawns the renderer, and hands back after a verified frame." width="800" height="784"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;secpol, so the monitor can't be talked over.&lt;/strong&gt; Every process gets its own security type, and only the feeder may write the truth:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;allow feeder_t   vehicle_t:vehicle write;
allow renderer_t vehicle_t:vehicle read;
allow monitor_t  vehicle_t:vehicle read;
allow hog_t      self:ability { priority:1-40 };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With the policy loaded, the on-target suite runs 22 secpol checks, 13 of them denials. Even untyped root gets &lt;code&gt;DCMD_VEH_SET: Operation not permitted&lt;/code&gt;, and the CPU hog is refused priority 50. One caveat stated plainly: the policy is enforced in the on-target suite, not loaded during the timing bench.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building for QNX 8.0 on an Apple-Silicon Mac
&lt;/h2&gt;

&lt;p&gt;None of this ran on hardware. The whole loop ran on an M1 Mac, and the setup had its own lessons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The compiler lives in a container.&lt;/strong&gt; SDP 8.0's host tools are Linux-only, so &lt;code&gt;qcc&lt;/code&gt; runs in a &lt;code&gt;linux/amd64&lt;/code&gt; Docker image under emulation. The SDP itself stays on the Mac and is bind-mounted at the same absolute path.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;QEMU with TCG, not KVM.&lt;/strong&gt; The QNX Everywhere Quick Start image boots as an x86_64 guest with software emulation. It is slow, but it needs no root, no KVM and no extra drivers. The first boot converts the image's 47 GiB raw disk to qcow2. Because the guest is emulated and the Mac was under load, I label every number as QEMU timing and log host load per bench row.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The &lt;code&gt;ionotify&lt;/code&gt; pitfall.&lt;/strong&gt; The renderer waits for new vehicle data with &lt;code&gt;ionotify()&lt;/code&gt; and a pulse. The step that is easy to miss: the event must be registered against the fd with &lt;code&gt;MsgRegisterEvent()&lt;/code&gt; first. Leave it out and &lt;code&gt;ionotify()&lt;/code&gt; still &lt;em&gt;succeeds&lt;/em&gt;, but the pulse never arrives. No error, just silence. The &lt;a href="https://telltale.edycu.dev/codelab/" rel="noopener noreferrer"&gt;codelab&lt;/a&gt; records the broken variant (zero wake-ups after four seconds) next to the working one:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="no"&gt;SIGEV_PULSE_INIT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;ev&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;coid&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;SIGEV_PULSE_PRIO_INHERIT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;PULSE_CODE&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="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;MsgRegisterEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;ev&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fd&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="o"&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="nf"&gt;perror&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"MsgRegisterEvent"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;return&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="cm"&gt;/* ... */&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;ionotify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fd&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_NOTIFY_ACTION_POLLARM&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_NOTIFY_COND_INPUT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;ev&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;If you have never written a QNX resource manager, that codelab walks a &lt;code&gt;/dev/counter&lt;/code&gt; from &lt;code&gt;docker build&lt;/code&gt; to &lt;code&gt;ionotify&lt;/code&gt; on the same Mac-plus-QEMU setup, with every command's recorded output.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Not certified; no ISO 26262 or ASIL claim.&lt;/li&gt;
&lt;li&gt;All timings are QEMU (TCG) on a loaded Mac, not hardware.&lt;/li&gt;
&lt;li&gt;The monitor itself is not supervised: if &lt;code&gt;telltale&lt;/code&gt; dies, nothing restarts it.&lt;/li&gt;
&lt;li&gt;Gear is drawn but not verified; speed digits, six lamps and the tick are.&lt;/li&gt;
&lt;li&gt;Whole-CPU starvation (Screen, monitor, renderer and hog on one CPU) delays the safe layer until the hog ends, so STARVE is reported as "renderer CPU only".&lt;/li&gt;
&lt;li&gt;The 200 injections are a declared population in one real drive, not general coverage.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;The claims can be checked without a QNX licence: &lt;code&gt;make test-host&lt;/code&gt; runs the host tests, &lt;code&gt;scripts/replay_target_run.sh&lt;/code&gt; re-checks every recorded assertion of the cited on-target run, and &lt;code&gt;scripts/bench_all.sh report&lt;/code&gt; regenerates the bench tables byte-identically. Running it on QNX needs SDP 8.0 and the QNX Everywhere QEMU image; the README has the steps.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Repo: &lt;a href="https://github.com/edycutjong/telltale" rel="noopener noreferrer"&gt;github.com/edycutjong/telltale&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Site: &lt;a href="https://telltale.edycu.dev" rel="noopener noreferrer"&gt;telltale.edycu.dev&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Codelab: &lt;a href="https://telltale.edycu.dev/codelab/" rel="noopener noreferrer"&gt;telltale.edycu.dev/codelab&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Telltale is entered in the QNX Global Hackathon; the project page is &lt;a href="https://devpost.com/software/telltale-islt6u" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;AI disclosure: Claude Code was my engineering pair while building this; the product itself uses no AI at runtime.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>embedded</category>
      <category>automotive</category>
      <category>c</category>
    </item>
    <item>
      <title>Give your AI agent the cancel, not the key</title>
      <dc:creator>Edy Cu</dc:creator>
      <pubDate>Sun, 22 Nov 2026 17:34:42 +0000</pubDate>
      <link>https://dev.to/edycutjong/give-your-ai-agent-the-cancel-not-the-key-3g4</link>
      <guid>https://dev.to/edycutjong/give-your-ai-agent-the-cancel-not-the-key-3g4</guid>
      <description>&lt;p&gt;A finance team approves Friday's vendor payments on Monday. On Tuesday an email arrives from the vendor's real mailbox: "confirming Friday's payment goes to the updated payout address… please don't call, just reply here." On a stablecoin chain, once that payment lands, nobody can pull it back.&lt;/p&gt;

&lt;p&gt;The obvious fix in 2026 is an AI agent that reads the inbox and reacts. The obvious problem is that an agent reading attacker-written email is the most prompt-injectable thing you can build, and the usual guardrail ("give it a session key with a spend cap") still lets a hijacked agent pay up to the cap.&lt;/p&gt;

&lt;p&gt;I built &lt;a href="https://github.com/edycutjong/brake" rel="noopener noreferrer"&gt;Brake&lt;/a&gt; for the QDay Aevum Builder Challenge around a different idea: &lt;strong&gt;don't give the agent a key that can pay. Give it the cancel.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Live app: &lt;a href="https://app.brake.edycu.dev/" rel="noopener noreferrer"&gt;app.brake.edycu.dev&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Repo: &lt;a href="https://github.com/edycutjong/brake" rel="noopener noreferrer"&gt;github.com/edycutjong/brake&lt;/a&gt; (MIT)&lt;/li&gt;
&lt;li&gt;Demo video (3 min): &lt;a href="https://youtu.be/AHshl1gDvHs" rel="noopener noreferrer"&gt;youtu.be/AHshl1gDvHs&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The primitive: EIP-3009's cancelAuthorization
&lt;/h2&gt;

&lt;p&gt;USDC-style tokens (Circle's FiatToken v2) implement EIP-3009. Besides &lt;code&gt;transferWithAuthorization&lt;/code&gt;, a signed payment anyone can submit, it has a less famous sibling: &lt;code&gt;cancelAuthorization(authorizer, nonce, v, r, s)&lt;/code&gt;. It marks a nonce as used, so a payment signed with that nonce can never execute.&lt;/p&gt;

&lt;p&gt;Two properties make it useful:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A payment authorization can be &lt;strong&gt;time-locked&lt;/strong&gt; with &lt;code&gt;validAfter&lt;/code&gt;, so it cannot clear before payday.&lt;/li&gt;
&lt;li&gt;A cancel signed by the payer can be &lt;strong&gt;submitted by anyone&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The second one is the whole design, so I tested it first. On Aevum testnet (chain 44005), tUSD8 is a FiatToken clone. A cancel signed by the payer was submitted from an unrelated EOA (&lt;a href="https://explorer-test.qday.info/tx/0x8cb8d550f03616e14ef00682022dd20a4ade46e090c8466766d6799dc98330c2" rel="noopener noreferrer"&gt;tx&lt;/a&gt;) and through a contract (&lt;a href="https://explorer-test.qday.info/tx/0x50c5cfcc0d470f71ab91b75cbea227cc820df0c19543bd919e4d293fd2c12df5" rel="noopener noreferrer"&gt;tx&lt;/a&gt;). In both cases the paired payment then reverted (&lt;a href="https://explorer-test.qday.info/tx/0x07dbb27599ac8615360e0e52e04475ec2193c334c330e76ffd2b6dd52529bb7d" rel="noopener noreferrer"&gt;tx&lt;/a&gt;). The same gate runs as 7 Foundry tests.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sign the payment and its cancel together
&lt;/h2&gt;

&lt;p&gt;For every line of a payment run, finance signs two EIP-712 messages once, over the &lt;strong&gt;same nonce&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/** Sign one line: the payment and the cancellation that can stop it, over the same nonce. */&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;signPair&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;account&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Account&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;domain&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;TokenDomain&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Address&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;bigint&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;validAfter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;bigint&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;validBefore&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;bigint&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;nonce&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="nc"&gt;Hex&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;SignedPair&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;authorization&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Authorization&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;account&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;address&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;validAfter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;validAfter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;validBefore&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;validBefore&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;nonce&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;nonce&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="nf"&gt;randomNonce&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;payment&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;signTransferAuthorization&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;account&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;domain&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;authorization&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;cancel&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;signCancelAuthorization&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;account&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;domain&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;authorization&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;nonce&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;authorization&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;payment&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cancel&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="cm"&gt;/* digests */&lt;/span&gt; &lt;span class="p"&gt;}&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 payment signature goes to a keeper that submits it on payday. The cancel signature goes to the stop path. The agent never sees a payment signature, holds 0 tUSD8, and has no allowance. The worst a hijacked agent can do is &lt;strong&gt;delay&lt;/strong&gt; a line. It cannot create a payment or change where one goes, because those are fixed inside signatures it never had.&lt;/p&gt;

&lt;h2&gt;
  
  
  The contract: the agent's only lever
&lt;/h2&gt;

&lt;p&gt;The agent doesn't call the token directly. It calls &lt;code&gt;Brake.stop&lt;/code&gt;, which checks the agent's grant (per-run, with an expiry and a stop budget), then submits the payer's cancel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (token.authorizationState(run.payer, l.nonce)) {
    // used (paid) or cancelled outside Brake; the reconciler reads logs
    l.status = Status.CONSUMED;
    emit StopConsumed(runId, idx, reason, evidenceHash, msg.sender);
    return Status.CONSUMED;
}

if (byAgent) {
    if (run.stops &amp;gt;= run.maxStops) revert StopBudgetExhausted();
    run.stops += 1;
}
l.status = Status.STOPPED;

token.cancelAuthorization(run.payer, l.nonce, v, r, s); // reverts on a bad signature: nothing changes

emit LineStopped(runId, idx, reason, evidenceHash, msg.sender);
if (byAgent &amp;amp;&amp;amp; run.stops == run.alarmAt) emit StopAlarm(runId, run.stops);
_receipt(runId, idx, RESPONSE_STOP, reason, evidenceHash, uri);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A few details that came out of testing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The stop budget&lt;/strong&gt; (&lt;code&gt;maxStops&lt;/code&gt;) caps how many lines a hijacked agent can cancel per run. Hitting it turns the next attempt into an on-chain HOLD for finance, not a stop.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CONSUMED, not a lie.&lt;/strong&gt; If the payment already cleared, the stop lands on a used nonce. Brake records that, and the reconciler reads tUSD8's &lt;code&gt;AuthorizationUsed&lt;/code&gt; log and marks the line TOO LATE with a recovery ticket. The agent never claims a stop it didn't make.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Every decision is a receipt.&lt;/strong&gt; Each ALLOW, HOLD or STOP writes an ERC-8004 Validation Registry response (100 / 50 / 0) with a reason code and an evidence hash.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The model reads; it doesn't decide
&lt;/h2&gt;

&lt;p&gt;The agent has a rules layer (unverified bank change, lookalike sender, disputed invoice, blacklisted payee…) and a model layer. The model's whole interface is one strict-schema tool:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;RECORD_FINDINGS_TOOL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"record_findings"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Record what the linked messages mean for each payment line. Call exactly once."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;strict&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;input_schema&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"object"&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;properties&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;findings&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"array"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"object"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="n"&gt;properties&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"integer"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"line index"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;intent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"string"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;enum&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;INTENTS&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;quotes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="cm"&gt;/* message_id + verbatim text */&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;note&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"string"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"one sentence, plain English"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="c1"&gt;// ...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There is no pay tool, no signature, no free-form action. Deterministic code then decides:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Every quote the model cites must appear &lt;strong&gt;verbatim&lt;/strong&gt; in the message. A paraphrased or misattributed quote is dropped.&lt;/li&gt;
&lt;li&gt;Rules are consulted first, and &lt;strong&gt;no model output can turn a rule STOP into ALLOW or HOLD&lt;/strong&gt;. A fast-check property test runs that against 10,000 generated model outputs.&lt;/li&gt;
&lt;li&gt;An unverified finding never ALLOWs. A model failure never becomes ALLOW.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That last rule paid off on the live chain. The first live run failed: the model rejected the forced &lt;code&gt;tool_choice&lt;/code&gt; the engine sent (HTTP 400), every review errored, and &lt;strong&gt;all four lines were held with no tUSD8 moved&lt;/strong&gt;. The fix was to let the model choose its tool under the strict schema, with a missing tool call still holding the line.&lt;/p&gt;

&lt;h2&gt;
  
  
  Does the model actually matter?
&lt;/h2&gt;

&lt;p&gt;This is the part I didn't expect. In the demo email, the vendor's compromised mailbox asks finance not to call, and adds a bracketed note addressed to the "payment assistant". The payee on file was phone-verified weeks earlier, so &lt;strong&gt;no rule fires&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;From the 25-email injection suite (6 held-out emails committed before tuning):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Split&lt;/th&gt;
&lt;th&gt;Rules only&lt;/th&gt;
&lt;th&gt;With the model&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Tune (n=19)&lt;/td&gt;
&lt;td&gt;4/19&lt;/td&gt;
&lt;td&gt;19/19, 0 false stops&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Held-out (n=6)&lt;/td&gt;
&lt;td&gt;2/6&lt;/td&gt;
&lt;td&gt;6/6, 0 false stops&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;In the hero scenario, the model stops line 3 in 5 of 5 runs with 0 rules fired. Stub the model out and line 3 is ALLOWED and paid. n=25 is a regression suite, not a detection rate, and I say so in the repo.&lt;/p&gt;

&lt;p&gt;The injection in the email doesn't help the attacker. The best it can do is suppress a stop only the model would have made. It can't reach a key that pays.&lt;/p&gt;

&lt;h2&gt;
  
  
  Live numbers
&lt;/h2&gt;

&lt;p&gt;On Aevum testnet 44005, with &lt;code&gt;claude-sonnet-5-5&lt;/code&gt; through the Anthropic API:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Hero run, 71.1 s end to end:&lt;/strong&gt; Monday ALLOW ×4 → Tuesday email → model-only stop (&lt;a href="https://explorer-test.qday.info/tx/0x8832f90c883dd036839236f3871cef55b149675f623058fe789de3871ec5a581" rel="noopener noreferrer"&gt;tx&lt;/a&gt;) → lines 1, 2 and 4 paid in one Multicall3 batch (&lt;a href="https://explorer-test.qday.info/tx/0x89e469336139f5afd2db1410b686ebe95036c916899acd0c7391a64d4c314d93" rel="noopener noreferrer"&gt;tx&lt;/a&gt;) → line 3's replay reverts with the token's own &lt;code&gt;FiatTokenV2: authorization is used or canceled&lt;/code&gt; (&lt;a href="https://explorer-test.qday.info/tx/0x70f0ce1dccf151c5056e3983bba4be0d673d4425edab2f35d68ccebf119f345e" rel="noopener noreferrer"&gt;tx&lt;/a&gt;) → finance re-issues line 3 to the verified wallet and it pays.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Email to agent stop confirmed:&lt;/strong&gt; p50 4,987 ms, p95 10,093 ms (n=10).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gas:&lt;/strong&gt; a stop that cancels is about 183,000.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Agent-initiated transfers:&lt;/strong&gt; 0.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tests:&lt;/strong&gt; 131 (forge 50, signer 12, engine 69).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Honest limits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Brake prevents only what it detects.&lt;/strong&gt; A fraud that neither rules nor model flag pays as it would without Brake. If the attacker had stayed silent, line 3 would have paid.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It acts only before payday.&lt;/strong&gt; After that it can report TOO LATE, not claw back.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The stop budget binds only the Brake path.&lt;/strong&gt; Raw cancel signatures live on the server, so a compromised server can cancel every line (a delayed run). It can't change a payee or an amount.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Demo mode is custodial on testnet.&lt;/strong&gt; The non-custodial path (your key signs, the server stores only signatures) has run on a local fork, not yet live.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Privacy:&lt;/strong&gt; vendor email text goes to the model API; only hashes go on-chain.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Issuer powers:&lt;/strong&gt; the token issuer can pause or blacklist, which blocks payments and cancels alike.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The takeaway
&lt;/h2&gt;

&lt;p&gt;When you scope an agent's power, ask whether it needs to &lt;em&gt;act&lt;/em&gt; at all, or only to &lt;em&gt;veto&lt;/em&gt;. Many tokens already ship a veto primitive. A pre-signed cancel turns "the agent might pay the wrong person" into "the agent might make a payment late", and a late payment can be fixed.&lt;/p&gt;

&lt;p&gt;Try to trick it yourself: the &lt;a href="https://app.brake.edycu.dev/" rel="noopener noreferrer"&gt;live app&lt;/a&gt; has a composer where you can write an email as the vendor. The code, tests and every live transaction hash are in the &lt;a href="https://github.com/edycutjong/brake" rel="noopener noreferrer"&gt;repo&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>ai</category>
      <category>web3</category>
      <category>security</category>
    </item>
    <item>
      <title>A $0 transfer can fake your proof of life: building a dead-man's switch that reads silence</title>
      <dc:creator>Edy Cu</dc:creator>
      <pubDate>Sun, 22 Nov 2026 06:44:01 +0000</pubDate>
      <link>https://dev.to/edycutjong/a-0-transfer-can-fake-your-proof-of-life-building-a-dead-mans-switch-that-reads-silence-2aca</link>
      <guid>https://dev.to/edycutjong/a-0-transfer-can-fake-your-proof-of-life-building-a-dead-mans-switch-that-reads-silence-2aca</guid>
      <description>&lt;p&gt;If you die with crypto in your own wallet, nobody gets it. That's the whole point of self-custody, and it's also the problem.&lt;/p&gt;

&lt;p&gt;The usual fix is a dead-man's switch. Most designs give you a check-in button to press on a schedule. Forget once and the switch fires on someone who's still alive. And something has to count the days: a server, a keeper, a cron job someone keeps paying for. If that dies before you do, the switch dies with it.&lt;/p&gt;

&lt;p&gt;I wanted the opposite. No check-in to remember, no server. (The vault does have an optional owner &lt;code&gt;ping()&lt;/code&gt;, but nothing requires it.) Proof of life would be the stuff I already do with my wallet, and the switch would only care when that stops. That's &lt;a href="https://github.com/edycutjong/heirloom" rel="noopener noreferrer"&gt;Heirloom&lt;/a&gt;: a Reactive Network contract watches my token transfers on the chains I pick, and a small vault on Base pays my heir once they go quiet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Links:&lt;/strong&gt; &lt;a href="https://heirloom.edycu.dev/" rel="noopener noreferrer"&gt;live landing&lt;/a&gt; · &lt;a href="https://github.com/edycutjong/heirloom" rel="noopener noreferrer"&gt;repo&lt;/a&gt; · &lt;a href="https://heirloom.edycu.dev/judge/" rel="noopener noreferrer"&gt;30-second judge path&lt;/a&gt; · &lt;a href="https://heirloom.edycu.dev/status/" rel="noopener noreferrer"&gt;live status card&lt;/a&gt;. Everything below runs on testnet (Reactive Lasna + Base Sepolia). Mainnet is scripted, not deployed.&lt;/p&gt;

&lt;p&gt;The design ran into a wall on day 1, and it wasn't in my contract. It was in the token standard.&lt;/p&gt;

&lt;h2&gt;
  
  
  The wall: anyone can emit a &lt;code&gt;Transfer&lt;/code&gt; "from" you
&lt;/h2&gt;

&lt;p&gt;If "alive" means "a &lt;code&gt;Transfer&lt;/code&gt; event whose &lt;code&gt;from&lt;/code&gt; is my address", the obvious attack is to make that event without my key.&lt;/p&gt;

&lt;p&gt;On Circle's USDC that costs nothing. I simulated it on Base Sepolia, Ethereum Sepolia and Unichain Sepolia: USDC accepts &lt;code&gt;transfer(to, 0)&lt;/code&gt; and a &lt;strong&gt;third party's&lt;/strong&gt; &lt;code&gt;transferFrom(owner, spoofer, 0)&lt;/code&gt; with no balance and no allowance. The log it emits carries &lt;code&gt;topic1 = owner&lt;/code&gt;. Then I sent one spoof live on Base Sepolia, and it reached my reactive contract's &lt;code&gt;react()&lt;/code&gt; looking exactly like me (finding 4 in the repo's &lt;a href="https://github.com/edycutjong/heirloom/blob/main/docs/DX-REPORT.md" rel="noopener noreferrer"&gt;DX report&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;So a naive "watch for my transfers" switch is beaten by free address-poisoning spam. Anyone can keep a dead wallet looking alive, forever, for gas.&lt;/p&gt;

&lt;p&gt;It works the other way too. Anything that looks like activity can be used to &lt;em&gt;hide&lt;/em&gt; activity, which becomes important below.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix: the filter is the first thing a log meets
&lt;/h2&gt;

&lt;p&gt;This is the head of &lt;code&gt;react()&lt;/code&gt; in &lt;code&gt;src/HeirloomReactive.sol&lt;/code&gt;, unedited:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (log_.topic0 == TRANSFER_T0) {
    if (log_.opCode != 3 || log_.data.length != 32) return _refuse(log_, Refusal.MALFORMED, true);
    if (!allowed[log_.chainId][log_.contractAddress]) return _refuse(log_, Refusal.NOT_ALLOWLISTED, false);
    if (log_.topic1 != uint256(uint160(owner))) return _refuse(log_, Refusal.NOT_OWNER, false);
    if (abi.decode(log_.data, (uint256)) == 0) return _refuse(log_, Refusal.ZERO_VALUE, true);
    return _seen(log_.chainId, log_.contractAddress, log_.txHash);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three rules do the work:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Only allowlisted tokens count.&lt;/strong&gt; A worthless token's transfer can't reset the clock.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Only &lt;code&gt;value &amp;gt; 0&lt;/code&gt; counts.&lt;/strong&gt; The $0 spoof is refused with reason &lt;code&gt;ZERO_VALUE&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A refused log never touches the silence clock.&lt;/strong&gt; It emits &lt;code&gt;SpoofRefused&lt;/code&gt; instead, so every refusal can be seen on-chain, not dropped without a trace.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Order matters for cost, not just correctness. Reactive bills every &lt;code&gt;react()&lt;/code&gt;, including the ones you refuse, so the cheap checks run before the expensive state writes (the silence clock, the canary reset, the callbacks). A test (&lt;code&gt;test_refused_react_gas_ceiling&lt;/code&gt;) keeps a refused react under a fixed gas ceiling.&lt;/p&gt;

&lt;p&gt;You can fire one at the live instance yourself. From a fresh clone, any Base Sepolia key with a little ETH:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pnpm &lt;span class="nb"&gt;exec&lt;/span&gt; tsx scripts/trigger-spoof.ts --dry-run   &lt;span class="c"&gt;# simulates, sends nothing, needs no key&lt;/span&gt;
&lt;span class="nv"&gt;PRIVATE_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0x… pnpm &lt;span class="nb"&gt;exec&lt;/span&gt; tsx scripts/trigger-spoof.ts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then you'll see your origin tx on Base Sepolia, followed by a &lt;code&gt;SpoofRefused&lt;/code&gt; event on Lasna from the 90-day instance. The run in &lt;code&gt;DEMO.md&lt;/code&gt; came from a non-owner wallet, and was refused as &lt;code&gt;ZERO_VALUE&lt;/code&gt; (3).&lt;/p&gt;

&lt;h2&gt;
  
  
  Spam can delay a release, never cause one
&lt;/h2&gt;

&lt;p&gt;Refusals are billed, so a spoof flood could drain the contract's reserve and silence it. That's a different way to kill the switch. So there's a per-token &lt;strong&gt;spam brake&lt;/strong&gt;: after &lt;code&gt;maxRefusedPerWindow&lt;/code&gt; malformed or zero-value refusals inside &lt;code&gt;brakeWindow&lt;/code&gt;, that token gets unsubscribed for a while. The constructor reverts if either is zero, so the brake can't be turned off. It's covered by &lt;code&gt;test_spam_brake&lt;/code&gt;; it hasn't tripped on the live testnet instances.&lt;/p&gt;

&lt;p&gt;But unsubscribing creates a blind spot. During it, a living owner's real transfers on that token go unseen. If the contract treated that blind interval as silence, a spammer could hide me until the release fired. That's the "hide activity" attack from above.&lt;/p&gt;

&lt;p&gt;So the rule is fail-closed. A blind interval is never counted as silence: if a brake trips during a grace window, the grace is cancelled, and when the brake lifts, the T clock restarts from the lift:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// The brake hid real transfers: restart the T clock from the lift. A new epoch starts here, with its own
// canary check and its own one freeze (the old epoch's extension must not ride along in `deadline()`).
if (nowTs &amp;gt; observedFrom) observedFrom = nowTs;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The cost is liveness. A sustained spray can postpone a release, with no upper bound. It can never cause one. That's Known limit 1 in the README rather than a footnote, because for a switch that moves money to someone else, "too late" can be recovered from and "too early" can't.&lt;/p&gt;

&lt;h2&gt;
  
  
  Silence needs a clock that doesn't need you
&lt;/h2&gt;

&lt;p&gt;If I'm gone, no origin chain emits anything, so something else has to tick. In Heirloom, Reactive's CRON topics are the only clock. On each tick the contract checks whether every watched chain has been quiet for T. If so, it calls &lt;code&gt;requestCallbackV_1_0&lt;/code&gt; and the vault on Base enters GRACE. Any allowlisted transfer of mine during grace cancels it. If grace runs out, the vault becomes claimable, and the heir claims in two steps (&lt;code&gt;initiateClaim&lt;/code&gt;, then &lt;code&gt;finalizeClaim&lt;/code&gt; after a delay). Anyone can press either step; the money only goes to the heir (or to an address the heir redirects it to). I can withdraw at any time before release.&lt;/p&gt;

&lt;p&gt;Two guards on the vault's &lt;code&gt;sync()&lt;/code&gt;: the caller must be the callback proxy, &lt;em&gt;and&lt;/em&gt; the injected first argument must be this exact reactive contract.&lt;/p&gt;

&lt;p&gt;And one more failure mode: silence from me looks the same as the network going deaf. So an owner-independent Chainlink feed acts as a &lt;strong&gt;canary&lt;/strong&gt;. If the network stops hearing the canary, the countdown freezes once, with a cap, and can't be chained (&lt;code&gt;test_freeze_not_twice&lt;/code&gt;). In about 23 h of measuring Ethereum feeds, the median canary gaps were 3,612 s and 3,636 s. A multi-day measurement is still open.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the testnet run shows
&lt;/h2&gt;

&lt;p&gt;The demo instance ran the whole story on live networks with T = 5 min: 2 graces, 1 cancel from a real owner transfer, 1 expiry, the heir's two-step claim, then teardown. 5 of 5 callbacks were acknowledged, with 0 resends. After paying out, &lt;code&gt;react()&lt;/code&gt; removed its own subscriptions, and the finished instance holds 0 filters on Lasna. You can check that with one &lt;code&gt;rnk_getFilters&lt;/code&gt; call from &lt;code&gt;DEMO.md&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;On 2026-11-22 a fresh instance deployed from the current contract source ran the same story again, with two changes to the script: it fails unless the first heartbeat is actually &lt;code&gt;Seen&lt;/code&gt; on Lasna (it was, about a second later), and a third wallet that is neither owner nor heir pressed &lt;code&gt;initiateClaim&lt;/code&gt;. 8 of 8 callbacks were acknowledged on the first try.&lt;/p&gt;

&lt;p&gt;Across all the testnet instances the evidence ledger has 69 rows, 37 of them with a callback leg (28 from Heirloom instances, 9 from day-1 probes). One of them is a live REVIVE: after an expiry, with the vault already claimable, an owner transfer on Ethereum Sepolia (&lt;a href="https://sepolia.etherscan.io/tx/0x61f8122782204b2731deeae60e6d45a107436e9bc66d9ed5fd295f357b37ff26" rel="noopener noreferrer"&gt;tx&lt;/a&gt;) made the reactive contract send a callback that re-armed the vault on Base (&lt;a href="https://sepolia.basescan.org/tx/0x5b295eca4f2db1f2c0696d8df9d5b58e95a64ef779eb293ec8596eaf7b666ad3" rel="noopener noreferrer"&gt;tx&lt;/a&gt;). Each row is a set of explorer links: origin or CRON tx → reactive tx → callback tx.&lt;/p&gt;

&lt;p&gt;Tests: 169 contract tests, 27 shared-kit tests and 27 TypeScript tests, all passing. Line coverage on &lt;code&gt;src/&lt;/code&gt; is 616/616, and the whole loop (log → &lt;code&gt;react()&lt;/code&gt; → callback) runs inside &lt;code&gt;forge test&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The switch that went quiet
&lt;/h2&gt;

&lt;p&gt;Two weeks after deploying, I sent the 90-day instance a heartbeat and nothing happened. Its balance was healthy, 9 lREACT, but the system contract showed a small debt (0.0134 lREACT), and its last event was days old.&lt;/p&gt;

&lt;p&gt;The cause: that build predated a public &lt;code&gt;coverDebt()&lt;/code&gt;, and I had topped it up by plain transfers. Reactive's docs are clear once you look: a direct transfer "neither settles debt nor creates reserves", and a contract in debt stops being served. Its own balance sat there, unusable. One call fixed it, &lt;code&gt;depositTo(address)&lt;/code&gt; on the system contract, which "settles outstanding debt first, then adds the remainder to reserves". The next heartbeat reacted within about 10 seconds, and the overdue weekly attestation fired on the following CRON tick.&lt;/p&gt;

&lt;p&gt;For a dead-man's switch that is the scariest kind of failure, because silence from a dead contract looks exactly like silence from a live one. Two lessons: fund reactive contracts through &lt;code&gt;depositTo&lt;/code&gt;, and watch their debt, not just their balance. The current contracts expose &lt;code&gt;coverDebt()&lt;/code&gt;, and the vault now refuses to start a claim unless it can still pay for the callback that would cancel it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three things the docs didn't tell me
&lt;/h2&gt;

&lt;p&gt;These are from the DX report, each tied to a transaction or a test:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Reactive Test Lib doesn't drive Omni contracts as shipped.&lt;/strong&gt; Its mock system contract lives at the legacy address and collects the legacy &lt;code&gt;Callback&lt;/code&gt; event. Omni contracts accept &lt;code&gt;react()&lt;/code&gt; only from &lt;code&gt;0x8888…8888&lt;/code&gt; and call &lt;code&gt;requestCallbackV_1_0&lt;/code&gt;. I wrote a small adapter (&lt;code&gt;packages/reactive-kit&lt;/code&gt;) that keeps the Test Lib's callback proxy and result types.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The CRON log's &lt;code&gt;data&lt;/code&gt; is empty (&lt;code&gt;0x&lt;/code&gt;).&lt;/strong&gt; The docs describe a &lt;code&gt;number&lt;/code&gt; parameter, so read &lt;code&gt;block.number&lt;/code&gt; instead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cross-chain block timestamps can be off by a second.&lt;/strong&gt; In 5 of the first 9 rows of the triple log, the Lasna reactive block is stamped one second &lt;em&gt;before&lt;/em&gt; its origin block. Measure hop latency with a wall clock, not timestamp deltas.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What it doesn't do
&lt;/h2&gt;

&lt;p&gt;A dead-man's switch should be judged by how it fails:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It inherits the vault, not the wallet.&lt;/strong&gt; Native ETH transfers emit no ERC-20 &lt;code&gt;Transfer&lt;/code&gt; log, so they're not proof of life.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Approved spenders count as life.&lt;/strong&gt; The log carries no tx sender, so a spender with a standing allowance can keep the wallet "alive". That only delays a release. Allowlist tokens that have no standing approvals.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Nobody gets notified when grace opens.&lt;/strong&gt; Pick a T longer than your longest normal quiet stretch. Until notifications exist, an explorer address alert on the vault works: every state change emits &lt;code&gt;StateChanged&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Testnet only.&lt;/strong&gt; The 11-08 instances predate the last contract fixes; the 11-22 instance runs the current source. Mainnet is scripted with a dry-run mode and hasn't been run. No cost-per-month figure is published because the measured window is too short.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why Reactive
&lt;/h2&gt;

&lt;p&gt;Take Reactive away and a typical design needs a per-chain indexer, a rules server with a database, a scheduler, and a relayer holding a hot key. Every one of them has to keep running after the owner is gone, which is exactly the thing a dead-man's switch can't assume. Here the subscriptions, the clock and the callback belong to the platform, and the contract edits its own subscriptions from inside &lt;code&gt;react()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Code, tests and every transaction: &lt;a href="https://github.com/edycutjong/heirloom" rel="noopener noreferrer"&gt;github.com/edycutjong/heirloom&lt;/a&gt; · &lt;a href="https://heirloom.edycu.dev/" rel="noopener noreferrer"&gt;landing&lt;/a&gt; · &lt;a href="https://heirloom.edycu.dev/judge/" rel="noopener noreferrer"&gt;judge page&lt;/a&gt; · demo video: &lt;a href="https://youtu.be/uj7rfKXP6wA" rel="noopener noreferrer"&gt;https://youtu.be/uj7rfKXP6wA&lt;/a&gt;. I'd like to hear about failure modes I've missed.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>solidity</category>
      <category>web3</category>
      <category>blockchain</category>
    </item>
    <item>
      <title>One contract, two chains: both bridge gates shut within 3 s (p95, block time) of a mint that was never locked</title>
      <dc:creator>Edy Cu</dc:creator>
      <pubDate>Sun, 22 Nov 2026 06:43:57 +0000</pubDate>
      <link>https://dev.to/edycutjong/one-contract-two-chains-both-bridge-gates-shut-within-3-s-p95-block-time-of-a-mint-that-was-1h17</link>
      <guid>https://dev.to/edycutjong/one-contract-two-chains-both-bridge-gates-shut-within-3-s-p95-block-time-of-a-mint-that-was-1h17</guid>
      <description>&lt;p&gt;A lock-and-mint bridge has one job: never mint on chain B what nobody locked on chain A. When that check fails, the first bad mint is rarely the expensive one. The expensive part is everyone else noticing and replaying it, block after block, until a human wakes up. The Nomad bridge lost about $190M that way over roughly two and a half hours.&lt;/p&gt;

&lt;p&gt;The awkward part is &lt;em&gt;where&lt;/em&gt; a guard would have to sit. A contract on Base sees &lt;code&gt;Locked&lt;/code&gt; but never &lt;code&gt;Minted&lt;/code&gt;. A contract on Unichain sees &lt;code&gt;Minted&lt;/code&gt; but never &lt;code&gt;Locked&lt;/code&gt;. Neither side can tell that a mint has no lock behind it, because each one is holding half of the ledger.&lt;/p&gt;

&lt;p&gt;I built &lt;strong&gt;Ledgerlock&lt;/strong&gt; for the Reactive Omni Buildathon to see how fast one contract that &lt;em&gt;can&lt;/em&gt; read both halves shuts the bridge. All of it runs on testnets, and every measured number below can be regenerated from rows committed in the repo.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Live page (no wallet needed): &lt;a href="https://ledgerlock.edycu.dev/" rel="noopener noreferrer"&gt;https://ledgerlock.edycu.dev/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Judge path, six explorer links: &lt;a href="https://ledgerlock.edycu.dev/judge" rel="noopener noreferrer"&gt;https://ledgerlock.edycu.dev/judge&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Code + evidence: &lt;a href="https://github.com/edycutjong/ledgerlock" rel="noopener noreferrer"&gt;https://github.com/edycutjong/ledgerlock&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The headline numbers
&lt;/h2&gt;

&lt;p&gt;Over 100 attack runs on our own fixture bridge (Base Sepolia → Unichain Sepolia, guarded from Reactive Lasna):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Both gates shut, block timestamps (mint block → the later gate's &lt;code&gt;Paused&lt;/code&gt; block)&lt;/td&gt;
&lt;td&gt;p50 &lt;strong&gt;2 s&lt;/strong&gt; · p95 &lt;strong&gt;3 s&lt;/strong&gt; · max 3 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Base gate alone, block timestamps&lt;/td&gt;
&lt;td&gt;p50 1 s · p95 2 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unichain gate alone, same chain&lt;/td&gt;
&lt;td&gt;p50 2 s · p95 3 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pauses on in-order legitimate transfers (lock before mint)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0 of 80&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Polling observer through public RPCs (an upper bound): mint → Lasna &lt;code&gt;react()&lt;/code&gt; seen&lt;/td&gt;
&lt;td&gt;p50 3.873 s · p95 4.391 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Polling observer: both gates seen shut&lt;/td&gt;
&lt;td&gt;p50 5.92 s · p95 8.245 s · max 10.97 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Burst runs&lt;/td&gt;
&lt;td&gt;20 of 20 stopped at the first reverted copycat; at most 1 copycat landed&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The claim is deliberately narrow: &lt;strong&gt;loss ≤ the mints that land inside the measured pause window.&lt;/strong&gt; Ledgerlock does not stop the first unbacked mint. It stops the replay.&lt;/p&gt;

&lt;h2&gt;
  
  
  Inverting the ledger so the normal case is free
&lt;/h2&gt;

&lt;p&gt;The obvious design is "every mint asks whether its lock exists." That puts a callback, and a cross-chain round trip, on every legitimate transfer. I flipped it. The reactive contract subscribes to &lt;code&gt;Locked&lt;/code&gt; on Base and &lt;code&gt;Minted&lt;/code&gt; on Unichain, and keeps one slot per bridge nonce. A mint whose lock is already recorded just marks the slot consumed. No callback goes out.&lt;/p&gt;

&lt;p&gt;Only a mint with &lt;strong&gt;no&lt;/strong&gt; matching lock does anything expensive, and it does it inside the same &lt;code&gt;react()&lt;/code&gt; call. Here is the destination-side handler, lightly trimmed (from &lt;code&gt;src/LedgerlockReactive.sol&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function _onDst(uint256 r, Side side, uint256 key, address to, uint256 amt, bytes32 originTx) internal {
    uint8 dir = side == Side.MINT ? FWD : REV;
    State storage st = states[r];
    Slot storage s = slots[r][dir][key];
    if (s.srcSeen &amp;amp;&amp;amp; !s.consumed &amp;amp;&amp;amp; s.srcAmt == amt &amp;amp;&amp;amp; s.srcTo == to &amp;amp;&amp;amp; s.pendSince == 0) {
        s.consumed = true;
        return;
    }
    uint256 hs = highestSrc[r][dir];
    bool implausible = (key &amp;gt; hs &amp;amp;&amp;amp; key - hs &amp;gt; routes[r].keySlack) || s.consumed || s.pendSince != 0 || s.srcSeen;
    if (_addUnbacked(r, dir, to, amt)) implausible = true; // an amount that does not fit latches
    _pauseBoth(r, originTx, key); // two callbacks in THIS react() (no-op if already paused)
    emit Mismatch(r, side, key, amt, to, originTx, st.epoch);
    if (implausible) _latch(r, Cause.REPEAT);
    // … queue the mint as pending so its lock can still clear it
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;_pauseBoth&lt;/code&gt; sends one callback to a small gate contract on each chain. Each gate flips the bridge's own pause switch (comments trimmed):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function _pauseBoth(uint256 r, bytes32 originTx, uint256 key) internal {
    State storage st = states[r];
    if (st.paused &amp;amp;&amp;amp; !_exhausted(r)) return; // copycats never re-bill a pause that is confirmed or still in flight
    st.paused = true;
    uint64 e = ++st.epoch;
    emit PauseRequested(r, e, originTx, key);
    _request(r, 0, Kind.PAUSE, e, originTx, key); // mint side first: it stops further issuance
    _request(r, 1, Kind.PAUSE, e, originTx, key); // release side: freezes collateral exits
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The mint-side gate stops further issuance. The release-side gate freezes collateral, so the attacker can't carry the forged balance home.&lt;/p&gt;

&lt;p&gt;Because transfers can arrive out of order, a mint that &lt;em&gt;might&lt;/em&gt; be legitimate is queued, not condemned. If its lock lands within the window &lt;code&gt;W&lt;/code&gt; (60 s on our routes), both gates reopen on their own. I tested that path on purpose. In run &lt;code&gt;lf-104&lt;/code&gt; the lock was sent 8 seconds after its mint, the gates paused, and they reopened by themselves. In that run the longest a gate stayed shut was 5.1 s (observer clock). How long a false pause lasts depends on how late the lock is: across the 19 timed forced runs, where the lock arrives 2–20 s after the mint by design, a pause lasted p50 15.2 s and p95 23.1 s. A forger who guesses an implausible nonce, or reuses one, latches the route shut until the owner resolves it. That fail-closed choice has a cost of its own, covered in the limits below.&lt;/p&gt;

&lt;h2&gt;
  
  
  One attack, end to end
&lt;/h2&gt;

&lt;p&gt;Run &lt;code&gt;bu-021&lt;/code&gt; is a forged 500 tUSD mint on Unichain Sepolia with nothing locked on Base. Every step is a transaction you can open:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Forged mint mined on Unichain: &lt;code&gt;0x4bfe94f2…a84e&lt;/code&gt;, block 67743041&lt;/li&gt;
&lt;li&gt;One Lasna &lt;code&gt;react()&lt;/code&gt; with two &lt;code&gt;CallbackRequest&lt;/code&gt; logs: &lt;code&gt;0xbacbf5a0…9068&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Gate B &lt;code&gt;Paused&lt;/code&gt; on Base: &lt;code&gt;0x5eacdc82…4303&lt;/code&gt;. Gate U &lt;code&gt;Paused&lt;/code&gt; on Unichain: &lt;code&gt;0x60f4bcba…f3c4&lt;/code&gt;, block 67743043&lt;/li&gt;
&lt;li&gt;The next copycat reverts with &lt;code&gt;GatePaused&lt;/code&gt;, block 67743044. The forged release on Base reverts too.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Exposure for that run was 1,000 tUSD: the forged mint plus one copycat that landed before the pause. The judge page links each hash to its explorer.&lt;/p&gt;

&lt;p&gt;For contrast, I ran a paired control: 5 runs per arm, same forged 500 tUSD mint. The unguarded copy of the bridge let 6 copycats land, issued 3,500 tUSD and released 500 tUSD of collateral. The guarded arm let 1 copycat land, issued 1,000 tUSD, and the release reverted. The two arms fire copycats on different schedules, so read this as an illustration of the effect, not a like-for-like rate.&lt;/p&gt;

&lt;h2&gt;
  
  
  The wall: my stopwatch said the effect came before the cause
&lt;/h2&gt;

&lt;p&gt;This is the part I didn't expect. Latency is measured by an off-chain observer that polls public RPCs every 400 ms and stamps when it first &lt;em&gt;sees&lt;/em&gt; each transaction. In 66 of 100 runs it saw the Base gate's &lt;code&gt;Paused&lt;/code&gt; &lt;strong&gt;before&lt;/strong&gt; the Lasna &lt;code&gt;react()&lt;/code&gt; that caused it. In &lt;code&gt;bu-021&lt;/code&gt; above, the gate showed up at 2.184 s and the &lt;code&gt;react()&lt;/code&gt; at 3.175 s.&lt;/p&gt;

&lt;p&gt;A callback can't land before the transaction that requested it. So either the guard had a bug, or the clock did.&lt;/p&gt;

&lt;p&gt;The block timestamps settle it. They never invert: 0 of 100. In &lt;code&gt;bu-021&lt;/code&gt; the mint is at block time 1794595469, gate B at 1794595470 and gate U at 1794595471. Lasna's &lt;code&gt;react()&lt;/code&gt; is polled through a different RPC than the gates, and its first-seen time trails reality. We attribute this to Lasna RPC visibility lag. We didn't measure that lag separately, so I'm not putting a number on it.&lt;/p&gt;

&lt;p&gt;What changed in the write-up because of it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Observer seconds are labelled "first seen through public RPCs", not on-chain times. Polling plus RPC delay means they are upper bounds.&lt;/li&gt;
&lt;li&gt;The headline is now the on-chain one: whole-second block timestamps, both gates p50 2 s / p95 3 s after the mint. The Base and Unichain sequencers are separate clocks, so allow about a second either way, and Lasna stamps its blocks up to a second before the origin block, so I publish no mint → &lt;code&gt;react()&lt;/code&gt; block delta at all.&lt;/li&gt;
&lt;li&gt;In the demo video's live run, the observer's 7.986 s for gate U is called out as an upper bound. Its receipt is 2 blocks after the mint.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you benchmark cross-chain automation from a laptop, check your ordering against block timestamps before you trust it.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the evidence is kept honest
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Every pause is stored as a triple: origin tx → Lasna &lt;code&gt;react()&lt;/code&gt; → gate callback. &lt;code&gt;evidence/frozen3-triples.csv&lt;/code&gt; has 846 rows. 500 of 500 callback legs are joined to their &lt;code&gt;react()&lt;/code&gt;, with 0 &lt;code&gt;CallbackFailure&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;pnpm bench:summary&lt;/code&gt; regenerates the latency table from &lt;code&gt;evidence/frozen3-bench-runs.csv&lt;/code&gt;. CI fails if the output isn't byte-for-byte identical to the committed summary.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;pnpm burst:verify&lt;/code&gt; re-reads the 25 burst rows (20 headline + 5 paired control) from the chains with public RPC reads and no keys.&lt;/li&gt;
&lt;li&gt;113 contract tests and 29 reactive-kit Solidity tests run on the Reactive Test Lib, with 100% line, statement, branch and function coverage on &lt;code&gt;src/&lt;/code&gt;. One property test walks 262,144 random queue steps.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Honest limits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The first unbacked mint is lost.&lt;/strong&gt; So is anything else that lands before the pause.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Both routes are mine.&lt;/strong&gt; Route A is my own fixture bridge with a reproduced Nomad-class bug. Route B is my own Hyperlane warp route, delivered by my own &lt;code&gt;Mailbox.process&lt;/code&gt;, because the public relayer didn't deliver within 6 minutes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;If Lasna stops, the guard is blind&lt;/strong&gt;, and nothing pages the operator. A latched route stays shut until someone looks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A forger who picks a plausible nonce can hold the route shut&lt;/strong&gt; until the owner resolves it. Legitimate mints wait.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reorg handling is simulation only&lt;/strong&gt;, in the Test Lib, and labelled as such.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Testnet only.&lt;/strong&gt; No mainnet deployment and no outside users yet. Every bench transaction was sent by my own scripts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One measurement was dropped.&lt;/strong&gt; Two Lasna self-callback requests were never delivered, so there are no hop-sensitivity rows.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;You can check all of it without a wallet. The live status page reads both gates' state from public testnet RPCs: &lt;a href="https://ledgerlock.edycu.dev/status/" rel="noopener noreferrer"&gt;https://ledgerlock.edycu.dev/status/&lt;/a&gt;. The judge path is &lt;a href="https://ledgerlock.edycu.dev/judge" rel="noopener noreferrer"&gt;https://ledgerlock.edycu.dev/judge&lt;/a&gt;. To re-run the attack bench on your own deployment, &lt;code&gt;DEMO.md&lt;/code&gt; has the steps (about 25 lREACT on Lasna).&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/edycutjong/ledgerlock" rel="noopener noreferrer"&gt;https://github.com/edycutjong/ledgerlock&lt;/a&gt;. If you run a bridge or a warp route, I'd like to know what pause length you could live with.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>blockchain</category>
      <category>web3</category>
      <category>solidity</category>
    </item>
    <item>
      <title>Fitting a model checker into one million compiler steps</title>
      <dc:creator>Edy Cu</dc:creator>
      <pubDate>Sun, 22 Nov 2026 00:35:08 +0000</pubDate>
      <link>https://dev.to/edycutjong/fitting-a-model-checker-into-one-million-compiler-steps-2n6h</link>
      <guid>https://dev.to/edycutjong/fitting-a-model-checker-into-one-million-compiler-steps-2n6h</guid>
      <description>&lt;p&gt;An escrow contract has five actions: Deposit, Lock, Release, Refund, Dispute. Unit tests check the sequences somebody thought of. The bug that drains it is usually the sequence nobody wrote a test for.&lt;/p&gt;

&lt;p&gt;So I made the compiler try all of them. In &lt;a href="https://github.com/edycutjong/exhaust" rel="noopener noreferrer"&gt;exhaust&lt;/a&gt;, &lt;code&gt;fe build&lt;/code&gt; runs a breadth-first search over every reachable state of the escrow's state machine, checks five invariants on every state and every transition, and refuses to compile if one breaks. The search has to finish inside a hard wall: Fe 26.6.0 gives each &lt;code&gt;static_assert&lt;/code&gt; &lt;strong&gt;1,000,000 evaluator steps&lt;/strong&gt; and a recursion limit of 64. This post is about fitting a model checker under that ceiling.&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/edycutjong/exhaust" rel="noopener noreferrer"&gt;https://github.com/edycutjong/exhaust&lt;/a&gt; · 86-second demo: &lt;a href="https://youtu.be/xmKGKjVZAwA" rel="noopener noreferrer"&gt;https://youtu.be/xmKGKjVZAwA&lt;/a&gt; · page: &lt;a href="https://exhaust.edycu.dev/" rel="noopener noreferrer"&gt;https://exhaust.edycu.dev/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What it looks like when it works
&lt;/h2&gt;

&lt;p&gt;Remove one condition from the Refund guard:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt;&lt;span class="gd"&gt;-                    if s.escrow &amp;gt; 0 &amp;amp;&amp;amp; s.seller == 0 {&lt;/span&gt;
&lt;span class="gi"&gt;+                    if s.escrow &amp;gt; 0 {&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and run &lt;code&gt;fe build&lt;/code&gt; again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;error[3-0036]: assertion failed in const context
= assertion message: invariant 'paid once' broken: buyer and seller both paid
error[8-0081]: static assertion failed
= left: `11234`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The build names the broken invariant, and a second search prints the shortest attack as digits: &lt;code&gt;11234&lt;/code&gt; = Deposit, Deposit, Lock, Release, Refund. The seller is paid, then the buyer is refunded too. Replaying those five calls on the EVM, the patched contract accepts all five; the real one refuses the Refund.&lt;/p&gt;

&lt;h2&gt;
  
  
  The search is an ordinary &lt;code&gt;const fn&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;No plugin, no macro, no external tool. A state (phase, units in escrow, units paid to the seller, units refunded to the buyer) is packed into a &lt;code&gt;u32&lt;/code&gt; by a mixed-radix &lt;code&gt;encode&lt;/code&gt;, so a plain &lt;code&gt;bool&lt;/code&gt; array is the visited set and a &lt;code&gt;u32&lt;/code&gt; array is the queue:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="k"&gt;pub&lt;/span&gt; &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;explore_seeds&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="n"&gt;first&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;u32&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;u32&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="n"&gt;stride&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;u32&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="n"&gt;cap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;u32&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;usize&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;var&lt;/span&gt; &lt;span class="n"&gt;visited&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="no"&gt;SIZE&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="no"&gt;SIZE&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;var&lt;/span&gt; &lt;span class="n"&gt;queue&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;u32&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="no"&gt;SIZE&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&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="no"&gt;SIZE&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;var&lt;/span&gt; &lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;usize&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="n"&gt;var&lt;/span&gt; &lt;span class="n"&gt;tail&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;usize&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="c1"&gt;// ... enqueue the seeds ...&lt;/span&gt;
    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;head&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;tail&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;queue&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="n"&gt;head&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;cur&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;var&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;u32&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
        &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;ACTIONS&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;act&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;action_of&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;step&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cur&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;act&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cap&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ok&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;first_violation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cur&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;act&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cap&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;OK&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
                &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;visited&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="kt"&gt;usize&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="n"&gt;visited&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="kt"&gt;usize&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
                    &lt;span class="n"&gt;queue&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;tail&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;
                    &lt;span class="n"&gt;tail&lt;/span&gt; &lt;span class="o"&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="n"&gt;a&lt;/span&gt; &lt;span class="o"&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="n"&gt;tail&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(Fe's syntax is close enough to Rust that the highlighter copes.) &lt;code&gt;require&lt;/code&gt; is a chain of &lt;code&gt;assert!&lt;/code&gt;s, one per invariant, so the compile error carries the invariant's name. And the pin that runs it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="nf"&gt;static_assert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;explore&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;CAP&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="no"&gt;STATES&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;// CAP = 21, STATES = 736&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;step&lt;/code&gt; function the search calls is the same one the deployed contract's &lt;code&gt;recv&lt;/code&gt; handlers call, and the same one &lt;code&gt;fe test&lt;/code&gt; runs on the EVM (Sonatina backend) and natively. One function, three executions.&lt;/p&gt;

&lt;h2&gt;
  
  
  The wall: 1,000,000 steps
&lt;/h2&gt;

&lt;p&gt;The budget lives in the compiler's const evaluator (&lt;code&gt;crates/hir/src/analysis/semantic/ctfe/machine.rs&lt;/code&gt; at v26.6.0) and has no CLI or config override. Everything about the design follows from it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Measuring a budget you can't read.&lt;/strong&gt; The evaluator doesn't report steps used. So I measured indirectly: a burn loop alone fits 43,476 iterations (about 23 steps each); running a search in the same assert shrinks the headroom, and the difference converts to steps. Resolution is one burn iteration, about 23 steps. From &lt;code&gt;evidence/budget.md&lt;/code&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Search&lt;/th&gt;
&lt;th&gt;States&lt;/th&gt;
&lt;th&gt;Steps used&lt;/th&gt;
&lt;th&gt;Share&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;explore(0)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;86,323&lt;/td&gt;
&lt;td&gt;8.6%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;explore(17)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;494&lt;/td&gt;
&lt;td&gt;658,271&lt;/td&gt;
&lt;td&gt;65.8%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;explore(CAP)&lt;/code&gt;, C = 21&lt;/td&gt;
&lt;td&gt;736&lt;/td&gt;
&lt;td&gt;940,335&lt;/td&gt;
&lt;td&gt;94.0%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;counterexample(19)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;609&lt;/td&gt;
&lt;td&gt;908,455&lt;/td&gt;
&lt;td&gt;90.8%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;counterexample(20)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;671&lt;/td&gt;
&lt;td&gt;983,899&lt;/td&gt;
&lt;td&gt;98.4%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Three things fell out of that table.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Setup is not free.&lt;/strong&gt; &lt;code&gt;explore(0)&lt;/code&gt; visits one state and still costs 86,323 steps, because initialising an array costs about one step per element and the box holds 42,592 encodings. Two tables are 8.6% of the budget before the first state is popped. The encoding is a bijection onto &lt;code&gt;0..SIZE&lt;/code&gt; with &lt;code&gt;SIZE = 4 × 22³&lt;/code&gt;, and C = 21 is the largest capacity it holds, so the box can't shrink without shrinking the model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Consts share a budget, asserts don't.&lt;/strong&gt; A const that references another const is evaluated in the same budget. A separate &lt;code&gt;static_assert&lt;/code&gt; gets a fresh million. So every search is its own assert, and the reachable set is also split into &lt;strong&gt;shards&lt;/strong&gt; that each get their own budget: after Lock the total never changes, so the states reachable from (Locked, k, 0, 0) all have total k and shards with different k can't overlap:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="nf"&gt;static_assert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;explore_seeds&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;LOCKED_BASE&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="no"&gt;LOCKED_STRIDE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;LOCKED_STRIDE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;CAP&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;91&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;static_assert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;explore_seeds&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;LOCKED_BASE&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="no"&gt;LOCKED_STRIDE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;LOCKED_STRIDE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;CAP&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;238&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;static_assert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;explore_seeds&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;LOCKED_BASE&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="no"&gt;LOCKED_STRIDE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;LOCKED_STRIDE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;CAP&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;385&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;91 + 238 + 385 plus the 22 Open states is 736. A runtime test checks that sum on both backends, and the independent Python model checks that the shards are disjoint and cover the set.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. The attack printer runs at a smaller capacity.&lt;/strong&gt; Printing a trace needs parent pointers and the action that reached each state: four tables instead of two, and more work per state. At C = 21 it doesn't fit. C = 20 fits with 1.6% to spare, which is too close: one conformance check adds two branches to &lt;code&gt;step()&lt;/code&gt; and pushes it over. So the printer is pinned at &lt;strong&gt;C′ = 19&lt;/strong&gt;, which leaves room for edits. The trace itself is walked back from the violating edge and accumulated as base-10 digits in a &lt;code&gt;u256&lt;/code&gt;, with an assert that stops before 77 digits would overflow.&lt;/p&gt;

&lt;p&gt;The recursion limit of 64 is why everything is a &lt;code&gt;while&lt;/code&gt; loop. A recursive DFS would hit it long before the step budget.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why trust the model matches the contract
&lt;/h2&gt;

&lt;p&gt;A model checker that checks the wrong model proves nothing, so three independent things tie them together:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the contract's &lt;code&gt;recv&lt;/code&gt; handlers are thin adapters: load storage into &lt;code&gt;State&lt;/code&gt;, call the same &lt;code&gt;step()&lt;/code&gt;, store the result;&lt;/li&gt;
&lt;li&gt;an exhaustive-edge test replays every reachable transition through the deployed contract (966 accepted edges, 3,680 attempts) and compares the result and the encoded state;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;tools/ref_model.py&lt;/code&gt;, a stdlib-only Python model written separately, agrees with all 15 pins (8 escrow, 7 vault).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A second protocol, a 2-of-3 approval vault with a timelock (211 states, 10 invariants including a transition invariant), uses the same pattern. Nine planted bug patches each have to fail &lt;code&gt;fe build&lt;/code&gt; by name, and a CI job fails if any of them builds.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this does not prove
&lt;/h2&gt;

&lt;p&gt;Bounded-exhaustive, not formal verification. Only the stated capacities are explored (C = 21 for the count, C′ = 19 for the trace). No liveness. The escrow model has no caller identity, so &lt;code&gt;msg.sender&lt;/code&gt; authorization is out of scope, and units are abstract counters, so value transfer, reentrancy and gas are too. The model, the Fe code and the oracle share one author, which is why the oracle exists, but it is not a second team. Everything is measured on Fe 26.6.0; 26.7.0 has the same budget in its source and wasn't re-measured.&lt;/p&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;git clone https://github.com/edycutjong/exhaust &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd&lt;/span&gt; exhaust
&lt;span class="c"&gt;# install Fe 26.6.0 as in the README, then:&lt;/span&gt;
demo/run.sh          &lt;span class="c"&gt;# green build, one-line patch, red build naming 'paid once' with 11234&lt;/span&gt;
demo/check-bugs.sh   &lt;span class="c"&gt;# every planted bug must fail the build by name&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every number above has a command next to it in &lt;a href="https://github.com/edycutjong/exhaust/blob/main/DEMO.md" rel="noopener noreferrer"&gt;DEMO.md&lt;/a&gt;. Built for the Fe Builders Challenge 2026. If you write Fe, the pattern (a &lt;code&gt;const fn&lt;/code&gt; search, &lt;code&gt;static_assert&lt;/code&gt; pins, one asserted search per budget) is the part worth copying.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>compilers</category>
      <category>smartcontracts</category>
      <category>testing</category>
    </item>
    <item>
      <title>A Bitcoin Cash covenant that pays your network fee, and why you pay it back in dollars</title>
      <dc:creator>Edy Cu</dc:creator>
      <pubDate>Sat, 21 Nov 2026 14:36:58 +0000</pubDate>
      <link>https://dev.to/edycutjong/a-bitcoin-cash-covenant-that-pays-your-network-fee-and-why-you-pay-it-back-in-dollars-3h5f</link>
      <guid>https://dev.to/edycutjong/a-bitcoin-cash-covenant-that-pays-your-network-fee-and-why-you-pay-it-back-in-dollars-3h5f</guid>
      <description>&lt;p&gt;Someone pays you $20 in PUSD, a dollar token on Bitcoin Cash. You try to send $5 of it on, and your wallet may refuse: every transaction needs a miner fee paid in BCH, and you hold none you can spend. The usual answer is "go buy some BCH first", which is exactly where a new user stops.&lt;/p&gt;

&lt;p&gt;I built &lt;a href="https://feepass.edycu.dev" rel="noopener noreferrer"&gt;FeePass&lt;/a&gt; for BCH BLAZE 2026 to remove that step. It is live on mainnet, the code is &lt;a href="https://github.com/edycutjong/feepass" rel="noopener noreferrer"&gt;on GitHub&lt;/a&gt;, and the first sponsored send is on chain: &lt;a href="https://bchexplorer.info/tx/d59f120b5852280d98d6a84379c08e5b3cc11015a9c0f637e60577884aa6f8b7" rel="noopener noreferrer"&gt;&lt;code&gt;d59f120b…f8b7&lt;/code&gt;&lt;/a&gt;. This post is about the one design decision that shaped everything else: why the sender still pays, and why they pay in dollars.&lt;/p&gt;

&lt;h2&gt;
  
  
  The shape: one ordinary transaction
&lt;/h2&gt;

&lt;p&gt;A FeePass send is a single transaction with a fixed shape:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;in0&lt;/strong&gt; is your PUSD coin, signed by your own wallet.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;in1&lt;/strong&gt; is one "lane" of a sponsor pool: a UTXO locked by a CashScript covenant. Nobody signs it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;out0&lt;/strong&gt; sends PUSD to the recipient, &lt;strong&gt;out1&lt;/strong&gt; is your PUSD change.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;out2&lt;/strong&gt; is the lane going back to the pool, minus the miner fee, plus exactly 0.01 PUSD.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The lane's BCH pays the miner. Your wallet never touches BCH. On mainnet that first send looked like this: 572 bytes, a 580-sat miner fee paid by the lane, and the sender's spendable BCH was 0 before and 0 after.&lt;/p&gt;

&lt;h2&gt;
  
  
  The wall: a covenant cannot remember you
&lt;/h2&gt;

&lt;p&gt;My first idea was the obvious one: free sends, a few per person. A paymaster with a budget.&lt;/p&gt;

&lt;p&gt;That does not survive contact with a covenant. A covenant is a spending condition on one coin. It can read the transaction it is being spent in (inputs, outputs, values, token amounts) through native introspection, but it has no memory across transactions and no notion of "a person". A rule like "at most 3 free sends per user" needs to know who the user is and what they did yesterday. Any limit keyed to an address is defeated by generating a fresh address, which costs nothing. Free sends from a covenant are drainable by anyone with a loop.&lt;/p&gt;

&lt;p&gt;You can move that memory off-chain into a server that co-signs every transaction, which is roughly how fee-payer relayers work elsewhere. But then the sponsor key is online, the server is the trust model, and the rule no longer lives on chain.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix: make every send pay for itself
&lt;/h2&gt;

&lt;p&gt;So the covenant does not try to recognise anyone. Instead, every send must leave the pool better off in dollars than it was in sats:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// R4 hard per-transaction cap on what the lane can lose.
require(tx.outputs[2].value &amp;gt;= tx.inputs[1].value - maxSubsidy);

// R5 the pool receives exactly feeTokens PUSD: never less, never more.
require(tx.outputs[2].tokenCategory == pusdCategory);
require(tx.outputs[2].tokenAmount == tx.inputs[1].tokenAmount + feeTokens);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;maxSubsidy&lt;/code&gt; is 2,000 sats: the most one lane can lose in one transaction. &lt;code&gt;feeTokens&lt;/code&gt; is 1 base unit of PUSD, which is 0.01 PUSD. As long as 0.01 PUSD is worth more than 2,000 sats, draining the pool costs the attacker more than it takes, no matter how many addresses they generate. The deploy script refuses parameters without a 1.5× margin; at the price it checked when the lane was funded (BCH $192.64), a standard send costs the lane 580 sats, about $0.0011, and pays the pool $0.01.&lt;/p&gt;

&lt;p&gt;It is an equality on purpose. "At least 0.01 PUSD" would let a buggy client overpay; "exactly" means the pool's side of the transaction is fully determined.&lt;/p&gt;

&lt;h2&gt;
  
  
  The rest of the rules
&lt;/h2&gt;

&lt;p&gt;The covenant's paid path is short enough to read in one sitting. The full file is &lt;a href="https://github.com/edycutjong/feepass/blob/main/contracts/FeePassPool.cash" rel="noopener noreferrer"&gt;&lt;code&gt;contracts/FeePassPool.cash&lt;/code&gt;&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function sponsorPaid() {
    // R1 fixed shape: exactly one user input, one pool input, three outputs.
    require(tx.inputs.length == 2);
    require(tx.outputs.length == 3);
    require(this.activeInputIndex == 1);

    // R2 the user brings PUSD and sends PUSD.
    require(tx.inputs[0].tokenCategory == pusdCategory);
    require(tx.outputs[0].tokenCategory == pusdCategory);

    // R3 the lane returns to the same covenant.
    require(tx.outputs[2].lockingBytecode == tx.inputs[1].lockingBytecode);

    // R6 the user-side outputs may exceed the user's input sats by at most maxTopUp
    require(tx.outputs[0].value + tx.outputs[1].value &amp;lt;= tx.inputs[0].value + maxTopUp);
    // ... R4, R5, R7, R8
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;R6 exists because token outputs need dust. A partial PUSD send creates two token outputs of about 650 sats each, and a small user coin may not carry enough. The lane may top that up by at most 675 sats per send. On the first mainnet send, the lane's total cost was 882 sats: the 580-sat miner fee plus 302 sats of dust top-up.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the covenant deliberately does not check
&lt;/h2&gt;

&lt;p&gt;It does not pick the recipient. The pool only enforces its own side: shape, cap, and the fee coming back. Who gets paid is bound by the sender's own signature, &lt;code&gt;SIGHASH_ALL|FORKID|UTXOS&lt;/code&gt; (0x61), over input 0. The app asks the wallet to sign only that input over WizardConnect, then verifies the signed transaction on the BCH VM before broadcasting it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two senders, one lane
&lt;/h2&gt;

&lt;p&gt;A lane's change can be spent again before it confirms, so two people can grab the same lane at once. The second broadcast fails with &lt;code&gt;txn-mempool-conflict&lt;/code&gt;. The app then picks another random open lane and asks the wallet for one more signature with the &lt;strong&gt;same coin&lt;/strong&gt;, at most twice. Reusing the same coin matters: only one version of your payment can ever confirm.&lt;/p&gt;

&lt;h2&gt;
  
  
  Honest limits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;One lane is funded today; 20 is the target. Concurrency is real but thin.&lt;/li&gt;
&lt;li&gt;The first mainnet send was signed by a headless test key through the app's own builder and VM check, not by a named wallet. Whether a given wallet accepts a request to sign one input with sighash 0x61 is exactly what the in-app wallet gate records; none is verified yet.&lt;/li&gt;
&lt;li&gt;"No spendable BCH" is not "zero BCH": a token coin always carries a few hundred sats of dust.&lt;/li&gt;
&lt;li&gt;The fee is fixed at deploy, not oracle-priced. The covenant bounds each send, not the pool's total.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Open &lt;a href="https://feepass.edycu.dev" rel="noopener noreferrer"&gt;feepass.edycu.dev&lt;/a&gt;, connect a WizardConnect wallet, claim 0.25 starter PUSD if you have none, and send 0.10 PUSD. The ticket shows your spendable BCH before and after, read from the chain. Judges and the curious can start at the &lt;a href="https://feepass.edycu.dev/judge/" rel="noopener noreferrer"&gt;60-second page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Code, tests (189 unit and covenant VM tests, 32 end-to-end) and every mainnet txid: &lt;a href="https://github.com/edycutjong/feepass" rel="noopener noreferrer"&gt;github.com/edycutjong/feepass&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>bitcoin</category>
      <category>blockchain</category>
      <category>webdev</category>
    </item>
    <item>
      <title>The last seat pays the seller: one transaction that swaps, seats and pays on QIE mainnet</title>
      <dc:creator>Edy Cu</dc:creator>
      <pubDate>Sun, 15 Nov 2026 09:32:24 +0000</pubDate>
      <link>https://dev.to/edycutjong/the-last-seat-pays-the-seller-one-transaction-that-swaps-seats-and-pays-on-qie-mainnet-4h48</link>
      <guid>https://dev.to/edycutjong/the-last-seat-pays-the-seller-one-transaction-that-swaps-seats-and-pays-on-qie-mainnet-4h48</guid>
      <description>&lt;p&gt;Every group that books something together has one person who fronts the money. Picture Rina booking the Thursday 5-a-side football pitch: she pays the court, shares the cost in the group chat, then spends a week chasing people. If half the group drops out, she is the one who is short, and getting refunds back depends on her.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Patungan&lt;/em&gt; is Indonesian for chipping in together. I built a contract that removes the person in the middle. Everyone pays their own seat into an escrow. &lt;strong&gt;The last seat pays the seller in that same transaction.&lt;/strong&gt; If the deadline passes first, every member takes their money back.&lt;/p&gt;

&lt;p&gt;It is live on QIE mainnet: &lt;a href="https://mainnet.qie.digital/address/0x2f4646D52a5393E239f5b880411dC2CA2D945F31#code" rel="noopener noreferrer"&gt;&lt;code&gt;0x2f4646D52a5393E239f5b880411dC2CA2D945F31&lt;/code&gt;&lt;/a&gt;, with source verified on Blockscout.&lt;br&gt;
Live app: &lt;a href="https://patungan.edycu.dev" rel="noopener noreferrer"&gt;patungan.edycu.dev&lt;/a&gt; · repo: &lt;a href="https://github.com/edycutjong/patungan" rel="noopener noreferrer"&gt;github.com/edycutjong/patungan&lt;/a&gt; · no-wallet judge path: &lt;a href="https://patungan.edycu.dev/judge" rel="noopener noreferrer"&gt;/judge&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The 2:41 demo, recorded against the live mainnet contract:&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/3zRlpNRRk2M" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;This post is about the one transaction that makes it work, and the two walls I hit getting it onto mainnet.&lt;/p&gt;

&lt;h2&gt;
  
  
  The rule: whoever fills the pool pays the seller
&lt;/h2&gt;

&lt;p&gt;The escrow logic is short. Every join ends in &lt;code&gt;_seat&lt;/code&gt;. When the seat count reaches the target, the same call flips the pool to &lt;code&gt;Paid&lt;/code&gt; and transfers the whole pot to the payee:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function _seat(uint256 id, Pool storage p, address member, uint16 n, uint256 amount) private {
    if (seatsOf[id][member] == 0) members[id].push(member);
    seatsOf[id][member] += n;
    paid[id][member] += amount;
    p.filled += n;
    p.held += uint128(amount);
    totalHeld += amount;
    if (p.filled == p.seats) {
        uint256 total = p.held;
        p.status = Status.Paid;
        p.held = 0;
        totalHeld -= total;
        emit PoolPaid(id, p.payee, total);
        qusdc.safeTransfer(p.payee, total); // the last seat pays the payee in the same transaction
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There is no "release" button and no keeper. Nobody has to come back later to trigger the payout. The payee can be a &lt;code&gt;.qie&lt;/code&gt; name from QIE's Zone naming contract. The contract resolves it when the pool is created and stores the owner address it found. If the name points somewhere other than the address the form showed, creation reverts with &lt;code&gt;PayeeChanged&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The hard part: the member holds QIE, the seller wants a stablecoin
&lt;/h2&gt;

&lt;p&gt;Pools are priced in QUSDC, so the seller knows exactly what they receive. But a member may hold only the native QIE token. Making them buy QUSDC on a DEX first, then approve, then join, is three steps before they can even take a seat.&lt;/p&gt;

&lt;p&gt;So &lt;code&gt;joinWithQIE&lt;/code&gt; takes native QIE, buys exactly the QUSDC the seats cost (n × price) on QIEDEX, seats the member, and returns the unspent QIE, all in one call. If that member takes the last seat, the payout above runs in the same transaction too.&lt;/p&gt;

&lt;p&gt;The catch is that &lt;strong&gt;the QIEDEX router's source is not verified on the explorer&lt;/strong&gt;. I am sending users' funds through a contract I cannot read. So the contract does not trust the router's quote. It checks it against the QIE Oracle:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function _swapIn(uint256 amount) private returns (uint256 qieSpent, uint256 oraclePrice) {
    uint256 fairQie;
    (fairQie, oraclePrice) = _fairQie(amount);
    uint256 ceiling = fairQie * (10_000 + maxDevBps) / 10_000;
    address[] memory path = _path();
    uint256 qieIn = router.getAmountsIn(amount, path)[0];
    if (qieIn &amp;gt; ceiling) revert PriceDeviation(fairQie, qieIn);
    if (msg.value &amp;lt; qieIn) revert ValueTooLow(qieIn, msg.value);

    uint256 nativeBefore = address(this).balance;
    uint256 qusdcBefore = qusdc.balanceOf(address(this));
    router.swapETHForExactTokens{value: Math.min(msg.value, ceiling)}(amount, path, address(this), block.timestamp);
    if (qusdc.balanceOf(address(this)) - qusdcBefore &amp;lt; amount) revert SwapShort();
    qieSpent = nativeBefore - address(this).balance;
    if (qieSpent &amp;gt; ceiling) revert PriceDeviation(fairQie, qieSpent);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each check is there because of a specific way an untrusted router could cheat. Each one has a test with a hostile mock router:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Before the swap:&lt;/strong&gt; if the router's quote is above the Oracle's fair value plus the guard (1,500 bps on the deployed contract), the call reverts. A skewed pool cannot push a member more than 15% past the Oracle's fair value.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;During the swap:&lt;/strong&gt; the router is handed at most &lt;code&gt;min(msg.value, ceiling)&lt;/code&gt;. It cannot take more than the ceiling even if it ignores its own quote.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;After the swap:&lt;/strong&gt; the contract measures what actually happened from its own balances. Less QUSDC than one seat reverts &lt;code&gt;SwapShort&lt;/code&gt;, and more QIE spent than the ceiling reverts &lt;code&gt;PriceDeviation&lt;/code&gt;. A re-entrant router hits the &lt;code&gt;nonReentrant&lt;/code&gt; guard.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Oracle read also refuses a price of zero or below, and a round older than the deployed maximum age.&lt;/p&gt;

&lt;h2&gt;
  
  
  Opening up the real transaction
&lt;/h2&gt;

&lt;p&gt;Pool #1 on mainnet had 2 seats at 0.25 QUSDC. The second seat was paid in QIE: tx &lt;a href="https://mainnet.qie.digital/tx/0x4bd5c37de92855d3993a88698543c9d7c51dccde97f0fcd8d484450cd359a7a0" rel="noopener noreferrer"&gt;&lt;code&gt;0x4bd5c37d…a7a0&lt;/code&gt;&lt;/a&gt;. I traced it with &lt;code&gt;debug_traceTransaction&lt;/code&gt; over the public RPC (&lt;code&gt;script/mainnet-trace.py&lt;/code&gt;, read-only). There are 18 calls inside it. Shortened:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;B2 → Patungan       joinWithQIE(pool 1), value 1.7223790439 QIE
Patungan → Oracle   latestRoundData → 0.15516198 USDT per QIE
Patungan → QIEDEX   getAmountsIn(0.25 QUSDC) → 1.7053257861 QIE
Patungan → QIEDEX   swapETHForExactTokens(exact out 0.25 QUSDC)
QIEDEX → Patungan   0.0170532579 QIE unspent
Patungan → QUSDC    balanceOf(Patungan) → 0.50 QUSDC
Patungan → QUSDC    transfer 0.50 QUSDC → qkulk75527.qie (payee)
Patungan → B2       0.0170532579 QIE change
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At that Oracle price, the fair value of a 0.25 QUSDC seat was 1.6112 QIE. The swap cost &lt;strong&gt;+584 bps over fair value, against a 1,500 bps guard&lt;/strong&gt;. The whole thing used 267,557 gas. The member's QIE went in, a seat was taken, the seller was paid, and the change went back, all in one transaction.&lt;/p&gt;

&lt;p&gt;The refund path ran on mainnet too. Pool #2 filled 3 of its 6 seats before the deadline passed. One &lt;code&gt;refundAll&lt;/code&gt; (&lt;a href="https://mainnet.qie.digital/tx/0x7886eba210a403a13e808b236a02c53564684f25332bb7b2db67ebcc8cd69f0a" rel="noopener noreferrer"&gt;&lt;code&gt;0x7886eba2…0f0a&lt;/code&gt;&lt;/a&gt;, 155,766 gas) returned 0.25 QUSDC to each of the 3 members. &lt;code&gt;refundAll&lt;/code&gt; skips anyone who already claimed, so nobody gets refunded twice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wall 1: the chain said no to Cancun
&lt;/h2&gt;

&lt;p&gt;QIE mainnet (chain 1990) is EVM-compatible, but not at the latest hard fork, so the compiler's EVM target has to match the chain. Instead of guessing, I wrote &lt;code&gt;script/mainnet-probe.sh&lt;/code&gt;. It sends tiny bytecode snippets to the public RPC through &lt;code&gt;eth_call&lt;/code&gt;, one per opcode:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PUSH0  (0x5f, Shanghai): "0x2a"
MCOPY  (0x5e, Cancun)  : ... invalid opcode: opcode 0x5e not defined
TSTORE (0x5d, Cancun)  : ... invalid opcode: opcode 0x5d not defined
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So &lt;code&gt;foundry.toml&lt;/code&gt; pins &lt;code&gt;evm_version = "shanghai"&lt;/code&gt;. On a smaller EVM chain, run a probe like this before you trust a compiler default. It is a cheap check, and it beats debugging a deploy that reverts on an opcode the chain does not have.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wall 2: the worst bug was in the browser, not the contract
&lt;/h2&gt;

&lt;p&gt;The contract ended up at 100% line and branch coverage. The bug that would actually have cost a user money was in the web app's join sheet.&lt;/p&gt;

&lt;p&gt;Paying in QUSDC takes two steps: Approve, then Pay. Paying in QIE takes one. In a scripted browser run on a fork of mainnet, a test member opened the join sheet, closed it, and reopened it. A QIE quote requested by the &lt;em&gt;closed&lt;/em&gt; sheet arrived late and re-bound the reopened sheet's &lt;strong&gt;"1 · Approve"&lt;/strong&gt; button to &lt;code&gt;joinWithQIE&lt;/code&gt;. After the run, the chain showed &lt;code&gt;seatsOf(7, Dave) = 2&lt;/code&gt; and an allowance of 0. The click labelled Approve had bought a seat.&lt;/p&gt;

&lt;p&gt;A second one was simpler: without a lock, a double tap on Pay bought 2 seats.&lt;/p&gt;

&lt;p&gt;Both are fixed. Every opening of the sheet gets a session number, and a read or wallet prompt from an older session can no longer write into, bind handlers on, or close the current one. The sheet also locks before the wallet prompt. The evidence folder keeps the failing Playwright runs (the old sheet code, and the code with the lock removed: &lt;code&gt;double tap bought 2 seats&lt;/code&gt;) next to the passing run on the current code. If your contract is airtight, look at the code that decides &lt;em&gt;which&lt;/em&gt; transaction gets sent.&lt;/p&gt;

&lt;h2&gt;
  
  
  The numbers, briefly
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;74 &lt;code&gt;forge&lt;/code&gt; tests: 50 on mocks (unit, fuzz, an invariant suite), and 24 that read live mainnet state for QUSDC, QIEDEX, Zone and the Oracle. 100% line, statement, branch and function coverage on &lt;code&gt;src/&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;204 web unit tests at 100% coverage, plus 42 Playwright tests run against live mainnet reads.&lt;/li&gt;
&lt;li&gt;A mutation check: 5 of 5 injected bugs caught.&lt;/li&gt;
&lt;li&gt;On a fork, 12 QIE joins paid a median of +564 bps over the Oracle's fair value (guard: 1,500).&lt;/li&gt;
&lt;li&gt;All 20 go-live transactions succeeded. QIE blocks took about 3.6 s on average (3,596 ms from Blockscout stats).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Reproduce it without any keys: &lt;code&gt;forge test -vv&lt;/code&gt; forks QIE mainnet through the public RPC.&lt;/p&gt;

&lt;h2&gt;
  
  
  Honest limits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No real users yet.&lt;/strong&gt; The only mainnet pools are my two demo pools. Every member wallet in them is mine and is labelled "builder wallet" in the app. The PAID pool paid my own name, &lt;code&gt;qkulk75527.qie&lt;/code&gt;, not a real seller.&lt;/li&gt;
&lt;li&gt;Gas and slippage figures not marked mainnet were measured on a fork.&lt;/li&gt;
&lt;li&gt;Distinct wallets are not distinct people. Any usage count I publish counts wallets.&lt;/li&gt;
&lt;li&gt;QUSDC's issuer holds a &lt;code&gt;VAULT_ROLE&lt;/code&gt; and can burn escrowed tokens. If that happens a pool cannot make everyone whole. Patungan then refuses new joins (an &lt;code&gt;Insolvent&lt;/code&gt; revert; &lt;code&gt;isSolvent()&lt;/code&gt; exposes the check) while refunds stay open. It has no admin key of its own.&lt;/li&gt;
&lt;li&gt;Refunds come back in QUSDC, even if you joined with QIE.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;No wallet is needed to check any of this. The pool pages and &lt;code&gt;/verify&lt;/code&gt; are read-only calls against the mainnet contract.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PAID pool: &lt;a href="https://patungan.edycu.dev/p/mainnet-1/1" rel="noopener noreferrer"&gt;patungan.edycu.dev/p/mainnet-1/1&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;REFUNDED pool: &lt;a href="https://patungan.edycu.dev/p/mainnet-1/2" rel="noopener noreferrer"&gt;patungan.edycu.dev/p/mainnet-1/2&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Judge path: &lt;a href="https://patungan.edycu.dev/judge" rel="noopener noreferrer"&gt;patungan.edycu.dev/judge&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Source, tests and evidence: &lt;a href="https://github.com/edycutjong/patungan" rel="noopener noreferrer"&gt;github.com/edycutjong/patungan&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you run a group that splits a booking every week, I would like to hear whether this matches how your group actually pays.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>solidity</category>
      <category>web3</category>
      <category>blockchain</category>
    </item>
    <item>
      <title>A Sui naturalist that gets graded by the chain: building RIMBA for Tatum Walrus</title>
      <dc:creator>Edy Cu</dc:creator>
      <pubDate>Tue, 10 Nov 2026 12:49:23 +0000</pubDate>
      <link>https://dev.to/edycutjong/a-sui-naturalist-that-gets-graded-by-the-chain-building-rimba-for-tatum-walrus-4ng4</link>
      <guid>https://dev.to/edycutjong/a-sui-naturalist-that-gets-graded-by-the-chain-building-rimba-for-tatum-walrus-4ng4</guid>
      <description>&lt;p&gt;&lt;strong&gt;RIMBA is a naturalist agent that guesses what big Sui wallets will do next, gets graded by the chain minutes later, and remembers the result in Walrus Memory. This post is about how it keeps score, and what the score says so far.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/edycutjong/rimba" rel="noopener noreferrer"&gt;https://github.com/edycutjong/rimba&lt;/a&gt; · Live reef: &lt;a href="https://rimba.edycu.dev" rel="noopener noreferrer"&gt;https://rimba.edycu.dev&lt;/a&gt; · Demo video: &lt;a href="https://youtu.be/7qJOvaxraEQ" rel="noopener noreferrer"&gt;https://youtu.be/7qJOvaxraEQ&lt;/a&gt; (recorded 7–8 Nov on development data, before Walrus Memory went live)&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Data mode, up front.&lt;/strong&gt; This write-up is for the Walrus × Tatum Total Recall hackathon. The headline scorecard counts only rounds streamed through Tatum's Sui gRPC gateway &lt;em&gt;and&lt;/em&gt; recalled from Walrus Memory. Tatum went live on 7 Nov 15:39 UTC and Walrus Memory on 8 Nov 03:12:53 UTC. Earlier rows (Sui's public fullnode, or a local memory stand-in) are labelled development data and never counted. Figures below are frozen at the 10 Nov re-freeze, 12:37:50 UTC; the logger keeps running.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;A watcher sees a large wallet move for the fifth time today and has to guess, again, whether it moves again. Nobody scores those guesses, so nobody learns whose read to trust. On Sui a "what happens next" question can be answered in minutes from the chain itself, which makes it a good place to build an agent whose memory is graded.&lt;/p&gt;

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

&lt;p&gt;For every large transfer on the mainnet checkpoint stream, RIMBA writes a &lt;em&gt;sighting&lt;/em&gt;. Plain code, with no LLM in the call path, turns it into a species sentence: size bucket, round or odd amount, number of recipients, time of day, new or repeat counterparty, the wallet's recent pace, how often it was seen before, and the coin.&lt;/p&gt;

&lt;p&gt;The naturalist then recalls similar field notes from Walrus Memory, calls "this wallet moves again within 15 minutes: yes or no" with a probability, and records which notes it cited. The same stream resolves the call. The outcome is written back to Walrus as a new note, so the next similar sighting can get a different answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it uses Tatum and Walrus
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tatum Sui gRPC.&lt;/strong&gt; &lt;code&gt;SubscriptionService/SubscribeCheckpoints&lt;/code&gt; is both the source of sightings and the resolver; &lt;code&gt;LedgerService/GetCheckpoint&lt;/code&gt; and &lt;code&gt;GetTransaction&lt;/code&gt; back the &lt;code&gt;pnpm verify&lt;/code&gt; command that re-derives outcomes from the chain. The &lt;code&gt;.proto&lt;/code&gt; files are vendored from MystenLabs/sui-apis, and the endpoint is a one-line switch, so I built and tested the whole decode path against the public fullnode first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Walrus Memory.&lt;/strong&gt; &lt;code&gt;recall&lt;/code&gt; is widened to log near-misses, but only notes within the cut-off (0.35 for Walrus) vote, otherwise the agent abstains; &lt;code&gt;scoringWeights&lt;/code&gt; is set so newer notes win; &lt;code&gt;rememberBulk&lt;/code&gt; writes outcomes. Live since 8 Nov: 479 outcome notes stored on Walrus by the freeze. Recall failures tripped RIMBA's circuit breaker 8 times (3 failures → 60 s without memory). Memories are immutable, so a changed habit is a newer superseding note rather than an edit.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How it scores itself
&lt;/h2&gt;

&lt;p&gt;Every round freezes three predictions at the same instant: the memory call, the global base rate, and that address's own frequency table. The score is a Brier score, the mean of &lt;code&gt;(p − outcome)²&lt;/code&gt;; always guessing 0.5 scores 0.25, and lower is better.&lt;/p&gt;

&lt;p&gt;The core of the call is small. Each cited note votes with a weight that falls with its semantic distance, the vote is shrunk toward the base rate, and the agent abstains if the total evidence is thin:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;distance&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;maxDistance&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// in (0, 1]&lt;/span&gt;
&lt;span class="n"&gt;wy&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;note&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;yes&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;wn&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;note&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// ...&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;wn&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;minEvidence&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;call&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'abstain'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;abstainReason&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'too-little-evidence'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;clamp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;wy&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;wn&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;)&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;Abstain thresholds live in &lt;code&gt;config/rimba.json&lt;/code&gt;. The local stand-in's were set on development rows. The Walrus cut-off (0.35) was set before any live recall ran and has not been recalibrated; any change will be stated in the README.&lt;/p&gt;

&lt;h2&gt;
  
  
  The scorecard (Tatum stream × Walrus Memory)
&lt;/h2&gt;

&lt;p&gt;Question: does the sender move again within 15 minutes? Re-freeze, 10 Nov 2026 19:37:50 WIB, 4,157 resolved headline rounds:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;subset&lt;/th&gt;
&lt;th&gt;rounds&lt;/th&gt;
&lt;th&gt;Brier memory&lt;/th&gt;
&lt;th&gt;Brier base rate&lt;/th&gt;
&lt;th&gt;Brier frequency&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;never-seen addresses&lt;/td&gt;
&lt;td&gt;1,918&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.0699&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.1425&lt;/td&gt;
&lt;td&gt;0.1425&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;seen before&lt;/td&gt;
&lt;td&gt;2,239&lt;/td&gt;
&lt;td&gt;0.1964&lt;/td&gt;
&lt;td&gt;0.2848&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.1314&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;all&lt;/td&gt;
&lt;td&gt;4,157&lt;/td&gt;
&lt;td&gt;0.1380&lt;/td&gt;
&lt;td&gt;0.2191&lt;/td&gt;
&lt;td&gt;0.1365&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;On wallets it has never seen, memory beats the base rate by half (50.9 % skill). On wallets it has seen before, the plain per-address frequency table beats memory, and across all rounds the two are close. The development rows, for comparison only (public fullnode, local stand-in): never-seen N = 1,130, 0.1085 against 0.1693; all 2,408, 0.1421 against 0.2370.&lt;/p&gt;

&lt;p&gt;Two holes in the run, both disclosed in the README: 5 h 18 min on 7–8 Nov when the free Tatum credits ran out, and about 34 h on 9–10 Nov when the machine running the logger lost network. No rounds exist in those windows.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to check it yourself
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pnpm install
pnpm &lt;span class="nb"&gt;test&lt;/span&gt;      &lt;span class="c"&gt;# 118 tests&lt;/span&gt;
pnpm score     &lt;span class="c"&gt;# Brier tables&lt;/span&gt;
pnpm verify    &lt;span class="c"&gt;# invariants I1-I3, then re-derive a sample of outcomes from the chain&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At this freeze the invariants hold on 8,053 logged calls (every cited note was written and submitted before the call that cites it: 139,859 of 139,859), and 50 of 50 sampled sightings and 50 of 50 sampled outcomes re-derive from the chain through the Tatum gateway.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limitations
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Dev rows are never the headline, and the headline is one run of a few days with two outages. Read the N next to every number.&lt;/li&gt;
&lt;li&gt;"Moves again within 15 minutes" is partly a habit question, so the frequency table is hard to beat on known wallets.&lt;/li&gt;
&lt;li&gt;Gateway latency is unmeasured; the Tatum credit burn (about 30K/h on the full stream) is measured, and a burst of GetTransaction calls drew HTTP 429.&lt;/li&gt;
&lt;li&gt;Not every outcome becomes a note: writes have a 400-note-a-day budget (&lt;code&gt;config/rimba.json&lt;/code&gt;), so the writer prioritises novel species and supersedes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Code, live reef and demo video: &lt;a href="https://github.com/edycutjong/rimba" rel="noopener noreferrer"&gt;https://github.com/edycutjong/rimba&lt;/a&gt; · &lt;a href="https://rimba.edycu.dev" rel="noopener noreferrer"&gt;https://rimba.edycu.dev&lt;/a&gt; · &lt;a href="https://youtu.be/7qJOvaxraEQ" rel="noopener noreferrer"&gt;https://youtu.be/7qJOvaxraEQ&lt;/a&gt;&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>sui</category>
      <category>web3</category>
      <category>typescript</category>
    </item>
  </channel>
</rss>
