<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <id>https://docs.recoilpay.com/blog</id>
    <title>RecoilPay Docs Blog</title>
    <updated>2026-11-26T00:00:00.000Z</updated>
    <generator>https://github.com/jpmonette/feed</generator>
    <link rel="alternate" href="https://docs.recoilpay.com/blog"/>
    <subtitle>RecoilPay Docs Blog</subtitle>
    <icon>https://docs.recoilpay.com/img/favicon.png</icon>
    <entry>
        <title type="html"><![CDATA[One signature, two chains: how RecoilPay v2 settles cross-chain payments with intents]]></title>
        <id>https://docs.recoilpay.com/blog/how-recoilpay-v2-works</id>
        <link href="https://docs.recoilpay.com/blog/how-recoilpay-v2-works"/>
        <updated>2026-11-26T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[How RecoilPay v2 turns a sentence into a signed intent, lets solvers compete to fill it, and releases escrow only when the fill is proven on-chain. Architecture, failure modes and what our testnet is validating.]]></summary>
        <content type="html"><![CDATA[<p>Moving a stablecoin from one chain to another still takes too many steps.
You approve a token. You find gas on a chain you don't hold anything on. You
wait for a bridge. Sometimes the money sits in between, and you wait longer.</p>
<p>RecoilPay v2 replaces those steps with <strong>one signature</strong>. You say what you
want, competing solvers quote, and the one you pick sends you the funds on the
destination chain from its own inventory. Your input waits in an on-chain
escrow and is released to the solver only once a proof of the delivery
reaches the source chain.</p>
<p>This post explains how that works. It covers the contracts, the off-chain
services, the drop-in web component, and the failure modes we know about and
are still working on.</p>
<div class="theme-admonition theme-admonition-info admonition_xJq3 alert alert--info"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>Testnet</div><div class="admonitionContent_BuS1"><p>RecoilPay v2 runs on public testnets today: Base Sepolia, OP Sepolia,
Ethereum Sepolia, Polygon Amoy, BNB Chain Testnet, Avalanche Fuji and Solana
devnet, with Arc testnet in review. The tokens have no value. Everything below
describes code that is running there, and we point out where it isn't ready
for mainnet.</p></div></div>
<p><img decoding="async" loading="lazy" alt="The RecoilPay v2 app: one input for a payment in plain English" src="https://docs.recoilpay.com/assets/images/app-home-0c6f33ece4060b81864fb630cb52f6b6.png" width="1440" height="812" class="img_ev3q"></p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="the-problem-why-cross-chain-payments-break">The problem: why cross-chain payments break<a href="https://docs.recoilpay.com/blog/how-recoilpay-v2-works#the-problem-why-cross-chain-payments-break" class="hash-link" aria-label="Direct link to The problem: why cross-chain payments break" title="Direct link to The problem: why cross-chain payments break" translate="no">​</a></h2>
<p>Our first product, RecoilPay v1, is live at
<a href="https://recoilpay.com/" target="_blank" rel="noopener noreferrer" class="">recoilpay.com</a> and routes swaps on mainnet through a
third-party routing API. It works, and running it taught us where users get
stuck. A typical cross-chain swap in v1 looks like this from the user's
side:</p>
<!-- -->
<p>Three problems keep recurring:</p>
<ol>
<li class=""><strong>Wrong-chain gas.</strong> Every transaction needs the source chain's native
token. Someone holding USDC on Base and nothing else can't move it until
they buy ETH on Base.</li>
<li class=""><strong>Multi-step approvals.</strong> Approve, then swap, sometimes approve again on a
second hop. Each step is a signature the user can get wrong and a place
where the flow can stop halfway.</li>
<li class=""><strong>Fragmented liquidity and slow settlement.</strong> The route is only as fast as
its slowest bridge or confirmation rule, and the user carries every delay.
If one hop fails, their money is somewhere in between.</li>
</ol>
<p>The fix we chose comes from the intents world: <strong>the user states the outcome
and signs once; a solver who already holds liquidity on the destination does
the work and takes the settlement risk.</strong></p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="system-overview-v1-and-v2">System overview: v1 and v2<a href="https://docs.recoilpay.com/blog/how-recoilpay-v2-works#system-overview-v1-and-v2" class="hash-link" aria-label="Direct link to System overview: v1 and v2" title="Direct link to System overview: v1 and v2" translate="no">​</a></h2>
<!-- -->
<p><strong>v1</strong> is a classic layered service: a Go API gateway, Kafka between the
gateway and a processor, Postgres with an outbox for publishing and an inbox
for de-duplication, and <code>FOR UPDATE SKIP LOCKED</code> for claiming work. Swaps are
routed by an external provider, so the user still signs the approval and the
source transaction and pays gas themselves.</p>
<p><strong>v2</strong> is the intent architecture, and it's where this post focuses:</p>
<ul>
<li class=""><strong>Clients:</strong> the web app, an embeddable web component, and a headless
TypeScript SDK (<a href="https://www.npmjs.com/package/@recoilpay/intent-core" target="_blank" rel="noopener noreferrer" class=""><code>@recoilpay/intent-core</code></a>).
All three use the same code.</li>
<li class=""><strong>The aggregator</strong> (Rust, Axum, Postgres): parses sentences into intents,
ranks quotes, stores orders, runs the claim queue, and settles the fiat
trades described further down.</li>
<li class=""><strong>Operators</strong> (solvers) publish quotes from a web portal. Nobody needs to
run a server: a hosted fill worker executes their orders.</li>
<li class=""><strong>On-chain:</strong> the <a href="https://github.com/openintentsframework/oif-contracts" target="_blank" rel="noopener noreferrer" class="">Open Intents Framework</a>
(OIF) settlers on each EVM chain, our own programs on Solana, and an oracle
that verifies fills.</li>
<li class=""><strong>Recoil Link</strong>, our cross-chain messaging layer (a fork of Hyperlane),
carries proofs of fills between chains.</li>
</ul>
<p><strong>How they connect today.</strong> v1's admin console reaches the v2 solver
marketplace through a server-side proxy with an allowlist. The credential it
uses can sign fills, so the browser never sees it, and the routes that sign
or settle are deliberately left out. The v1 site links to v2 for intents.
Moving v1's own quote path from the external router onto the v2 aggregator is
planned, and it waits on v2 reaching mainnet.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="the-intent-lifecycle">The intent lifecycle<a href="https://docs.recoilpay.com/blog/how-recoilpay-v2-works#the-intent-lifecycle" class="hash-link" aria-label="Direct link to The intent lifecycle" title="Direct link to The intent lifecycle" translate="no">​</a></h2>
<p>Here is a cross-chain USDC transfer from Base Sepolia to OP Sepolia, from
sentence to settlement.</p>
<p><strong>Ordering</strong> happens between the user, the client and the aggregator. The
user signs once and pays no gas:</p>
<!-- -->
<p><strong>Execution</strong> happens between the solver's fill worker and the chains:</p>
<!-- -->
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="1-from-a-sentence-to-an-intent">1. From a sentence to an intent<a href="https://docs.recoilpay.com/blog/how-recoilpay-v2-works#1-from-a-sentence-to-an-intent" class="hash-link" aria-label="Direct link to 1. From a sentence to an intent" title="Direct link to 1. From a sentence to an intent" translate="no">​</a></h3>
<p>The sentence goes to <code>POST /api/v1/intents/parse</code>, which calls a language
model on the server and returns structured intents: amount, token, source and
destination chains, recipient. If the model returns something that doesn't
match a template, the client asks the user to rephrase instead of guessing.
Developers using the SDK can parse in the browser with their own model token.</p>
<p>The model only reads the sentence. Everything after this step is
deterministic code. A misread amount shows up on the confirmation card before
anything is signed.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="2-quotes-operators-push-the-aggregator-ranks">2. Quotes: operators push, the aggregator ranks<a href="https://docs.recoilpay.com/blog/how-recoilpay-v2-works#2-quotes-operators-push-the-aggregator-ranks" class="hash-link" aria-label="Direct link to 2. Quotes: operators push, the aggregator ranks" title="Direct link to 2. Quotes: operators push, the aggregator ranks" translate="no">​</a></h3>
<p>Operators don't run quote servers. They publish a <strong>quote matrix</strong> from the
portal: chain pairs, assets, a rate, and minimum and maximum sizes. For each
request, the aggregator:</p>
<ol>
<li class="">loads every live, unpaused quote;</li>
<li class="">filters by chain pair, asset pair, size range, exclusivity, and whether
the operator's circuit breaker is open;</li>
<li class="">scores what's left:</li>
</ol>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#F8F8F2"><span class="token plain">score = 0.50 · output (normalised)</span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">      + 0.25 · reputation</span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">      + 0.15 · success rate</span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">      + 0.10 · (1 − latency)</span><br></div></code></pre></div></div>
<p>Price dominates, but an operator who wins on price and then fails to fill
loses reputation (+0.02 per success, −0.10 per failure) and drops down the
list. Quotes go back to the client in the OIF v0 quote shape, with an
integrity checksum that the aggregator checks again when the order comes
back, so an order built on an altered quote is refused.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="3-the-order-one-signature-no-gas">3. The order: one signature, no gas<a href="https://docs.recoilpay.com/blog/how-recoilpay-v2-works#3-the-order-one-signature-no-gas" class="hash-link" aria-label="Direct link to 3. The order: one signature, no gas" title="Direct link to 3. The order: one signature, no gas" translate="no">​</a></h3>
<p>The user signs an OIF <code>StandardOrder</code> as a Permit2
<code>PermitBatchWitnessTransferFrom</code>. The witness is the part that matters:</p>
<div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#F8F8F2"><span class="token comment" style="color:rgb(98, 114, 164)">// The EIP-712 witness inside the Permit2 signature</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">Permit2Witness</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">[</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"> name</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'user'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain">        type</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'address'</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"> name</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'expires'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain">     type</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'uint32'</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain">   </span><span class="token comment" style="color:rgb(98, 114, 164)">// refund after</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"> name</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'inputOracle'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"> type</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'address'</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain">  </span><span class="token comment" style="color:rgb(98, 114, 164)">// attests fill</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"> name</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'outputs'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain">     type</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'MandateOutput[]'</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">]</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token comment" style="color:rgb(98, 114, 164)">// Exactly what must arrive, and where</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">MandateOutput</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">[</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"> name</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'oracle'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain">       type</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'bytes32'</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"> name</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'settler'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain">      type</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'bytes32'</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"> name</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'chainId'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain">      type</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'uint256'</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"> name</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'token'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain">        type</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'bytes32'</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"> name</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'amount'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain">       type</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'uint256'</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"> name</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'recipient'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain">    type</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'bytes32'</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"> name</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'callbackData'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"> type</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'bytes'</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"> name</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'context'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain">      type</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'bytes'</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">]</span><br></div></code></pre></div></div>
<p>Some consequences of signing this:</p>
<ul>
<li class=""><strong>No gas for the order itself.</strong> It's an off-chain EIP-712 signature. The
only gas the user ever pays is a one-time Permit2 approval per token per
chain.</li>
<li class=""><strong>The outputs are fixed.</strong> The token, amount, recipient and chain are
inside the signature. A solver can't deliver less, and nobody can change
the recipient after signing.</li>
<li class=""><strong>Fees are visible outputs.</strong> RecoilPay's fee, zero on testnet, is a second
<code>MandateOutput</code> paying our treasury, inside the same signature. It isn't a
separate transaction, and an unfilled order pays nothing.</li>
<li class=""><strong>Two clocks.</strong> <code>fillDeadline</code> (5 minutes after the quote) bounds when the
solver may fill. <code>expires</code> (10 minutes, or 30 when the route waits for a
cross-chain proof) is when the escrow becomes refundable to the user.</li>
</ul>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="4-claiming-the-order">4. Claiming the order<a href="https://docs.recoilpay.com/blog/how-recoilpay-v2-works#4-claiming-the-order" class="hash-link" aria-label="Direct link to 4. Claiming the order" title="Direct link to 4. Claiming the order" translate="no">​</a></h3>
<p>Orders go into a Postgres-backed queue. The fill worker claims in batches with
a lease:</p>
<div class="language-sql codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-sql codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#F8F8F2"><span class="token comment" style="color:rgb(98, 114, 164)">-- simplified</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">WITH</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">next</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">AS</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">SELECT</span><span class="token plain"> id </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">FROM</span><span class="token plain"> orders</span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">WHERE</span><span class="token plain"> claimable</span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">    </span><span class="token operator">AND</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token plain">lease_expires_at </span><span class="token operator">IS</span><span class="token plain"> </span><span class="token boolean">NULL</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">         </span><span class="token operator">OR</span><span class="token plain"> lease_expires_at </span><span class="token operator">&lt;</span><span class="token plain"> </span><span class="token function" style="color:rgb(80, 250, 123)">now</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">ORDER</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">BY</span><span class="token plain"> created_at</span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">LIMIT</span><span class="token plain"> </span><span class="token number">5</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">FOR</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">UPDATE</span><span class="token plain"> SKIP LOCKED</span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">UPDATE</span><span class="token plain"> orders</span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">SET</span><span class="token plain"> lease_expires_at </span><span class="token operator">=</span><span class="token plain"> </span><span class="token function" style="color:rgb(80, 250, 123)">now</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token plain"> </span><span class="token operator">+</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">interval</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'300 seconds'</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">FROM</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">next</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">WHERE</span><span class="token plain"> orders</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token plain">id </span><span class="token operator">=</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">next</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token plain">id</span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">RETURNING</span><span class="token plain"> orders</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token operator">*</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><br></div></code></pre></div></div>
<p>The lease (300 s, refreshed every 120 s while the work runs) means two
workers never fill the same order, and a worker that crashes releases its
orders automatically. New orders are also pushed to workers over an
authenticated WebSocket, so the 5-second poll is only a fallback.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="5-execution-open-fill-prove-finalise">5. Execution: open, fill, prove, finalise<a href="https://docs.recoilpay.com/blog/how-recoilpay-v2-works#5-execution-open-fill-prove-finalise" class="hash-link" aria-label="Direct link to 5. Execution: open, fill, prove, finalise" title="Direct link to 5. Execution: open, fill, prove, finalise" translate="no">​</a></h3>
<p>The worker sends four kinds of transaction:</p>
<table><thead><tr><th>Step</th><th>Chain</th><th>Contract</th><th>Effect</th></tr></thead><tbody><tr><td><code>openFor</code></td><td>origin</td><td><code>InputSettlerEscrow</code></td><td>Pulls the user's tokens through Permit2 into escrow, using their signature</td></tr><tr><td><code>fill</code></td><td>destination</td><td><code>OutputSettlerSimple</code></td><td>Sends the solver's tokens to the user and records the fill</td></tr><tr><td><code>submit</code></td><td>destination</td><td>Recoil Link oracle</td><td>Sends a proof of the fill, and pays the relayer's fee</td></tr><tr><td><code>finalise</code></td><td>origin</td><td><code>InputSettlerEscrow</code></td><td>Once the origin oracle reports the fill as proven, releases the escrow to the solver</td></tr></tbody></table>
<p>The user's funds arrive at step 2, usually 5–20 seconds after signing. Steps
3 and 4 are the solver's business: it has already been paid out of its own
pocket and is now waiting to be reimbursed.</p>
<p>Before finalising, the worker checks <code>isProven</code> on the origin oracle, and it
skips <code>submit</code> if an earlier attempt already delivered the proof. A claim
interrupted by a crash or a deploy resumes from what's on-chain, not from
what the database last recorded.</p>
<p><strong>Who holds the solver's keys?</strong> For operators who don't want to run
anything, the aggregator generates and holds a fill wallet per operator, with
the key sealed at rest. The worker never sees the key: it asks the aggregator
to sign. The aggregator signs only four shapes of transaction: <code>openFor</code> and
<code>finalise</code> on the registry's input settler, <code>fill</code> on its output settler, and
an ERC-20 <code>approve</code> naming the output settler as spender. Earnings go only to
the operator's registered wallet. This is convenient and also a custody
trade-off, discussed below.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="6-what-verified-means">6. What "verified" means<a href="https://docs.recoilpay.com/blog/how-recoilpay-v2-works#6-what-verified-means" class="hash-link" aria-label="Direct link to 6. What &quot;verified&quot; means" title="Direct link to 6. What &quot;verified&quot; means" translate="no">​</a></h3>
<p>The escrow doesn't trust the solver, the worker or the aggregator. It trusts
its <strong>input oracle</strong>, which is named inside the user's signature. On five of
our six EVM testnets (OP Sepolia, Base Sepolia, Ethereum Sepolia, Polygon Amoy
and BNB Chain Testnet), that oracle is a Recoil Link oracle:</p>
<ol>
<li class="">The solver calls <code>submit</code> on the destination oracle. It reads the
recorded fill from the output settler and emits a message containing
the solver, order id, output and fill time.</li>
<li class="">A Recoil Link validator signs checkpoints of the destination chain's
message tree. A relayer delivers the message to the origin chain, where it
is checked against the validator set that chain trusts.</li>
<li class="">The origin oracle now answers <code>isProven(...) == true</code> for that output, and
<code>finalise</code> succeeds. Without that proof, it reverts.</li>
</ol>
<p>So a solver that never delivered can't be paid, and a solver that delivered
can always prove it, as long as the proof lands before <code>expires</code>. That's why
we refuse to fill orders that could be refunded before a proof can arrive.</p>
<p>Solana routes work the same way with different parts: a Solana fill program
on one side, and a proof sender plus a mapped oracle on the EVM side.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="7-the-same-pattern-for-naira">7. The same pattern for naira<a href="https://docs.recoilpay.com/blog/how-recoilpay-v2-works#7-the-same-pattern-for-naira" class="hash-link" aria-label="Direct link to 7. The same pattern for naira" title="Direct link to 7. The same pattern for naira" translate="no">​</a></h3>
<p>The settlement pattern also covers bank money. For a naira cash-out, the
user's USDC is locked in an <code>AttestedEscrow</code> before a bonded merchant pays
naira to the user's bank. Bank details are encrypted on the user's device for
that merchant only, so we never see them. When the user confirms the money
arrived, an attestor key releases the escrow to the merchant. It can only
ever pay one of the two parties.</p>
<p>Every step has a clock, and the party the clock is waiting on loses when it
runs out, with one exception: a user's silence never releases their own
escrow. It goes to review instead. A merchant who doesn't pay is caught by
their bond.</p>
<p>It's a different oracle (an attestation instead of a cross-chain proof)
behind the same promise: <strong>funds move only on evidence.</strong></p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="frontend-integration-recoilpay-intent">Frontend integration: <code>&lt;recoilpay-intent&gt;</code><a href="https://docs.recoilpay.com/blog/how-recoilpay-v2-works#frontend-integration-recoilpay-intent" class="hash-link" aria-label="Direct link to frontend-integration-recoilpay-intent" title="Direct link to frontend-integration-recoilpay-intent" translate="no">​</a></h2>
<p>Most of the developers we talk to don't want a new SDK; they want to add a
payment box to an existing page. The widget is a custom element in Shadow
DOM, with React bundled inside, so it works in plain HTML, WordPress or any
framework:</p>
<div class="language-html codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-html codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#F8F8F2"><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&lt;</span><span class="token tag" style="color:rgb(255, 121, 198)">script</span><span class="token tag" style="color:rgb(255, 121, 198)"> </span><span class="token tag attr-name" style="color:rgb(241, 250, 140)">type</span><span class="token tag attr-value punctuation attr-equals" style="color:rgb(248, 248, 242)">=</span><span class="token tag attr-value punctuation" style="color:rgb(248, 248, 242)">"</span><span class="token tag attr-value" style="color:rgb(255, 121, 198)">module</span><span class="token tag attr-value punctuation" style="color:rgb(248, 248, 242)">"</span><span class="token tag" style="color:rgb(255, 121, 198)"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token tag" style="color:rgb(255, 121, 198)">  </span><span class="token tag attr-name" style="color:rgb(241, 250, 140)">src</span><span class="token tag attr-value punctuation attr-equals" style="color:rgb(248, 248, 242)">=</span><span class="token tag attr-value punctuation" style="color:rgb(248, 248, 242)">"</span><span class="token tag attr-value" style="color:rgb(255, 121, 198)">https://cdn.jsdelivr.net/npm/@recoilpay/intent-widget@0.9/dist/recoilpay-intent-widget.js</span><span class="token tag attr-value punctuation" style="color:rgb(248, 248, 242)">"</span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&gt;</span><span class="token script"></span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&lt;/</span><span class="token tag" style="color:rgb(255, 121, 198)">script</span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&lt;</span><span class="token tag" style="color:rgb(255, 121, 198)">recoilpay-intent</span><span class="token tag" style="color:rgb(255, 121, 198)"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token tag" style="color:rgb(255, 121, 198)">  </span><span class="token tag attr-name" style="color:rgb(241, 250, 140)">hf-access-token</span><span class="token tag attr-value punctuation attr-equals" style="color:rgb(248, 248, 242)">=</span><span class="token tag attr-value punctuation" style="color:rgb(248, 248, 242)">"</span><span class="token tag attr-value" style="color:rgb(255, 121, 198)">hf_…</span><span class="token tag attr-value punctuation" style="color:rgb(248, 248, 242)">"</span><span class="token tag" style="color:rgb(255, 121, 198)"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token tag" style="color:rgb(255, 121, 198)">  </span><span class="token tag attr-name" style="color:rgb(241, 250, 140)">walletconnect-project-id</span><span class="token tag attr-value punctuation attr-equals" style="color:rgb(248, 248, 242)">=</span><span class="token tag attr-value punctuation" style="color:rgb(248, 248, 242)">"</span><span class="token tag attr-value" style="color:rgb(255, 121, 198)">…</span><span class="token tag attr-value punctuation" style="color:rgb(248, 248, 242)">"</span><span class="token tag" style="color:rgb(255, 121, 198)"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token tag" style="color:rgb(255, 121, 198)">  </span><span class="token tag attr-name" style="color:rgb(241, 250, 140)">mode</span><span class="token tag attr-value punctuation attr-equals" style="color:rgb(248, 248, 242)">=</span><span class="token tag attr-value punctuation" style="color:rgb(248, 248, 242)">"</span><span class="token tag attr-value" style="color:rgb(255, 121, 198)">light</span><span class="token tag attr-value punctuation" style="color:rgb(248, 248, 242)">"</span><span class="token tag" style="color:rgb(255, 121, 198)"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token tag" style="color:rgb(255, 121, 198)">  </span><span class="token tag attr-name" style="color:rgb(241, 250, 140)">accent</span><span class="token tag attr-value punctuation attr-equals" style="color:rgb(248, 248, 242)">=</span><span class="token tag attr-value punctuation" style="color:rgb(248, 248, 242)">"</span><span class="token tag attr-value" style="color:rgb(255, 121, 198)">#0a7cff</span><span class="token tag attr-value punctuation" style="color:rgb(248, 248, 242)">"</span><span class="token tag" style="color:rgb(255, 121, 198)"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token tag" style="color:rgb(255, 121, 198)">  </span><span class="token tag attr-name" style="color:rgb(241, 250, 140)">examples</span><span class="token tag attr-value punctuation attr-equals" style="color:rgb(248, 248, 242)">=</span><span class="token tag attr-value punctuation" style="color:rgb(248, 248, 242)">'</span><span class="token tag attr-value" style="color:rgb(255, 121, 198)">[</span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token tag attr-value" style="color:rgb(255, 121, 198)">    { "label": "Send 1 USDC",</span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token tag attr-value" style="color:rgb(255, 121, 198)">      "sentence": "send 1 USDC from base sepolia to op sepolia" }</span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token tag attr-value" style="color:rgb(255, 121, 198)">  ]</span><span class="token tag attr-value punctuation" style="color:rgb(248, 248, 242)">'</span><span class="token tag" style="color:rgb(255, 121, 198)"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token tag" style="color:rgb(255, 121, 198)"></span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&gt;</span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&lt;/</span><span class="token tag" style="color:rgb(255, 121, 198)">recoilpay-intent</span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&gt;</span><br></div></code></pre></div></div>
<!-- -->
<p><strong>Inputs.</strong> All settings are attributes, and the element re-renders when one
changes:</p>
<ul>
<li class=""><code>mode</code>, <code>accent</code>, <code>accent-text</code>, <code>radius</code> and <code>font-family</code> for theming.
Your page's CSS can't reach inside, and the widget's styles can't leak out;</li>
<li class=""><code>placeholder</code> and <code>examples</code> for the prompt;</li>
<li class=""><code>api-url</code> to point at staging;</li>
<li class=""><code>walletconnect-project-id</code> to turn on mobile wallets over QR.</li>
</ul>
<p>If your page already has a connected wallet, hand it over and the widget
skips its own picker:</p>
<div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#F8F8F2"><span class="token comment" style="color:rgb(98, 114, 164)">// Any EIP-1193 provider</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> el </span><span class="token operator">=</span><span class="token plain"> </span><span class="token dom variable" style="color:rgb(189, 147, 249);font-style:italic">document</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">querySelector</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token string" style="color:rgb(255, 121, 198)">'recoilpay-intent'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">el</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">provider</span><span class="token plain"> </span><span class="token operator">=</span><span class="token plain"> </span><span class="token dom variable" style="color:rgb(189, 147, 249);font-style:italic">window</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">ethereum</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><br></div></code></pre></div></div>
<p><strong>Outputs.</strong> Every state change your page might care about is a DOM event
that bubbles out of the shadow root:</p>
<div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#F8F8F2"><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:rgb(80, 250, 123)">on</span><span class="token plain"> </span><span class="token operator">=</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token parameter">name</span><span class="token parameter punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token parameter"> fn</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token dom variable" style="color:rgb(189, 147, 249);font-style:italic">document</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">addEventListener</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token plain">name</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"> fn</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token function" style="color:rgb(80, 250, 123)">on</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token string" style="color:rgb(255, 121, 198)">'recoilpay-order-submitted'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token parameter">e</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token function" style="color:rgb(80, 250, 123)">track</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token string" style="color:rgb(255, 121, 198)">'order'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"> e</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">detail</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">orderId</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token function" style="color:rgb(80, 250, 123)">on</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token string" style="color:rgb(255, 121, 198)">'recoilpay-complete'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token parameter">e</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token comment" style="color:rgb(98, 114, 164)">// e.detail = { orderId, status, explorerUrl }</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token function" style="color:rgb(80, 250, 123)">showReceipt</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token plain">e</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">detail</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">explorerUrl</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token function" style="color:rgb(80, 250, 123)">on</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token string" style="color:rgb(255, 121, 198)">'recoilpay-error'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token parameter">e</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token comment" style="color:rgb(98, 114, 164)">// already written for the end user</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token function" style="color:rgb(80, 250, 123)">showToast</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token plain">e</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">detail</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">message</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><br></div></code></pre></div></div>
<p>There are also <code>recoilpay-wallet</code>, <code>recoilpay-solana-wallet</code>, and
started/ended events for cash-outs and purchases. The bundle is about 115 KB
gzipped. WalletConnect, about 450 KB, is fetched only when a visitor picks
it.</p>
<p>If you want your own UI, the same flow is a small state machine in the
headless SDK:</p>
<div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#F8F8F2"><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">import</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">  createIntentSession</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">  viemWallet</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">from</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'@recoilpay/intent-core'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> session </span><span class="token operator">=</span><span class="token plain"> </span><span class="token function" style="color:rgb(80, 250, 123)">createIntentSession</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"> hfAccessToken </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token comment" style="color:rgb(98, 114, 164)">// Immutable snapshots: idle → quoted → tracking → done</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">session</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token function" style="color:rgb(80, 250, 123)">subscribe</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token plain">render</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">await</span><span class="token plain"> session</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token function" style="color:rgb(80, 250, 123)">run</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token string" style="color:rgb(255, 121, 198)">'swap 10 USDC on Base Sepolia for USDC on OP Sepolia'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain">session</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token function" style="color:rgb(80, 250, 123)">setWallet</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token function" style="color:rgb(80, 250, 123)">viemWallet</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token plain">walletClient</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token comment" style="color:rgb(98, 114, 164)">// Switch chain → approve (once) → sign → submit</span><span class="token plain"></span><br></div><div class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">await</span><span class="token plain"> session</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token function" style="color:rgb(80, 250, 123)">confirm</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><br></div></code></pre></div></div>
<p>The phases are <code>parsing</code>, <code>needsWallet</code>, <code>quoting</code>, <code>quoted</code>, <code>approving</code>,
<code>signing</code>, <code>submitting</code>, <code>tracking</code>, <code>done</code> and <code>error</code>. Nothing throws:
every failure becomes a state with a message written for the end user.
Runnable examples are in
<a href="https://github.com/recoil-labs/recoilpay-examples" target="_blank" rel="noopener noreferrer" class="">recoil-labs/recoilpay-examples</a>.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="failure-modes-and-trade-offs">Failure modes and trade-offs<a href="https://docs.recoilpay.com/blog/how-recoilpay-v2-works#failure-modes-and-trade-offs" class="hash-link" aria-label="Direct link to Failure modes and trade-offs" title="Direct link to Failure modes and trade-offs" translate="no">​</a></h2>
<p>This is the part we most want feedback on.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="latency">Latency<a href="https://docs.recoilpay.com/blog/how-recoilpay-v2-works#latency" class="hash-link" aria-label="Direct link to Latency" title="Direct link to Latency" translate="no">​</a></h3>
<table><thead><tr><th>Route</th><th>User receives funds</th><th>Solver is reimbursed</th></tr></thead><tbody><tr><td>EVM ↔ EVM over Recoil Link</td><td>5–20 s after signing</td><td>after the proof is relayed, about a minute</td></tr><tr><td>To or from Solana</td><td>seconds</td><td>2–20 min, depending on the relayer</td></tr><tr><td>CCTP into Arc, then cash out (in review)</td><td>Circle's fast transfer took ~15 s in our test run</td><td>n/a (single chain)</td></tr></tbody></table>
<p>We separated the two columns on purpose. The user waits only for the
destination chain. The proof delay is the solver's capital cost, and solvers
price it into their quotes. The worst case for the solver is a stalled
relayer. The worker waits up to 30 minutes for a proof, and won't fill orders
whose <code>expires</code> is too close to leave room for one.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="slippage-and-price-risk">Slippage and price risk<a href="https://docs.recoilpay.com/blog/how-recoilpay-v2-works#slippage-and-price-risk" class="hash-link" aria-label="Direct link to Slippage and price risk" title="Direct link to Slippage and price risk" translate="no">​</a></h3>
<p>The user has <strong>no slippage</strong>: the output amount is part of the signature, and
a smaller fill fails. Price risk moves to the solver, who quoted a rate and
must deliver it within <code>fillDeadline</code> (5 minutes). Solvers protect themselves
with short quote expiries and size limits. The cost is that quotes are less
competitive in volatile markets than an AMM's.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="reorgs-and-finality">Reorgs and finality<a href="https://docs.recoilpay.com/blog/how-recoilpay-v2-works#reorgs-and-finality" class="hash-link" aria-label="Direct link to Reorgs and finality" title="Direct link to Reorgs and finality" translate="no">​</a></h3>
<p>The fill worker waits for a receipt, not finality, before moving on. That's
fine for the user's safety, because their escrow pays out only on a proof,
not on the worker's word. The risk sits with the solver: if a destination
reorg removes its fill after a proof was produced from it, the solver has
been reimbursed for a delivery that no longer exists. How safe the proof
layer is depends on how long validators wait before signing a checkpoint, and
on how many independent validators there are. On testnet, every chain
trusts <strong>one validator, which we operate, with a threshold of one</strong>. In other
words, today the proof is only as honest as that one key. Adding independent
validators, raising the threshold, and setting per-chain reorg windows all
come before mainnet.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="solver-liquidity">Solver liquidity<a href="https://docs.recoilpay.com/blog/how-recoilpay-v2-works#solver-liquidity" class="hash-link" aria-label="Direct link to Solver liquidity" title="Direct link to Solver liquidity" translate="no">​</a></h3>
<p>Solvers fill from their own inventory, so the largest order a route can
handle is whatever the best-funded solver on it holds. Quotes carry
<code>min_amount</code> and <code>max_amount</code>, and the aggregator doesn't show quotes a
solver can't honour. What happens when nobody fills:</p>
<ul>
<li class=""><strong>No solver opens the order:</strong> the user's funds never leave their wallet.
The Permit2 signature simply expires.</li>
<li class=""><strong>A solver opens but fails to fill:</strong> the funds are in escrow and become
refundable to the user at <code>expires</code>. On Solana, a worker sends those refunds
automatically within about a minute. <strong>On EVM, the user or anyone else has
to call <code>refund</code> today.</strong> An automatic EVM refund worker is next on our
list.</li>
</ul>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="trust-we-still-ask-for">Trust we still ask for<a href="https://docs.recoilpay.com/blog/how-recoilpay-v2-works#trust-we-still-ask-for" class="hash-link" aria-label="Direct link to Trust we still ask for" title="Direct link to Trust we still ask for" translate="no">​</a></h3>
<ul>
<li class=""><strong>Hosted fill wallets.</strong> Operators who use the portal trust us with a hot
wallet's key. The signing policy limits what that key will sign, but it
doesn't yet check that a fill matches a real order the operator claimed.
Licensed merchants will want their own keys. We're designing
merchant-held signing, and in the longer run custody through an external
MPC provider.</li>
<li class=""><strong>One attestor key for fiat.</strong> Fiat escrows trust an attestor, as designed.
Before mainnet it moves to a key management service, with a separate
guardian who can cancel a wrong slash.</li>
<li class=""><strong>One EVM testnet isn't proven yet.</strong> Recoil Link's contracts are deployed
on Avalanche Fuji, but its validator and relayer aren't running there yet.
Until they are, routes touching Fuji use a placeholder oracle that approves
every claim. That's fine for play money and not for anything else. Polygon
Amoy is the newest of the five proven chains, so it has the least mileage.
Solana proofs currently travel over Hyperlane's devnet deployment while
Recoil Link's Solana deployment is set up.</li>
<li class=""><strong>The contracts aren't audited yet.</strong> An audit comes before mainnet.</li>
</ul>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="what-the-testnet-is-validating">What the testnet is validating<a href="https://docs.recoilpay.com/blog/how-recoilpay-v2-works#what-the-testnet-is-validating" class="hash-link" aria-label="Direct link to What the testnet is validating" title="Direct link to What the testnet is validating" translate="no">​</a></h3>
<ul>
<li class="">That solvers who only publish quotes, and run no servers, can fill
reliably and stay profitable after paying for proofs.</li>
<li class="">The claim queue and resume logic under crashes and redeploys. A real
incident in November, where finished fills went unclaimed, led to "resume
from chain".</li>
<li class="">Proof latency and relayer reliability per chain pair, so solvers can price
them.</li>
<li class="">Whether non-crypto users understand a single signature and a "filled, then
settled" status.</li>
<li class="">The fiat leg end to end: clocks, disputes, bonds, and seller identity
checks.</li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="whats-next">What's next<a href="https://docs.recoilpay.com/blog/how-recoilpay-v2-works#whats-next" class="hash-link" aria-label="Direct link to What's next" title="Direct link to What's next" translate="no">​</a></h2>
<ul>
<li class="">Recoil Link on Avalanche Fuji, the last EVM testnet on the placeholder
oracle, so no route accepts a claim without a proof.</li>
<li class="">More than one validator, run by independent operators, with a threshold
above one.</li>
<li class="">Automatic EVM refunds, alerting and daily reconciliation between our
database and the chains.</li>
<li class="">Arc testnet with Circle's USDC, including a route from any chain into Arc
over CCTP (built and tested on testnet, in review).</li>
<li class="">An audit, then mainnet on one or two chains, cash-out first.</li>
</ul>
<p>If you build wallets, run liquidity, or have seen intent systems fail in ways
we haven't listed, we'd like to hear from you:</p>
<ul>
<li class=""><strong>Try it:</strong> <a href="https://v2.recoilpay.com/" target="_blank" rel="noopener noreferrer" class="">v2.recoilpay.com</a> (testnet)</li>
<li class=""><strong>Docs:</strong> <a href="https://docs.recoilpay.com/" target="_blank" rel="noopener noreferrer" class="">docs.recoilpay.com</a> and the <a href="https://api.recoilpay.com/swagger-ui" target="_blank" rel="noopener noreferrer" class="">API reference</a></li>
<li class=""><strong>Widget and SDK:</strong> <a href="https://www.npmjs.com/package/@recoilpay/intent-widget" target="_blank" rel="noopener noreferrer" class=""><code>@recoilpay/intent-widget</code></a>, <a href="https://www.npmjs.com/package/@recoilpay/intent-core" target="_blank" rel="noopener noreferrer" class=""><code>@recoilpay/intent-core</code></a>, <a href="https://github.com/recoil-labs/recoilpay-examples" target="_blank" rel="noopener noreferrer" class="">examples</a></li>
<li class=""><strong>Recoil Link:</strong> <a href="https://github.com/recoil-labs/recoil-link" target="_blank" rel="noopener noreferrer" class="">github.com/recoil-labs/recoil-link</a></li>
</ul>]]></content>
        <author>
            <name>Gino Osahon</name>
            <uri>https://github.com/recoil-labs</uri>
        </author>
        <category label="engineering" term="engineering"/>
        <category label="intents" term="intents"/>
        <category label="open-intents-framework" term="open-intents-framework"/>
        <category label="cross-chain" term="cross-chain"/>
    </entry>
</feed>