Skip to main content

One signature, two chains: how RecoilPay v2 settles cross-chain payments with intents

· 18 min read
Founder, Recoil Labs

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.

RecoilPay v2 replaces those steps with one signature. 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.

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.

Testnet

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.

The RecoilPay v2 app: one input for a payment in plain English

The problem: why cross-chain payments break​

Our first product, RecoilPay v1, is live at recoilpay.com 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:

Three problems keep recurring:

  1. Wrong-chain gas. 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.
  2. Multi-step approvals. 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.
  3. Fragmented liquidity and slow settlement. 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.

The fix we chose comes from the intents world: 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.

System overview: v1 and v2​

v1 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 FOR UPDATE SKIP LOCKED 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.

v2 is the intent architecture, and it's where this post focuses:

  • Clients: the web app, an embeddable web component, and a headless TypeScript SDK (@recoilpay/intent-core). All three use the same code.
  • The aggregator (Rust, Axum, Postgres): parses sentences into intents, ranks quotes, stores orders, runs the claim queue, and settles the fiat trades described further down.
  • Operators (solvers) publish quotes from a web portal. Nobody needs to run a server: a hosted fill worker executes their orders.
  • On-chain: the Open Intents Framework (OIF) settlers on each EVM chain, our own programs on Solana, and an oracle that verifies fills.
  • Recoil Link, our cross-chain messaging layer (a fork of Hyperlane), carries proofs of fills between chains.

How they connect today. 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.

The intent lifecycle​

Here is a cross-chain USDC transfer from Base Sepolia to OP Sepolia, from sentence to settlement.

Ordering happens between the user, the client and the aggregator. The user signs once and pays no gas:

Execution happens between the solver's fill worker and the chains:

1. From a sentence to an intent​

The sentence goes to POST /api/v1/intents/parse, 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.

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.

2. Quotes: operators push, the aggregator ranks​

Operators don't run quote servers. They publish a quote matrix from the portal: chain pairs, assets, a rate, and minimum and maximum sizes. For each request, the aggregator:

  1. loads every live, unpaused quote;
  2. filters by chain pair, asset pair, size range, exclusivity, and whether the operator's circuit breaker is open;
  3. scores what's left:
score = 0.50 · output (normalised)
+ 0.25 · reputation
+ 0.15 · success rate
+ 0.10 · (1 − latency)

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.

3. The order: one signature, no gas​

The user signs an OIF StandardOrder as a Permit2 PermitBatchWitnessTransferFrom. The witness is the part that matters:

// The EIP-712 witness inside the Permit2 signature
Permit2Witness: [
{ name: 'user', type: 'address' },
{ name: 'expires', type: 'uint32' }, // refund after
{ name: 'inputOracle', type: 'address' }, // attests fill
{ name: 'outputs', type: 'MandateOutput[]' },
],
// Exactly what must arrive, and where
MandateOutput: [
{ name: 'oracle', type: 'bytes32' },
{ name: 'settler', type: 'bytes32' },
{ name: 'chainId', type: 'uint256' },
{ name: 'token', type: 'bytes32' },
{ name: 'amount', type: 'uint256' },
{ name: 'recipient', type: 'bytes32' },
{ name: 'callbackData', type: 'bytes' },
{ name: 'context', type: 'bytes' },
]

Some consequences of signing this:

  • No gas for the order itself. 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.
  • The outputs are fixed. The token, amount, recipient and chain are inside the signature. A solver can't deliver less, and nobody can change the recipient after signing.
  • Fees are visible outputs. RecoilPay's fee, zero on testnet, is a second MandateOutput paying our treasury, inside the same signature. It isn't a separate transaction, and an unfilled order pays nothing.
  • Two clocks. fillDeadline (5 minutes after the quote) bounds when the solver may fill. expires (10 minutes, or 30 when the route waits for a cross-chain proof) is when the escrow becomes refundable to the user.

4. Claiming the order​

Orders go into a Postgres-backed queue. The fill worker claims in batches with a lease:

-- simplified
WITH next AS (
SELECT id FROM orders
WHERE claimable
AND (lease_expires_at IS NULL
OR lease_expires_at < now())
ORDER BY created_at
LIMIT 5
FOR UPDATE SKIP LOCKED
)
UPDATE orders
SET lease_expires_at = now() + interval '300 seconds'
FROM next
WHERE orders.id = next.id
RETURNING orders.*;

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.

5. Execution: open, fill, prove, finalise​

The worker sends four kinds of transaction:

StepChainContractEffect
openFororiginInputSettlerEscrowPulls the user's tokens through Permit2 into escrow, using their signature
filldestinationOutputSettlerSimpleSends the solver's tokens to the user and records the fill
submitdestinationRecoil Link oracleSends a proof of the fill, and pays the relayer's fee
finaliseoriginInputSettlerEscrowOnce the origin oracle reports the fill as proven, releases the escrow to the solver

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.

Before finalising, the worker checks isProven on the origin oracle, and it skips submit 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.

Who holds the solver's keys? 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: openFor and finalise on the registry's input settler, fill on its output settler, and an ERC-20 approve 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.

