Skip to content
deyoungjohnPublic

About

Atomic stablecoin swaps between six EVM chains and Bitcoin Cash: USDC, USDT, USDG ⇄ PUSD, MUSD. No bridge, no custodian, recoverable. Built for BCH BLAZE 2026.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

495 Commits

Folders and files

Repository files navigation

Ferry

Status: Sunset (December 2026). Ferry is no longer operated live (ferry.incepture.dev and the solver have been shut down) and this repository is archived as a reference for the BCH BLAZE 2026 build. The on-chain contracts are ownerless and immutable; anyone needing to recover an older swap can still use the standalone recover.html file locally without a server.

Move stablecoins in and out of Bitcoin Cash. Ferry swaps USDC, USDT and USDG on six EVM chains for PUSD and MUSD on Bitcoin Cash, and back, with atomic swaps: either both sides happen or your money comes back. Nothing is wrapped, minted or held by a custodian. It also does pay links (get paid in PUSD by anyone holding dollars on six chains) and send links (send PUSD to someone who only has an EVM wallet), and every swap can be recovered with your wallet on any device.

  • Built for: BCH BLAZE 2026
  • Standalone recovery: recover.html (works offline/locally with no server)

Before your first swap: the recovery signature

The first time you swap from an EVM wallet on a device, your wallet asks you to sign a message titled "Ferry recovery key" before anything else. It is a typed message, not a transaction: it moves no funds, costs no gas and grants no approval. Ferry derives each swap's secret from that signature, which is what lets you find and finish any of your swaps from any device later (Wallet-derived recovery key). After it, you approve the swap itself (a permit and a lock request, or an approve and a lock on tokens without a permit).

The message has no chain id on purpose, so the same key comes out on every chain. A few wallets refuse a message without a chain id; with those, Ferry skips it and gives you a recovery file for each swap instead.

How a swap works

 You                                         Solver
 ---                                         ------
 lock A on chain X  (hash H, deadline T1)  -->
                                           <--  lock B on chain Y (hash H, deadline T2 < T1)
 claim B with the secret S   (S is now public)
                                           -->  claim A with S
  1. You lock your stablecoin in FerryHTLC on your chain, under the hash of a secret only you know.
  2. An independent solver locks the other side on the other chain, under the same hash, with an earlier deadline.
  3. You claim the solver's lock by revealing the secret; the solver uses the revealed secret to claim yours.

If anything stops, each lock refunds to its owner after its deadline. The first lock always outlives the second by a statistical margin over Bitcoin Cash block times, checked by the solver and again in your browser. Details: Atomic swaps and Timeouts and refunds.

What you can do

Feature What it does Docs
Swap in USDC, USDT or USDG to PUSD or MUSD in about a minute, gasless on most routes Swap into Bitcoin Cash
Swap out PUSD or MUSD to an EVM stablecoin, with WizardConnect for the Bitcoin Cash wallet Swap out of Bitcoin Cash
Pay links Fixed or open amount; the payer picks any chain and stablecoin Pay links
Send links The receiver picks a route and signs one free message; unclaimed links refund Send links
Recovery One wallet signature finds every swap on any device; recover.html works with no server at all Recovery

Mainnet contracts

FerryHTLC 0xfC28c2596C553353578a5a444d2316514009DAdF, the same address on all six chains through the standard deterministic deployer, with no owner, admin, pause or upgrade.

Earlier contract. Swaps 1 to 14 in the table below (Base and Arbitrum One, 19 November) went through an earlier deployment of the same contract, 0x8b968625F983420B571C102eC0b57F7e509c916e, built with different compiler settings. It is also ownerless and source verified (Sourcify), and the recovery tools still read it. Every swap from number 15 on uses 0xfC28…DAdF.

Chain Contract Source verified on
Base basescan Sourcify
Ethereum etherscan Etherscan
Arbitrum One arbiscan Arbiscan
BNB Chain bscscan Sourcify
Arc explorer.arc.io Sourcify
Robinhood Chain blockscout Sourcify

On Bitcoin Cash each swap gets its own CashScript covenant (FerryHTLC.cash), keyless for claims and refunds, holding PUSD (category 2469acc5…a02544) or MUSD (category b38a33f7…87f366).

Mainnet transactions

