What are Atomic Swaps?
An atomic swap is an exchange of two assets in which both transfers happen or neither does. No party can take the other's asset and keep their own. Atomic swaps remove the need for a trusted middleman, such as an exchange that holds funds during the trade.
How an atomic swap works
Most atomic swaps use a hash time-locked contract (HTLC).
- Alice locks her asset so that anyone who reveals a secret can claim it. Only the hash of the secret is public.
- Bob locks his asset with the same hash.
- Alice claims Bob's asset by revealing the secret. That reveal lets Bob claim Alice's asset.
- Each lock has a time limit. If the swap stalls, both parties get their funds back.
Because claiming one side exposes the secret needed for the other, the two transfers are linked. The same mechanism secures every Lightning payment across multiple hops.
Swaps on Lightning
- Submarine swaps exchange Lightning bitcoin for on-chain bitcoin. A swap out moves your channel balance to the remote side and gives you on-chain funds. A swap in does the reverse. Lightning Labs' Loop Out is an example. See submarine swaps.
- Cross-asset swaps exchange bitcoin for another asset that moves over Lightning, such as a stablecoin on Taproot Assets.
How Amboss handles atomic swaps
RailsX, the Amboss Lightning-native exchange, uses the atomic property of Lightning payments for cross-asset trades. A trade begins in a bitcoin channel, routes across the network and finishes in a Taproot Asset channel denominated in a stablecoin such as USDT-L or USDC-L. Amboss says the payment is atomic end to end, so the exchange of bitcoin and stablecoin is atomic as well. There is no bridge, no second blockchain and no utility token. Magma supplies channels in bitcoin and Taproot Assets, and Rails liquidity providers supply the depth.
Amboss says RailsX complements other tools. Its January 2026 announcement names Boltz, for sidechain and layer 2 connections, and RoboSats, for fiat to Lightning ramps. See the RailsX announcement and the launch post. To mint assets that can be traded this way, see how to mint assets on Taproot Assets.
Limits
An atomic swap protects against a counterparty taking funds, not against price movement between agreeing and settling. Time locks can delay a refund. A swap still needs liquidity on the other side: a stablecoin swap needs a provider with enough Taproot Asset channel capacity. See also decentralized exchanges.
