Skip to content
Kriptofoni
Crypto GlossaryBlockchain & Technology

What Is Atomic Swap?

Also known as: Cross-Chain Atomic Swap, Atomic Cross-Chain Trading, HTLC Swap

In short

An atomic swap is a method that lets two parties directly exchange cryptocurrencies on different blockchains without trusting a centralized exchange or intermediary, where the swap either completes fully or does not happen at all.

Atomic swaps are usually carried out with hash time-locked contracts (HTLCs). For example, say Alice wants to swap Bitcoin and Bob wants to swap Litecoin. Alice chooses a secret number and creates a Bitcoin transaction locked with the hash of this number; the funds can be claimed only by the party who knows the secret number and within a certain time. Bob creates a lock with the same hash on the Litecoin side with a shorter time limit. To claim the Litecoin, Alice has to reveal the secret number; once the number is revealed, Bob uses it to claim the Bitcoin.

If one of the parties backs out during the process, the funds return to their owners when the time locks expire; this way, no one has to rely on the counterparty's honesty. The term atomic expresses that the transaction is indivisible, meaning it cannot be left half-finished. The same mechanism is also used to route payments securely in the Lightning Network.

Atomic swaps require both blockchains to support the same hash function and time-lock features. Their use has remained limited because of the complex user experience, the difficulty of finding a counterparty and the possibility of the price changing during the process. Today, most cross-chain swaps are done through bridges and cross-chain protocols.

Last updated: · This content is for information purposes only and is not investment advice.

Related terms