📖 Term 🟢 Plain English 🔰 Beginner

🔄 Atomic Swap Atomic Swap

A way for two people to trade crypto that lives on two different blockchains directly with each other, with no exchange or middleman holding the funds. The trade is all-or-nothing: it fully completes for both sides, or both get their own coins back.

💡
Common misconception — Could the other person grab your coins and run? No! An atomic swap is all-or-nothing by design: if the trade doesn't fully complete, a built-in deadline automatically returns everyone's coins. You don't have to trust the other person at all.
⛓️ Chain A⛓️ Chain B🙋‍♀️Alicelocks her coins 🔒🙋‍♂️Boblocks his coins 🔒🔑One sharedhashlockAlice claimsBob's coins 🪙Bob claimsAlice's coins 🪙⏳ stall past the deadline → both coins auto-refunded
🙋‍♀️ Alice and 🙋‍♂️ Bob each lock coins on their own chain to 🔑 one shared lock → revealing the secret lets each claim the other side's coins 🪙. ⏳ Stall past the deadline and both coins auto-refund!

🏦 The simple version — a safe-deposit box for two

Picture two strangers swapping items through a special safe-deposit box that only opens for both when each side has put their item in. If one person walks away, both boxes spring open and return what was inside. That is an atomic swap. Two people trade coins that live on different blockchains directly, peer-to-peer, and no exchange ever holds the money. The word "atomic" means all-or-nothing: there is no halfway state where one person loses.

🔐 How it works — the two locks (HTLC)

An atomic swap runs on a smart contract called a Hash Time-Locked Contract (HTLC). The name describes its two locks:

LockWhat it does
🔑 HashlockFunds stay locked until the correct secret is revealed. Revealing that secret on one chain unlocks the other side
⏳ TimelockA deadline. If the swap isn't finished in time, the contract auto-cancels and refunds both people

A typical flow: Alice picks a secret, hashes it, and locks her coins to that hash. Bob locks his coins to the same hash. Alice claims Bob's coins by revealing the secret on-chain, and that revealed secret is exactly what lets Bob claim Alice's coins. If anyone stalls, the timelock refunds everyone. Because the contract enforces all of this, the swap is trustless — neither person has to trust the other or a third party.

🆚 Why use this instead of an exchange?

  • 🔐 Self-custody — No company holds your coins mid-trade, so there's nothing for a hacked or failing exchange to lose
  • 💸 Lower fees — You skip the fees a centralized exchange charges to sit in the middle
  • 🌐 More decentralized — The swap happens directly between two people, not through one company's servers

Swaps can run on-chain (directly on each blockchain) or off-chain on payment-channel layers, like the kind the Lightning Network uses.

🚧 Limits beginners should know

  • 🧩 Not every pair works — Both blockchains generally need compatible hashing and timelock scripting, so not all coin pairs are supported
  • 📥 Early designs were clunky — The original on-chain version effectively required downloading both full blockchains
  • 📈 Scale and adoption — Atomic swaps are still working through challenges around speed and how widely they're used

📜 Where it started

The first successful atomic swap happened in September 2017, between Decred (DCR) and Litecoin (LTC). Days later, Litecoin founder Charlie Lee did an LTC-to-Bitcoin swap, trading 10 LTC for 0.1137 BTC. Soon after, Komodo introduced a "light mode" using payment channels, so users no longer needed to download whole blockchains. As a beginner, you'll most likely meet atomic swaps inside cross-chain or decentralized swap apps, or when learning why a centralized exchange isn't the only way to trade.

❓ FAQ

Could the other person grab my coins and run?
No. An atomic swap is all-or-nothing by design. If the trade does not fully complete in time, the timelock automatically refunds both sides their own coins. You never have to trust the counterparty, because the contract enforces the deal.
Can I swap any two coins this way?
Not always. Both blockchains generally need compatible hashing and timelock-style scripting for the contract to work, so not every coin pair is supported. Early on-chain designs were even clunkier — you effectively had to download both full blockchains.
Is this just a fancy version of using an exchange?
No. With an exchange, a company holds your coins while the trade happens. In an atomic swap no intermediary ever holds the funds — you keep self-custody the whole time, and a smart contract handles the swap directly between the two of you.

🔗 Related