Who made these swaps. These are test swaps I ran with my own wallets to exercise every route in both directions. They are real mainnet transactions with real funds, but they are not outside users, and the volume below is test volume, not customer volume.

On 22 November 2026 the live solver reported 60 completed swaps and $501.58 settled, with a 44 s median on the fast lane (/v1/stats). Every PUSD route has run in both directions, and MUSD has run both ways on Base (USDC to MUSD and MUSD to USDC, 22 November, swaps 49 and 51). The 60 include pay-link and send-link swaps, which the table below leaves out.

Current source of truth: this README is a snapshot taken before the deadline. For what has happened since (including swaps after this snapshot), see the Recent swaps table on the swap page, which refreshes every 20 seconds and shows the latest 50 completed swaps with their transactions, and /v1/stats for the running totals. All 51 swaps so far, with every transaction (dates 2026, UTC; "Time" is from quote to last claim):

# Date Swap Chain Time Transactions
1 11-19 1.00 USDC → 0.99 PUSD Base 3566 s lock · counter-lock · your claim · solver claim
2 11-19 1.00 USDC → 0.99 PUSD Base 1154 s lock · counter-lock · your claim · solver claim
3 11-19 5.00 USDC → 4.98 PUSD Base 102 s lock · counter-lock · your claim · solver claim
4 11-19 5.00 USDC → 4.98 PUSD Base 101 s lock · counter-lock · your claim · solver claim
5 11-19 5.00 USDC → 4.98 PUSD Base 94 s lock · counter-lock · your claim · solver claim
6 11-19 4.00 PUSD → 3.98 USDC Base 43 s lock · counter-lock · your claim · solver claim
7 11-19 7.00 PUSD → 6.97 USDC Base 38 s lock · counter-lock · your claim · solver claim
8 11-19 2.02 USDC → 2.01 PUSD Base 96 s lock · counter-lock · your claim · solver claim
9 11-19 2.00 PUSD → 1.99 USDC Base 4547 s lock · counter-lock · your claim · solver claim
10 11-19 8.00 USDC → 7.96 PUSD Base 36 s lock · counter-lock · your claim · solver claim
11 11-19 5.00 PUSD → 4.98 USDC Arbitrum One 40 s lock · counter-lock · your claim · solver claim
12 11-19 5.00 USDC → 4.98 PUSD Base 43 s lock · counter-lock · your claim · solver claim
13 11-19 8.00 USDC → 7.96 PUSD Arbitrum One 3268 s lock · counter-lock · your claim · solver claim
14 11-19 9.00 USDC → 8.96 PUSD Arbitrum One 774 s lock · counter-lock · your claim · solver claim
15 11-20 11.00 PUSD → 10.95 USDC Arc 80 s lock · counter-lock · your claim · solver claim
16 11-20 10.95 USDC → 10.90 PUSD Arc 45 s lock · counter-lock · your claim · solver claim
17 11-20 5.00 PUSD → 4.99 USDT BNB Chain 63 s lock · counter-lock · your claim · solver claim
18 11-20 4.99 USDT → 4.98 PUSD BNB Chain 80 s lock · counter-lock · your claim · solver claim
19 11-20 11.00 PUSD → 10.98 USDG Robinhood Chain 46 s lock · counter-lock · your claim · solver claim
20 11-20 10.98 USDG → 10.96 PUSD Robinhood Chain 960 s lock · counter-lock · your claim · solver claim
21 11-20 7.50 PUSD → 7.49 USDC Ethereum 242 s lock · counter-lock · your claim · solver claim
22 11-20 7.49 USDC → 7.48 PUSD Ethereum 412 s lock · counter-lock · your claim · solver claim
23 11-20 8.60 PUSD → 8.59 USDT Ethereum 114 s lock · counter-lock · your claim · solver claim
24 11-20 8.59 USDT → 8.58 PUSD Ethereum 93 s lock · counter-lock · your claim · solver claim
25 11-20 12.00 PUSD → 11.99 USDT Arbitrum One 28 s lock · counter-lock · your claim · solver claim
26 11-20 11.99 USDT → 11.98 PUSD Arbitrum One 42 s lock · counter-lock · your claim · solver claim
27 11-20 10.00 USDC → 9.99 PUSD Base 36 s lock · counter-lock · your claim · solver claim
28 11-20 12.01 PUSD → 12.00 USDC Base 40 s lock · counter-lock · your claim · solver claim
29 11-20 12.00 USDC → 11.99 PUSD Base 62 s lock · counter-lock · your claim · solver claim
30 11-20 12.01 PUSD → 12.00 USDC Arbitrum One 26 s lock · counter-lock · your claim · solver claim
31 11-20 4.00 PUSD → 3.99 USDT BNB Chain 44 s lock · counter-lock · your claim · solver claim
32 11-20 14.00 PUSD → 13.99 USDG Robinhood Chain 31 s lock · counter-lock · your claim · solver claim
33 11-20 14.00 USDG → 13.99 PUSD Robinhood Chain 4773 s lock · counter-lock · your claim · solver claim
34 11-20 6.00 PUSD → 5.99 USDC Base 39 s lock · counter-lock · your claim · solver claim
35 11-20 11.00 PUSD → 10.99 USDC Ethereum 130 s lock · counter-lock · your claim · solver claim
36 11-20 25.00 PUSD → 24.98 USDG Robinhood Chain 55 s lock · counter-lock · your claim · solver claim
37 11-20 24.98 USDG → 24.96 PUSD Robinhood Chain 1155 s lock · counter-lock · your claim · solver claim
38 11-21 5.00 PUSD → 4.99 USDC Ethereum 181 s lock · counter-lock · your claim · solver claim
39 11-21 4.99 USDC → 4.98 PUSD Ethereum 2828 s lock · counter-lock · your claim · solver claim
40 11-21 12.00 PUSD → 11.99 USDC Arbitrum One 44 s lock · counter-lock · your claim · solver claim
41 11-21 6.00 PUSD → 5.99 USDC Arc 41 s lock · counter-lock · your claim · solver claim
42 11-21 11.00 USDC → 10.99 PUSD Base 36 s lock · counter-lock · your claim · solver claim
43 11-21 10.00 PUSD → 9.99 USDC Base 29 s lock · counter-lock · your claim · solver claim
44 11-21 6.00 USDC → 5.99 PUSD Arc 69 s lock · counter-lock · your claim · solver claim
45 11-21 9.00 PUSD → 8.99 USDC Ethereum 98 s lock · counter-lock · your claim · solver claim
46 11-21 8.00 USDC → 7.99 PUSD Ethereum 246 s lock · counter-lock · your claim · solver claim
47 11-21 7.00 USDC → 6.99 PUSD Base 35 s lock · counter-lock · your claim · solver claim
48 11-21 6.99 PUSD → 6.98 USDC Base 25 s lock · counter-lock · your claim · solver claim
49 11-22 5.00 USDC → 4.99 MUSD Base 39 s lock · counter-lock · your claim · solver claim
50 11-22 2.00 PUSD → 1.99 USDC Base 24 s lock · counter-lock · your claim · solver claim
51 11-22 5.00 MUSD → 4.99 USDC Base 39 s lock · counter-lock · your claim · solver claim

Full order ids: mainnet.md. The same record in the docs: Mainnet record.

Testnet and mainnet

Ferry was first built on testnets before BCH BLAZE 2026, as ferry-testnet. This repository was started fresh on 15 November 2026 and is not a fork of it. On testnet only Base Sepolia to chipnet, and back, was ever swapped end to end.

Testnet build Mainnet build (this one)
Swaps that worked end to end Base Sepolia USDC to chipnet tPUSD, and back. Nothing else Every PUSD route in both directions on six chains, and MUSD both ways on Base: 60 test swaps from the owner's own wallets, $501 settled by 22 Nov (record)
Other chains The contract was deployed to some other testnets and poked by scripts; never swapped, never in the app Base, Ethereum, Arbitrum One, BNB Chain, Arc, Robinhood Chain, all live in the app
Bitcoin Cash tokens Self-minted test tokens (tPUSD) on chipnet Real PUSD (ParyonUSD) and MUSD (Moria v1) on mainnet
EVM stablecoins Test USDC on Base Sepolia USDC, USDT and USDG
EVM contract FerryHTLC on Base Sepolia FerryHTLC at 0xfC28…DAdF on six mainnets, source verified (swaps 1 to 14 used the earlier 0x8b96…916e)
Pay links A page existed; never tested Live and used: fixed or open amount, any chain and token, delete unpaid links
Send links Not built Live: receiver chooses the route and signs one free message; unclaimed links refund
Recovery A recovery file and a recovery page existed; never tested on a real stuck swap Tested on mainnet: wallet-derived key finds and finishes a swap from another browser; files and recover.html
Finishing a swap Keep the page open Finish with your wallet from any device, or the optional handoff
Bitcoin Cash wallets Locks signed in testing setups WizardConnect, with Ferry's own relay and fallback to public relays
Pricing Fixed test prices Live Chainlink, Cauldron and Paryon prices with a peg guard
Gas for the user Permit and relayed lock on Base Sepolia Gasless locks and claims on every permit token
Testing Unit and end-to-end tests on Base Sepolia and chipnet Plus fork rehearsals on every chain, 30,000 fuzz runs, 2,700 covenant attacks, a 200-swap load run (details)

