How a BTC / XMZ swap works
Two strangers trade Bitcoin for Monzero without an exchange, an escrow agent or trusting each other. The two blockchains enforce every step: either both sides get paid, or both get their coins back.
Test networks only. These swaps run on Bitcoin signet and the Monzero test network. Mainnet trading is switched off in the code.
The two traders
Pays with Bitcoin
Uses the Bitcoin light wallet built into the Monzero app, so he doesn't need to run a Bitcoin node.
Gets paid in Bitcoin
Uses her Monzero wallet. For now her app also needs a Bitcoin node to check the chain; a light-wallet option for sellers is being designed.
Step by step
Amounts are from the signet test swap on 25 October: 0.002 BTC for 1 XMZ, with a 36-block safety timelock.
Both apps sign the deal before any money moves
Bob accepts Alice's signed quote. The apps exchange identities, keys and proofs, then each saves pre-signed cancel and refund transactions. From here, either side can always get their coins back.
0.002 BTC goes into a shared contract
Bob approves the payment in his app. The coins sit in a 2-of-2 contract: spending them needs both traders' keys, or the timelock to pass.
1 XMZ goes to a shared address
Alice's app checks Bob's lock first. Then she sends 1 XMZ plus a small fee reserve to an address that can only be spent with both traders' key shares.
A signature with a catch
Bob checks the XMZ lock, then gives Alice an adaptor signature for claiming the BTC. To use it, Alice has to reveal her XMZ key share.
0.0019 BTC to Alice
While the timelock is still safely far away, Alice completes the signature and broadcasts it. 0.0001 BTC goes on the network fee. Publishing it puts her XMZ key share on the Bitcoin chain.
Exactly 1 XMZ to Bob
Bob's app reads Alice's redeem from the Bitcoin chain, recovers her key share and sweeps the 1 XMZ to his wallet. The unused fee reserve goes back to Alice.
Why neither side can cheat
Alice can only take the Bitcoin by publishing the very thing Bob needs to take the XMZ. If she never claims, the timelock runs out and Bob gets his Bitcoin back.
Alice never locks her XMZ, or never claims before the timelock
Bob's 0.002 BTC is sitting in the contract. Nobody can take it alone, and the 36-block timelock is counting down.
Bob broadcasts the pre-signed cancel
This moves the coins out of the swap contract into a refund contract. It was signed by both apps back in step 1, so Alice's help isn't needed.
0.0018 BTC back in Bob's light wallet
Bob's app sends the refund. The 0.0002 BTC difference is the two network fees. Tested on testnet4 and on signet.
Bob's refund unlocks Alice's XMZ
If Alice did lock XMZ, Bob's refund transaction reveals his key share, so Alice's app can sweep her XMZ back.
Alice can take the BTC
If Bob cancels but never refunds, after 10 more blocks Alice can punish and take the Bitcoin. Otherwise her XMZ would stay stuck, so this keeps both sides honest.
The clock, in Bitcoin blocks
Alice's app refuses to claim when the timelock is close; it keeps a safety margin of several blocks. On Bitcoin, 36 blocks is about six hours.
What if an app crashes mid-trade?
Everything is saved before it is sent
Each signed transaction is written to disk before broadcast. A reopened app sends the same bytes again: no double payment, and nothing is signed twice.
Tested with the power pulled
On 25 October the buyer's machine was switched off mid-swap without shutting down. After reboot its wallet and trade files were intact and the swap finished with exact amounts.
Approvals don't carry over
After a restart, any approval that hadn't been used is cleared. You review and approve again with fresh chain data.
Each app checks the chain itself
Neither app takes the other trader's word for a payment. Bob's light wallet verifies Bitcoin block headers and proofs; Alice's app checks with her own node.
Test runs so far
| Run | Network | Result | Time |
|---|---|---|---|
| Complete swap | Bitcoin signet | 1 XMZ to buyer, 0.0019 BTC to seller | ≈ 1 h 45 m |
| Refund after timelock | Bitcoin signet | 0.0018 BTC back to buyer, XMZ back to seller | ≈ 4 h 24 m |
| Refund after restart | Bitcoin testnet4 | Reopened app cancelled and refunded | ≈ 2 days* |
| Two separate machines | Bitcoin signet | Swap completed, exact amounts | ≈ 2 h 01 m |
| Buyer app stopped after signing | Bitcoin signet | Reopened, resent same lock, completed | ≈ 1 h 12 m |
| Buyer machine powered off | Bitcoin signet | Rebooted, files intact, completed | ≈ 1 h 39 m |
* Testnet4 mined only empty blocks for about two days, so the cancel waited in the mempool.
Still to come before mainnet: a light-wallet option for sellers, independent review, and release validation.
Follow progress on the Monzero roadmap.