6. What "verified" means​

The escrow doesn't trust the solver, the worker or the aggregator. It trusts its input oracle, 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:

  1. The solver calls submit 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.
  2. 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.
  3. The origin oracle now answers isProven(...) == true for that output, and finalise succeeds. Without that proof, it reverts.

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 expires. That's why we refuse to fill orders that could be refunded before a proof can arrive.

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.

7. The same pattern for naira​

The settlement pattern also covers bank money. For a naira cash-out, the user's USDC is locked in an AttestedEscrow 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.

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.

It's a different oracle (an attestation instead of a cross-chain proof) behind the same promise: funds move only on evidence.

Frontend integration: <recoilpay-intent>​

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:

<script type="module"
src="https://cdn.jsdelivr.net/npm/@recoilpay/intent-widget@0.9/dist/recoilpay-intent-widget.js"></script>

<recoilpay-intent
hf-access-token="hf_…"
walletconnect-project-id="…"
mode="light"
accent="#0a7cff"
examples='[
{ "label": "Send 1 USDC",
"sentence": "send 1 USDC from base sepolia to op sepolia" }
]'
></recoilpay-intent>

Inputs. All settings are attributes, and the element re-renders when one changes:

  • mode, accent, accent-text, radius and font-family for theming. Your page's CSS can't reach inside, and the widget's styles can't leak out;
  • placeholder and examples for the prompt;
  • api-url to point at staging;
  • walletconnect-project-id to turn on mobile wallets over QR.

If your page already has a connected wallet, hand it over and the widget skips its own picker:

// Any EIP-1193 provider
const el = document.querySelector('recoilpay-intent');
el.provider = window.ethereum;

Outputs. Every state change your page might care about is a DOM event that bubbles out of the shadow root:

const on = (name, fn) => document.addEventListener(name, fn);

on('recoilpay-order-submitted', (e) => {
track('order', e.detail.orderId);
});
on('recoilpay-complete', (e) => {
// e.detail = { orderId, status, explorerUrl }
showReceipt(e.detail.explorerUrl);
});
on('recoilpay-error', (e) => {
// already written for the end user
showToast(e.detail.message);
});

There are also recoilpay-wallet, recoilpay-solana-wallet, 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.

If you want your own UI, the same flow is a small state machine in the headless SDK:

import {
createIntentSession,
viemWallet,
} from '@recoilpay/intent-core';

const session = createIntentSession({ hfAccessToken });

// Immutable snapshots: idle → quoted → tracking → done
session.subscribe(render);

await session.run(
'swap 10 USDC on Base Sepolia for USDC on OP Sepolia',
);
session.setWallet(viemWallet(walletClient));

// Switch chain → approve (once) → sign → submit
await session.confirm();

The phases are parsing, needsWallet, quoting, quoted, approving, signing, submitting, tracking, done and error. Nothing throws: every failure becomes a state with a message written for the end user. Runnable examples are in recoil-labs/recoilpay-examples.

Failure modes and trade-offs​

This is the part we most want feedback on.

Latency​

RouteUser receives fundsSolver is reimbursed
EVM ↔ EVM over Recoil Link5–20 s after signingafter the proof is relayed, about a minute
To or from Solanaseconds2–20 min, depending on the relayer
CCTP into Arc, then cash out (in review)Circle's fast transfer took ~15 s in our test runn/a (single chain)

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 expires is too close to leave room for one.

Slippage and price risk​

The user has no slippage: 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 fillDeadline (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.

Reorgs and finality​

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 one validator, which we operate, with a threshold of one. 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.

Solver liquidity​

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 min_amount and max_amount, and the aggregator doesn't show quotes a solver can't honour. What happens when nobody fills:

  • No solver opens the order: the user's funds never leave their wallet. The Permit2 signature simply expires.
  • A solver opens but fails to fill: the funds are in escrow and become refundable to the user at expires. On Solana, a worker sends those refunds automatically within about a minute. On EVM, the user or anyone else has to call refund today. An automatic EVM refund worker is next on our list.

Trust we still ask for​

  • Hosted fill wallets. 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.
  • One attestor key for fiat. 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.
  • One EVM testnet isn't proven yet. 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.
  • The contracts aren't audited yet. An audit comes before mainnet.

What the testnet is validating​

  • That solvers who only publish quotes, and run no servers, can fill reliably and stay profitable after paying for proofs.
  • 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".
  • Proof latency and relayer reliability per chain pair, so solvers can price them.
  • Whether non-crypto users understand a single signature and a "filled, then settled" status.
  • The fiat leg end to end: clocks, disputes, bonds, and seller identity checks.

What's next​

  • Recoil Link on Avalanche Fuji, the last EVM testnet on the placeholder oracle, so no route accepts a claim without a proof.
  • More than one validator, run by independent operators, with a threshold above one.
  • Automatic EVM refunds, alerting and daily reconciliation between our database and the chains.
  • Arc testnet with Circle's USDC, including a route from any chain into Arc over CCTP (built and tested on testnet, in review).
  • An audit, then mainnet on one or two chains, cash-out first.

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: