概念

原子兑换:当聚合器不是答案时。

An atomic swap moves value between chains without a third party holding either side. This guide demystifies the BTC ↔ XMR variant — the actual cryptographic mechanism, the implementations that exist today, and the cases where it beats (and loses to) a standard instant swap.

阅读 12 分钟 · 已更新 May 2026

The short version

  • Atomic swaps are real and they work. BTC ↔ XMR atomic swaps have been usable since 2020 and are now mature.
  • The trust assumption is cryptographic, not human. The protocol guarantees that either both legs settle or both legs refund — no third party can steal mid-swap.
  • The UX is improving but not yet competitive on small orders. A 30-minute handshake is fine for $50,000; less fine for $200.
  • Aggregators trade some custody risk for much better UX. The aggregator briefly holds your deposit; the atomic swap never does. For typical amounts, the trade is worth it.

What an atomic swap actually is

An atomic swap is a cross-chain trade between two parties who hold different assets and want to exchange them, enforced by cryptography on both chains so that one of two outcomes is mathematically guaranteed: both parties end up with the asset they wanted, or both parties end up with the asset they started with (after a time-lock expires). There is no outcome where one party gets the funds and the other is left holding nothing.

The mechanism is a hash time-locked contract (HTLC). At a high level: Alice locks her BTC behind a hash; Bob locks his XMR behind the same hash; whoever reveals the preimage first claims their counterparty's funds, and the act of claiming reveals the preimage to the counterparty, who can then claim too. If neither reveals before the time-lock expires, both can recover their original funds.

For BTC ↔ XMR specifically, the implementation is more subtle because Bitcoin's scripting language supports HTLCs natively while Monero's does not. The actual protocol uses an adaptor signature scheme that achieves the same atomicity property without requiring Monero to support hash time-locks directly. The mathematics is sound; the implementations are battle-tested.

The implementations that exist today

COMIT

The canonical BTC ↔ XMR atomic swap implementation, from the COMIT network. CLI-driven, requires both parties to run a node, requires both parties to be online simultaneously for the handshake (~30+ minutes). The reference implementation is open-source and audited. Production-ready for users comfortable with a terminal.

Farcaster

A GUI front-end on top of the COMIT protocol. Easier to use than the raw CLI, still requires a local node, still requires synchronous coordination. The right starting point for an atomic-swap-curious user who does not want to write JSON-RPC by hand.

Haveno

A fork of Bisq specifically for Monero. Provides a non-custodial marketplace with fiat and crypto pairs. Not strictly a pure atomic swap (it uses a multisig escrow with arbitrators for fiat trades) but lives in the same philosophical space — no central custodian. Useful for off-ramp scenarios where you want to convert XMR to local fiat without KYC.

UnstoppableSwap, MMRouter, others

Smaller implementations exist, some peer-to-peer marketplaces with embedded atomic swap support. The space is improving rapidly; the names will change. The underlying protocol is the durable thing.

When to use an atomic swap vs an aggregator

Use an atomic swap when

  • Amount is large. Above ~$10,000 the spread saved (atomic swaps quote tighter than aggregators on big orders) typically justifies the UX cost.
  • Threat model requires zero third-party custody. Aggregators hold your deposit for the duration of the swap — typically minutes, but non-zero. Atomic swaps hold nothing for either party at any moment.
  • Principled preference for trust-minimised protocols. If you value the property of "no central point of trust" intrinsically, atomic swaps deliver it. Aggregators do not.
  • Operational comfort with a terminal. The UX is acceptable but not great; you should be comfortable copying JSON-RPC commands.

Use an aggregator (NoKYCSwap) when

  • Amount is typical. Under $5,000 the aggregator is faster, cheaper, and easier.
  • You need it now. 8 minutes vs 30+ minutes matters when you are mid-task.
  • You want a one-page UX. Aggregators are a widget; atomic swaps are a protocol.
  • You do not have a counterparty online. Aggregators always have liquidity; atomic swaps need a willing peer.

A typical atomic-swap walkthrough (high level)

You will not run an atomic swap from this page — that requires a dedicated client. The mental model:

  1. Set up a peer connection. Run the COMIT/Farcaster client; either discover peers via the public network or coordinate with a specific peer out of band.
  2. Agree on amounts and the rate. Both peers quote; one accepts. The rate is locked in cryptographically.
  3. Each side locks funds behind the shared hash. Alice locks BTC; Bob locks XMR. Each lock is independently visible on-chain.
  4. One side reveals the preimage to claim. This automatically allows the other side to claim too.
  5. Both sides have what they wanted. The cryptography enforced atomicity; no third party was involved.

The whole thing takes 30–60 minutes in practice, dominated by Bitcoin confirmation depth on the locked side.

The trade-offs, summarised honestly

Aggregators (this site) and atomic swaps solve overlapping problems. The summary table:

  • Custody during swap: aggregator briefly holds; atomic swap never holds.
  • Time to settle: aggregator ~8 min; atomic swap ~30–60 min.
  • Spread on $200 swap: aggregator ~0.5–1%; atomic swap can be wider due to setup cost.
  • Spread on $50,000 swap: aggregator ~0.3–0.5%; atomic swap often tighter.
  • UX: aggregator is a widget; atomic swap is a protocol.
  • Counterparty availability: aggregator always works; atomic swap needs an online peer.
  • Trust assumption: aggregator (and its upstream liquidity router); atomic-swap mathematics.

Neither dominates the other. They are complementary tools.

Frequently asked questions

What is an atomic swap?+
A cross-chain trade where either both legs settle or both legs roll back — there is no scenario where one party gets the funds and the other is stranded. It uses hash time-locked contracts on both chains to enforce atomicity cryptographically rather than via a trusted third party.
Do atomic swaps need a coordinator?+
BTC ↔ XMR atomic swaps need a counterparty who is making the opposite trade, but they do not need a custodial intermediary. Coordination can happen on a peer-to-peer network (COMIT, Farcaster) or on a non-custodial coordination layer (Haveno).
Are atomic swaps faster than aggregators?+
Almost always slower. The cryptographic handshake takes 30+ minutes and requires both peers to be online simultaneously. Aggregators settle in ~8 minutes regardless of counterparty availability.
Are atomic swaps cheaper?+
On large orders, often yes — the aggregator spread (0.5–1%) exceeds the atomic-swap setup cost. On small orders, the per-swap setup cost dominates and aggregators are cheaper.
Why aren't atomic swaps mainstream yet?+
UX. The cryptographic protocol works; the user experience does not yet match a one-page widget. Farcaster and Haveno are improving this, but for a typical $200 swap the user friction is too high relative to the aggregator alternative.
What is the difference between COMIT, Farcaster, and Haveno?+
COMIT is the canonical BTC-XMR atomic swap implementation (CLI-driven). Farcaster is a GUI front-end with an improving UX. Haveno is a non-custodial coordination network for Monero trades including fiat — a different category from pure BTC-XMR atomic swaps but in the same spirit.
Can atomic swaps fail?+
Both legs can fail gracefully (refund) if one peer disappears mid-swap. The HTLC time-lock ensures funds are recoverable. The failure mode is "wasted time," not "lost money."
Should I use an atomic swap instead of NoKYCSwap?+
For very large amounts where 0.5% saved spread justifies 30+ minutes of additional time and CLI complexity, or for threat models where any third-party custody (even momentary) is unacceptable. For typical amounts, the aggregator is the right call.

准备好 付诸实践?