<?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: AllSwap</title>
    <description>The latest articles on DEV Community by AllSwap (@allswap).</description>
    <link>https://dev.to/allswap</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%2F4227966%2F017fa665-2cb8-49ac-b9f4-4ff6372f6632.png</url>
      <title>DEV Community: AllSwap</title>
      <link>https://dev.to/allswap</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/allswap"/>
    <language>en</language>
    <item>
      <title>Where address specifications and validators disagree: notes from 1,386 labelled strings</title>
      <dc:creator>AllSwap</dc:creator>
      <pubDate>Wed, 25 Nov 2026 19:58:41 +0000</pubDate>
      <link>https://dev.to/allswap/where-address-specifications-and-validators-disagree-notes-from-1386-labelled-strings-1ko9</link>
      <guid>https://dev.to/allswap/where-address-specifications-and-validators-disagree-notes-from-1386-labelled-strings-1ko9</guid>
      <description>&lt;p&gt;We maintain a dataset of 1,386 strings, each labelled as a well-formed mainnet address or not, for 12 address families. The label follows the cited specification, not any library. Building it showed us a handful of places where a careful reading of the specification and the behaviour of a typical validator part ways. This note lists them, with the commands that produce the numbers. You do not need to use any particular product to follow it.&lt;/p&gt;

&lt;p&gt;The data is on Zenodo (&lt;a href="https://doi.org/10.5281/zenodo.24540799" rel="noopener noreferrer"&gt;doi.org/10.5281/zenodo.24540799&lt;/a&gt;) and GitHub (&lt;a href="https://github.com/allswapio/address-format-test-vectors" rel="noopener noreferrer"&gt;allswapio/address-format-test-vectors&lt;/a&gt;). Every label is computed twice, by &lt;code&gt;scripts/build.py&lt;/code&gt; and by &lt;code&gt;scripts/verify.py&lt;/code&gt;, which share no code. Both were written by the same maintainer with AI coding tools, so the agreement shows consistency, not independent review. If you disagree with a reading, the README asks for an issue that quotes the passage.&lt;/p&gt;

&lt;p&gt;The Python scripts need only the standard library (Python 3); the two Node.js 22 checks also need the published library package. The scripts are in &lt;a href="https://github.com/allswapio/address-format-test-vectors/tree/main/examples" rel="noopener noreferrer"&gt;&lt;code&gt;examples/&lt;/code&gt;&lt;/a&gt; of the dataset repository.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. One string, several families
&lt;/h2&gt;

&lt;p&gt;Some strings are well formed under more than one family. The dataset lists six such strings in &lt;code&gt;cross-family-ambiguities&lt;/code&gt;. We also counted them from the main file (&lt;code&gt;a1_cross_family.py&lt;/code&gt;): 16 distinct strings have a &lt;code&gt;spec_valid = true&lt;/code&gt; row in two or more families.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;String (shortened)&lt;/th&gt;
&lt;th&gt;Valid under&lt;/th&gt;
&lt;th&gt;Why&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Bitcoin, Bitcoin Cash&lt;/td&gt;
&lt;td&gt;Base58Check version 0x00, which is also the legacy Bitcoin Cash format&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Bitcoin, Litecoin, Bitcoin Cash&lt;/td&gt;
&lt;td&gt;Version 0x05 is the script-hash version in all three&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;0x5aaeb605...1beaed&lt;/code&gt; (lower case)&lt;/td&gt;
&lt;td&gt;EVM, NEAR&lt;/td&gt;
&lt;td&gt;NEAR allows &lt;code&gt;0x&lt;/code&gt; plus 40 hex digits as an account name&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;11111111111111111111111111111111&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Solana, NEAR&lt;/td&gt;
&lt;td&gt;32 digits fit the NEAR account grammar&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;bc1qw508d6qe...f3t4&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Bitcoin, NEAR&lt;/td&gt;
&lt;td&gt;lower-case letters and digits, 42 characters&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The last two rows deserve a second look. A NEAR account ID is any 2 to 64 characters of &lt;code&gt;a-z&lt;/code&gt;, &lt;code&gt;0-9&lt;/code&gt; and the separators &lt;code&gt;.&lt;/code&gt;, &lt;code&gt;-&lt;/code&gt;, &lt;code&gt;_&lt;/code&gt; (NEAR documentation, account IDs). A lower-case Bitcoin Bech32 string is therefore also a legal NEAR name. Whether you can create that name on the network is a different question; the grammar does not answer it.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;a1b_library_cross_check.mjs&lt;/code&gt; runs the 335 distinct valid strings through all 12 families of our own library, which is deliberately stricter than the specifications. Thirteen strings are accepted by two families, and every one is an EVM address that is also read as a NEAR account.&lt;/p&gt;

&lt;p&gt;What to take from it: a validator should be told the family. Guessing the family from the string alone is not safe.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Checksums are what makes a typo detectable
&lt;/h2&gt;

&lt;p&gt;Formats without a checksum accept most one-character edits. We took one valid string from the dataset and replaced every character with every other character of its alphabet. &lt;code&gt;snippet_a_substitute.py&lt;/code&gt; holds this code and the two calls that run it, for the two Base58 cases:&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;import&lt;/span&gt; &lt;span class="n"&gt;hashlib&lt;/span&gt;
&lt;span class="no"&gt;B58&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"&lt;/span&gt;

&lt;span class="k"&gt;def&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;s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;n&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;for&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="k"&gt;in&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;n&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;58&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="no"&gt;B58&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;index&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="s2"&gt;"\0"&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;len&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="o"&gt;-&lt;/span&gt; &lt;span class="nb"&gt;len&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="nf"&gt;lstrip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"1"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_bytes&lt;/span&gt;&lt;span class="p"&gt;(&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="nf"&gt;bit_length&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"big"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;solana_ok&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="p"&gt;:&lt;/span&gt;                       &lt;span class="c1"&gt;# no checksum: only the decoded length matters&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&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;s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;32&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;bitcoin_p2pkh_ok&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="p"&gt;:&lt;/span&gt;                &lt;span class="c1"&gt;# version 0x00 + 20 bytes + 4 checksum bytes&lt;/span&gt;
    &lt;span class="n"&gt;b&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;s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;b&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;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;hashlib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sha256&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hashlib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sha256&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;21&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="nf"&gt;digest&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="nf"&gt;digest&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="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;21&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;survivors&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;ok&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;ok&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="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&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;i&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="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;len&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="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="no"&gt;B58&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&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;i&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="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;len&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="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;57&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;a2_single_char_substitution.py&lt;/code&gt; adds the EVM cases, with a Keccak-256 written in the script. Output:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;String&lt;/th&gt;
&lt;th&gt;Variants&lt;/th&gt;
&lt;th&gt;Still valid&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Solana key (&lt;code&gt;sol-0032&lt;/code&gt;, 44 characters)&lt;/td&gt;
&lt;td&gt;2,508&lt;/td&gt;
&lt;td&gt;2,466&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bitcoin P2PKH (&lt;code&gt;btc-0001&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;1,938&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EVM address, all lower case (&lt;code&gt;evm-0001&lt;/code&gt; lowered)&lt;/td&gt;
&lt;td&gt;631&lt;/td&gt;
&lt;td&gt;600&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EVM address, EIP-55 mixed case (&lt;code&gt;evm-0001&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;1,280&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two notes on the table. For the lower-case EVM address, 600 is exactly 40 positions times 15 other hex digits; the other 31 variants damage the &lt;code&gt;0x&lt;/code&gt; prefix. For Solana, all 42 variants that fail are substitutions of the first character: they push the decoded value over 32 bytes. That depends on the string: this key starts with &lt;code&gt;F&lt;/code&gt;, a low digit of the alphabet, so a higher replacement can overflow. We tested one key only.&lt;/p&gt;

&lt;p&gt;The dataset's own mutation rows show the same thing in a less controlled way: 249 rows apply a one-character edit (substitute, insert, drop, swap, extend, truncate), and 11 of them are still valid, all Solana (&lt;code&gt;a6_mutation_rows.py&lt;/code&gt;). These rows were picked by the build rules, at most three per rule and family, so read them as examples, not as a rate.&lt;/p&gt;

&lt;p&gt;EIP-55 itself says that a random mistyped address passes with a probability of 0.0247 % (EIP-55, Rationale). Our 0 of 1,280 is consistent with that, and says nothing more precise.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Bech32 and Bech32m differ in one constant
&lt;/h2&gt;

&lt;p&gt;BIP-173 defines Bech32. BIP-350 changed the checksum constant to &lt;code&gt;0x2bc830a3&lt;/code&gt; for witness versions 1 to 16 and kept the original constant 1 for version 0. A string that carries the wrong constant for its witness version is invalid, even though its checksum is internally consistent. BIP-350 says no string is valid under both.&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="no"&gt;CHARSET&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"qpzry9x8gf2tvdw0s3jn54khce6mua7l"&lt;/span&gt;
&lt;span class="no"&gt;GEN&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mh"&gt;0x3B6A57B2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x26508E6D&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x1EA119FA&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x3D4233DD&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x2A1462B3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;residue&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="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;hrp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;[&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="nf"&gt;rfind&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"1"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="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;CHARSET&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;index&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="k"&gt;in&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;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;rfind&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"1"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="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="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;chk&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;ord&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;hrp&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="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;ord&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="mi"&gt;31&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;hrp&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;top&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;chk&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;
        &lt;span class="n"&gt;chk&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chk&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="mh"&gt;0x1FFFFFF&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;chk&lt;/span&gt; &lt;span class="o"&gt;^=&lt;/span&gt; &lt;span class="no"&gt;GEN&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&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="n"&gt;top&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;chk&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&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="c1"&gt;# residue 1 = Bech32, 0x2bc830a3 = Bech32m; data[0] = witness version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run on the BIP-350 invalid example &lt;code&gt;bc1p0xlxvlhem...h2y7hd&lt;/code&gt;, it prints residue &lt;code&gt;0x1&lt;/code&gt; with witness version 1. The checksum is a good Bech32 checksum, and the address is still invalid. A validator that only asks "is the checksum good?" accepts it.&lt;/p&gt;

&lt;p&gt;The dataset has nine rows with the reason &lt;code&gt;wrong_checksum_constant&lt;/code&gt; (&lt;code&gt;a3_bech32_constants.py&lt;/code&gt;): six for Bitcoin, two for Litecoin, one for the Zcash TEX format (ZIP-320, always Bech32m). The 13 valid BIP-173 and BIP-350 examples in the same script pass.&lt;/p&gt;

&lt;p&gt;Two more traps from the same specifications. Mixed case is never allowed, but an all-upper-case string is valid, which matters for QR codes. And witness versions 2 to 16 are valid recipients under BIP-350 although no standard output uses them yet. Whether to accept them is a product decision, not a format question.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. EIP-55: what single-case means
&lt;/h2&gt;

&lt;p&gt;EIP-55 defines the capitalisation of a hex address from a Keccak-256 hash. It does not say what to do with an address that is all lower case or all upper case; those appear in its test cases only (EIP-55). The ecosystem treats them as "no checksum asserted", and so does the dataset, with a note on each such row. The cost is visible in section 2: every one-digit error in a lower-case address stays valid.&lt;/p&gt;

&lt;p&gt;A second trap is EIP-1191, which defines a different capitalisation for some chains. In the dataset, &lt;code&gt;evm-0005&lt;/code&gt; and &lt;code&gt;evm-0049&lt;/code&gt; are the same 20 bytes. One is capitalised by EIP-55, the other by EIP-1191 for chain id 30. Under EIP-55, the second fails. A validator that follows EIP-55 will reject a correct address from a chain that uses EIP-1191. Five such rows are in the data; the library we compare against accepts none.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Where a validator is narrower than the specification
&lt;/h2&gt;

&lt;p&gt;The last column of the dataset records the result of &lt;code&gt;multichain-memo-address-validator&lt;/code&gt; 1.0.0, a library we also maintain. It differs from the label on 90 of 1,386 rows, always in the same direction: specification valid, library invalid. On this data it never accepts a string that a specification rejects (&lt;code&gt;a4_spec_vs_library.py&lt;/code&gt;, and &lt;code&gt;scripts/compare.mjs&lt;/code&gt; in the dataset).&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Policy of the library&lt;/th&gt;
&lt;th&gt;Rows&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Refuses XRP X-addresses (they can carry a tag)&lt;/td&gt;
&lt;td&gt;14&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bitcoin Cash: 20-byte hashes only / lower case only / no legacy Base58&lt;/td&gt;
&lt;td&gt;11 / 8 / 7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Stellar: &lt;code&gt;G...&lt;/code&gt; accounts only (no muxed or contract)&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Litecoin: refuses legacy &lt;code&gt;3...&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TRON: Base58Check only (no hex form)&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NEAR: long top-level names only as implicit forms&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Zcash: transparent Base58 only (no TEX)&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bitcoin and Litecoin: witness versions 0 and 1 only / lower case only&lt;/td&gt;
&lt;td&gt;4 / 3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TON: workchain 0 only&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;All-zero values (application policy)&lt;/td&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These are choices, and they are documented in the library's README. The point for validator authors is that "invalid" can mean three things: the string breaks the format, the format is not supported, or the application refuses it. Mixing them in one boolean is how a customer's correct address ends up rejected. The library returns a &lt;code&gt;pitfall&lt;/code&gt; field for this reason; the data shows 90 cases where it matters.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. TON, NEAR and Solana details
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;TON.&lt;/strong&gt; The user-friendly form is 36 bytes in base64. The TON documentation says both standard and URL-safe base64 are valid and must be supported. &lt;code&gt;a5_ton_forms.py&lt;/code&gt; decodes the documented example in both alphabets and in raw form: one account, three strings. The first byte holds flags (&lt;code&gt;0x11&lt;/code&gt; bounceable, &lt;code&gt;0x51&lt;/code&gt; non-bounceable, &lt;code&gt;+0x80&lt;/code&gt; testnet-only). If you set the testnet bit and leave the CRC, the string is invalid; if you recompute the CRC, it is a well-formed string that should not be accepted on mainnet. In the second case the CRC passes, so the flag byte has to be read as well.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NEAR.&lt;/strong&gt; The grammar admits implicit accounts (64 hex), Ethereum-like (&lt;code&gt;0x&lt;/code&gt; and 40 hex) and plain names in one rule, which is why section 1 exists. The dataset follows the grammar of &lt;code&gt;near-account-id-rs&lt;/code&gt; and does not say whether a name exists.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solana.&lt;/strong&gt; A base58 string that decodes to 32 bytes. That is all. The system program ID, 32 ones, is valid by that rule, and is a zero value many applications will want to refuse separately.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limits and what we did not verify
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The labels are our reading of the specifications, computed by two programs from one maintainer. Where a specification is silent, we left the row out.&lt;/li&gt;
&lt;li&gt;The mutation rows are chosen by rules, not drawn at random. No rate in this note should be quoted as a rate for real typos.&lt;/li&gt;
&lt;li&gt;The overlap counts in section 1 are lower bounds. Only strings that have a row in two families are counted, and the library check is stricter than the specifications.&lt;/li&gt;
&lt;li&gt;The Solana exhaustive test used one key; other keys, for example ones that start with &lt;code&gt;1&lt;/code&gt;, were not tested.&lt;/li&gt;
&lt;li&gt;The data says nothing on whether an address exists, is funded, or can receive a given asset. We did not test any other library, and we did not check the data against a live node.&lt;/li&gt;
&lt;li&gt;Zcash shielded and unified addresses, Litecoin MWEB, regtest and most testnet forms are not covered.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Reproduce
&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/allswapio/address-format-test-vectors
&lt;span class="nb"&gt;cd&lt;/span&gt; address-format-test-vectors
python3 scripts/verify.py          &lt;span class="c"&gt;# independent recomputation of every label&lt;/span&gt;
node scripts/compare.mjs &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;path&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/multichain-memo-address-validator/src/index.mjs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An interactive address checker is at &lt;a href="https://allswap.io/tools/address-validator" rel="noopener noreferrer"&gt;allswap.io/tools/address-validator&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Disclosure: we maintain the dataset and the library discussed here, both published by AllSwap (Haohang Network Technology Co., Limited, &lt;a href="mailto:service@allswap.io"&gt;service@allswap.io&lt;/a&gt;). AI tools were used in drafting the dataset, the scripts and this text. No independent review of the data has been done.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>testing</category>
      <category>opensource</category>
      <category>python</category>
    </item>
    <item>
      <title>How Instant Cross-Chain Swap Services Work Under the Hood</title>
      <dc:creator>AllSwap</dc:creator>
      <pubDate>Thu, 05 Nov 2026 08:05:53 +0000</pubDate>
      <link>https://dev.to/allswap/how-instant-cross-chain-swap-services-work-under-the-hood-3phn</link>
      <guid>https://dev.to/allswap/how-instant-cross-chain-swap-services-work-under-the-hood-3phn</guid>
      <description>&lt;p&gt;Cross-chain swaps look simple from the outside: pick two assets, send coin A, receive coin B. Under the hood they are a small distributed system — quote assembly, deposit detection, confirmation waiting, route execution, and payout — stitched across networks that do not share a clock or a mempool. This article walks through that pipeline the way a developer would sketch it, then points at how a production service such as &lt;a href="https://allswap.io" rel="noopener noreferrer"&gt;AllSwap&lt;/a&gt; exposes the same flow to end users without asking them to connect a wallet.&lt;/p&gt;

&lt;p&gt;The pseudocode below is &lt;strong&gt;illustrative&lt;/strong&gt;. It is not AllSwap's real API, not a SDK binding, and not a claim about any specific market-maker or settlement protocol. Treat it as a teaching model for how deposit-address instant swaps are usually wired.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this architecture exists
&lt;/h2&gt;

&lt;p&gt;Blockchains do not natively move value to each other. A user who holds BTC on Bitcoin and wants ETH on Ethereum has three broad options: a centralized exchange account, a bridge or on-chain router that needs wallet approvals, or a deposit-address swap where a service (or its liquidity partners) fills the other side.&lt;/p&gt;

&lt;p&gt;Deposit-address services win on UX for many users because:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;There is no wallet-connect session and no token allowance to sign.&lt;/li&gt;
&lt;li&gt;Any wallet that can send a transfer works, including hardware wallets and exchange withdrawals.&lt;/li&gt;
&lt;li&gt;Order matching is keyed off a unique deposit address rather than an account login.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The trade-off is a short execution window where the deposited funds sit at an address the operator or market-maker controls. A careful design makes that window short, quoted up front, and refundable when a route fails.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stage 1 — Quote
&lt;/h2&gt;

&lt;p&gt;A quote request carries the source asset, destination asset, amount in, and (often) the receiving address. Internally the service asks one or more liquidity sources for a firm or soft price. Some stacks run an RFQ-style auction: market-makers bid, and the best bid becomes the quote.&lt;/p&gt;

&lt;p&gt;What the user sees should already fold in the platform fee and the spread. AllSwap, for example, shows a live all-in quote with a &lt;strong&gt;minimum received&lt;/strong&gt; figure and a route-specific payment countdown before any deposit is made. Its application-layer service fee is a flat &lt;strong&gt;0.25%&lt;/strong&gt; for every user; market-maker spread is priced into that minimum, and source-chain gas is paid by the user's own wallet.&lt;/p&gt;

&lt;p&gt;Illustrative sketch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fn request_quote(src_asset, dst_asset, amount_in, receive_addr) -&amp;gt; Quote:
    bids = poll_market_makers(src_asset, dst_asset, amount_in)
    best = select_best(bids)               # rate, expiry, route id
    fee  = amount_in * SERVICE_FEE_BPS     # e.g. 25 bps = 0.25%
    min_out = apply_fee_and_spread(best, fee)
    return Quote{
      id, min_out, expires_at,
      deposit_asset: src_asset,
      payout_asset: dst_asset,
      receive_addr
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Important: quotes expire. Prices move; inventory moves. A countdown is not decoration — it is the contract of the quote.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stage 2 — Order creation and deposit address
&lt;/h2&gt;

&lt;p&gt;Once the user accepts a quote, the service allocates a &lt;strong&gt;single-use deposit address&lt;/strong&gt; bound to that order. Sending to that address is how the system knows which payout to schedule. There is no AllSwap-style user-balance account in this model: each order stands alone.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fn create_order(quote) -&amp;gt; Order:
    assert now &amp;lt; quote.expires_at
    deposit_addr = allocate_one_time_address(quote.deposit_asset)
    return Order{
      quote_id: quote.id,
      deposit_addr,
      receive_addr: quote.receive_addr,
      min_out: quote.min_out,
      status: AWAITING_DEPOSIT
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From the user's perspective this is the moment they copy an address (and a memo/tag on chains that require one) and prepare a normal transfer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stage 3 — Deposit detection
&lt;/h2&gt;

&lt;p&gt;A watcher process (or indexer) listens for incoming transfers to open deposit addresses. Detection is chain-specific: UTXO chains, account-model EVM chains, and high-throughput L1s each have different APIs and finality rules.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;on_chain_event(tx):
    order = lookup_by_deposit_address(tx.to)
    if order is None: return
    if tx.asset != order.expected_asset: mark(order, ASSET_MISMATCH)
    if tx.amount &amp;lt; order.min_deposit: mark(order, UNDERPAID)
    else:
        order.deposit_txid = tx.id
        order.status = CONFIRMING
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Edge cases matter in production: wrong asset on the right address, underpayment, overpayment, and deposits that arrive after the quote countdown. Each needs a documented path (re-quote, partial fill policy, or refund).&lt;/p&gt;

&lt;h2&gt;
  
  
  Stage 4 — Confirmations
&lt;/h2&gt;

&lt;p&gt;"Seen in mempool" is not "safe to pay out." Services wait for a confirmation threshold that depends on the source chain's reorg risk and the size of the swap. Bitcoin deposits take longer than Solana deposits for good reason. Only after the threshold does the order move to routing.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fn tick_confirmations(order):
    confs = explorer.confirmations(order.deposit_txid)
    if confs &amp;gt;= required_confs(order.deposit_asset):
        order.status = READY_TO_ROUTE
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Stage 5 — Routing and payout
&lt;/h2&gt;

&lt;p&gt;Routing is where inventory or on-chain settlement protocols deliver the destination asset. In an RFQ / market-maker design, the winning bidder often pays from inventory on the destination chain; in other designs a bridge or DEX route is executed. Either way, the user's receiving address should get at least &lt;code&gt;min_out&lt;/code&gt; when the route succeeds.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fn execute(order):
    result = market_maker.fill(order)   # or settlement_protocol.execute(...)
    if result.ok and result.amount_out &amp;gt;= order.min_out:
        order.payout_txid = result.txid
        order.status = COMPLETE
    else:
        order.status = REFUND_PENDING
        enqueue_refund(order)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Failed routes should not leave users guessing. A documented refund handling flow — automatic when possible, manual verification when not — is part of the product surface, not an afterthought.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stage 6 — Verifiability
&lt;/h2&gt;

&lt;p&gt;Every completed swap should leave two public artifacts: the deposit transaction on the source explorer and the payout transaction on the destination explorer. Status pages that surface both hashes let users (and support) audit the path without trusting a private database row.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a production product layers on top
&lt;/h2&gt;

&lt;p&gt;The pipeline above is the skeleton. A service people actually use also needs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Coverage across many networks and assets (AllSwap lists &lt;strong&gt;46 chains&lt;/strong&gt; and &lt;strong&gt;200+ assets&lt;/strong&gt;).&lt;/li&gt;
&lt;li&gt;No account and no KYC in the product path, for users who want a swap without registration.&lt;/li&gt;
&lt;li&gt;Clear fee math (flat fee vs VIP tiers).&lt;/li&gt;
&lt;li&gt;Support when something goes sideways — AllSwap points users to Telegram at &lt;a href="https://t.me/allswapservice" rel="noopener noreferrer"&gt;https://t.me/allswapservice&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Honest boundaries: chain congestion, irreversible address mistakes, and residual risk in underlying protocols are not "solved" by a nice UI.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Developers evaluating an invite-only swap API should ask the same pipeline questions: How is the quote bound? When does the deposit address rotate? What confirmation policy applies per chain? What happens on route failure?&lt;/p&gt;

&lt;h2&gt;
  
  
  Closing
&lt;/h2&gt;

&lt;p&gt;If you strip away branding, every deposit-address cross-chain swap is a state machine: quote → deposit → confirm → route → payout (or refund). Understanding those states makes it easier to debug a stuck order, to design a wallet integration, or to choose a service whose UX matches the model you expect. For a concrete product that follows this non-custodial, no-account pattern across 46 chains with a flat 0.25% fee, see &lt;a href="https://allswap.io" rel="noopener noreferrer"&gt;AllSwap&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Disclosure: written by the AllSwap team.&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>crypto</category>
      <category>web3</category>
      <category>defi</category>
    </item>
  </channel>
</rss>
