<?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: DeByta</title>
    <description>The latest articles on DEV Community by DeByta (@debyta).</description>
    <link>https://dev.to/debyta</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%2F4266709%2F8f89d5df-5b60-497a-8540-6a16a62db218.png</url>
      <title>DEV Community: DeByta</title>
      <link>https://dev.to/debyta</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/debyta"/>
    <language>en</language>
    <item>
      <title>Your agent pays whatever address the server says. Here is how to make payTo unswappable.</title>
      <dc:creator>DeByta</dc:creator>
      <pubDate>Thu, 26 Nov 2026 11:08:43 +0000</pubDate>
      <link>https://dev.to/debyta/your-agent-pays-whatever-address-the-server-says-here-is-how-to-make-payto-unswappable-3fhn</link>
      <guid>https://dev.to/debyta/your-agent-pays-whatever-address-the-server-says-here-is-how-to-make-payto-unswappable-3fhn</guid>
      <description>&lt;h2&gt;
  
  
  The weakest field in every crypto payment
&lt;/h2&gt;

&lt;p&gt;A crypto address is a long string with no sender attached. Whoever controls that string at the moment you copy it controls where the money goes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a fake or edited invoice,&lt;/li&gt;
&lt;li&gt;clipboard malware that replaces addresses,&lt;/li&gt;
&lt;li&gt;address poisoning (a look-alike address in your transaction history),&lt;/li&gt;
&lt;li&gt;a "support agent" in a chat,&lt;/li&gt;
&lt;li&gt;and now: an API that answers &lt;code&gt;402 Payment Required&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With x402 V2 the &lt;code&gt;payTo&lt;/code&gt; address can change on every request. If the server is compromised – or someone sits in between – your agent pays the attacker and nothing in the protocol notices. AWS says it plainly in the AgentCore docs: payments do not enforce payTo restrictions server-side, so your application must validate the address before paying.&lt;/p&gt;

&lt;p&gt;Validate it against what, though? "The address changed" is not evidence of fraud. Sellers rotate addresses all the time.&lt;/p&gt;

&lt;p&gt;What is missing is a statement &lt;strong&gt;from the payee&lt;/strong&gt; that this exact address, for this exact amount, really comes from them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Signed payment requests
&lt;/h2&gt;

&lt;p&gt;The idea is old (Bitcoin had BIP70), but it never made it to other chains, to stablecoins or to agents. So I built a small, open format for it:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The payee creates an Ed25519 key &lt;strong&gt;once&lt;/strong&gt; and publishes the public key on &lt;strong&gt;its own domain&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;For every payment the payee signs: address, amount, network, asset, reference and expiry.&lt;/li&gt;
&lt;li&gt;The payer (wallet, app or AI agent) checks the signature against the key on that domain &lt;strong&gt;before&lt;/strong&gt; sending.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Change one character of the address, the amount or the expiry and the signature breaks. A new address per invoice is fine – nothing has to be on a list.&lt;/p&gt;

&lt;p&gt;No keys or funds ever leave the payee. Nothing on-chain changes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Payee: two commands
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# once&lt;/span&gt;
npx debyta keygen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This writes &lt;code&gt;debyta-pay-key.pem&lt;/code&gt; (keep it secret) and prints the file you put at&lt;br&gt;
&lt;code&gt;https://your-domain.com/.well-known/debyta-pay.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"addresses"&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="nl"&gt;"keys"&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="nl"&gt;"kid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2026-11"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"alg"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Ed25519"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"pub"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&amp;lt;your public key&amp;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 DNS TXT record works too: &lt;code&gt;_debyta-pay.your-domain.com  "k=ed25519; kid=2026-11; p=&amp;lt;pub&amp;gt;"&lt;/code&gt;.)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# per invoice / per payment&lt;/span&gt;
npx debyta sign --payee your-domain.com --to 0xYourAddress \
  --chain base --asset USDC --amount 49.90 --ref INV-1001
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;debyta:pay?r=dpr1.eyJ2IjoxLCJwYXllZSI6InlvdXItZG9tYWluLmNvbSIs…
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Put that into the invoice, the QR code, the checkout page – or into your x402 response.&lt;/p&gt;

&lt;h3&gt;
  
  
  Payer: verify before sending
&lt;/h3&gt;

&lt;p&gt;Free, runs locally, no account:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx debyta verify &lt;span class="s2"&gt;"debyta:pay?r=dpr1.…"&lt;/span&gt; --send-to 0xAddressYouAreAboutToUse
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or in code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;verifyPayRequestOffline&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'debyta'&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;r&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;verifyPayRequestOffline&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;sendTo&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;addressAboutToBeUsed&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="p"&gt;(&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;ok&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`Do not pay: ${r.reason}`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// signature_invalid, address_mismatch, request_expired …&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;sendTo&lt;/code&gt; matters: it catches the case where the request is genuine but the address actually pasted into the wallet was swapped afterwards (clipboard malware).&lt;/p&gt;

&lt;h3&gt;
  
  
  In x402
&lt;/h3&gt;

&lt;p&gt;Put the signed request into the &lt;code&gt;extra&lt;/code&gt; field of the payment option:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"x402Version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"resource"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://api.your-domain.com/data"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"accepts"&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="nl"&gt;"scheme"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"exact"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"network"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"eip155:8453"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"amount"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"10000"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"asset"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"payTo"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"0xYourAddress"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"extra"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"debytaRequest"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"dpr1.…"&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;Now &lt;code&gt;payTo&lt;/code&gt; is cryptographically bound to your domain. A swapped &lt;code&gt;payTo&lt;/code&gt; no longer matches the signed one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Optional: online check
&lt;/h2&gt;

&lt;p&gt;The signature proves &lt;em&gt;who&lt;/em&gt; asked for the money. It does not prove that the payee is honest. If you want more, the hosted check adds sanctions screening (OFAC), address checksum validation, known fraud traces of the domain and the address, and returns a second signed verdict (&lt;code&gt;allow&lt;/code&gt; / &lt;code&gt;warn&lt;/code&gt; / &lt;code&gt;block&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -s https://debyta.com/api/intel/v1/pay/verify \
  -H &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; \
  -d &lt;span class="s1"&gt;'{"request":"debyta:pay?r=dpr1.…","sendTo":"0x…"}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For x402 there is a separate check that takes the raw 402 response and your spending limit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -s https://debyta.com/api/intel/v1/x402/precheck \
  -H &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; \
  -d &lt;span class="s1"&gt;'{"requirements": &amp;lt;the 402 body&amp;gt;, "maxAmount": 1}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both are also MCP tools (&lt;code&gt;verify_payment_request&lt;/code&gt;, &lt;code&gt;check_x402_payment&lt;/code&gt;) on &lt;code&gt;https://debyta.com/mcp&lt;/code&gt;, listed in the official MCP Registry as &lt;code&gt;com.debyta/agent-check&lt;/code&gt;.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;It only works if the payee publishes a key. Until then the online check falls back to address lists on the payee's domain, sanctions and fraud traces.&lt;/li&gt;
&lt;li&gt;A valid signature means "this really comes from that domain" – not "that domain is trustworthy".&lt;/li&gt;
&lt;li&gt;Requests expire after at most 31 days.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Format, in short
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dpr1.&amp;lt;base64url(JSON)&amp;gt;.&amp;lt;base64url(Ed25519 signature over "dpr1." + base64url(JSON))&amp;gt;
JSON: {v:1, payee, kid, to, chain?, asset?, amount?, ref?, iat, exp, nonce}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The SDK is MIT-licensed and has no dependencies: &lt;code&gt;npm install debyta&lt;/code&gt;. Full docs: &lt;a href="https://debyta.com/agent-check/integrations#signed" rel="noopener noreferrer"&gt;https://debyta.com/agent-check/integrations#signed&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you run an x402 service or send invoices in stablecoins, I would like to hear whether this fits your flow – and what is missing.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This post was written with the help of AI and reviewed by the author.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>x402</category>
      <category>crypto</category>
      <category>security</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