How it was tested

Re-run on 21 November 2026. How to run each yourself: How Ferry was tested.

Claim on the site Evidence
20,000 Foundry fuzz runs 6 fuzz properties of FerryHTLC.sol at 5,000 runs each (30,000), plus an invariant suite of 5,000 runs and 320,000 calls with no violation; all 67 Foundry tests pass
1,100+ BCH covenant attacks rejected Every claim and refund path run against 1,382 mutated transactions per token in the libauth VM: 1,356 rejected, the rest documented harmless variants
200 load-run swaps, 0 failures 200 concurrent swaps against the real solver engine and contract on a local Anvil chain: 200 completed, 0 nonce or database errors

Plus about 1,500 unit tests, 28 adversarial tests, 15 end-to-end tests, fork rehearsals on Base, Ethereum, Arbitrum and BNB Chain, and a fork matrix on every chain.

Repository

Package What it does
packages/core Order terms and id, signing, timing invariants, pricing, recovery key, recovery file, links, API schemas
packages/htlc-evm FerryHTLC.sol, Foundry tests, deterministic deploy and verify
packages/htlc-bch FerryHTLC.cash, keyless claim and refund builders checked in the libauth VM, WizardConnect requests
packages/chain-config Verified chain and token facts, fail-closed routes, RPC fallbacks
packages/chain-evm EVM adapter: locks, claims, relays, log scanning
packages/solver The solver daemon and its /v1 API
packages/solver-client Typed client with local quote verification
packages/user-flow The user's side of a swap as a browser library
packages/web The website and the docs
packages/recover-page, packages/recover-cli Recovery without the website
packages/bch-prices, packages/evm-prices Price sources and the peg guard
packages/e2e, packages/fork-tests, packages/probe End-to-end, fork and live probe tests

More: Architecture, Solver API, Security model, and docs/.

Run locally

Requires Node 22, pnpm 9 and Foundry.

pnpm install
pnpm format:check && pnpm typecheck && pnpm lint
pnpm test:unit
pnpm check:private

See the interface with mocks, no solver or wallet needed:

VITE_NETWORK=testnet VITE_MOCK=1 pnpm --filter @ferry/web dev

Deploying (Caddy, systemd, the WizardConnect relay): deploy/README.md and Running Ferry.

Recovery without the website

recover.html is one self-contained page. Open it from your computer, press Recover with wallet (or load your recovery file), and it reads the chains directly and sends the claim or refund: an EVM transaction through your browser wallet, or a Bitcoin Cash transaction that needs no wallet. It needs no Ferry server and no solver.

Build disclosure

  • Prior work: ferry-testnet is the public testnet implementation built before BCH BLAZE 2026. Design notes and measured results from that work are in preparation/.
  • AI-assisted development: this repository was written by a small team of AI coding agents (Claude) working in parallel under human direction, as recorded in the Co-Authored-By commit trailers.

Credits

The swap card's layout and token picker are adapted from the Swap block at https://beui.dev/components/blocks/swap, and the pagination control and date range picker from beui.dev components, used with the maintainer's permission. Built with CashScript, libauth, Foundry, OpenZeppelin, viem, wagmi, Reown AppKit and WizardConnect. PUSD by Paryon, MUSD by Moria.

License

MIT

About

Atomic stablecoin swaps between six EVM chains and Bitcoin Cash: USDC, USDT, USDG ⇄ PUSD, MUSD. No bridge, no custodian, recoverable. Built for BCH BLAZE 2026.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages