Quick Definition

A technology enabling direct peer-to-peer cryptocurrency trades between different blockchains without intermediaries or centralized exchanges.

What Is Atomic Swap?

An atomic swap is a smart contract technology that enables the direct exchange of one cryptocurrency for another across different blockchains without requiring a trusted third party, centralized exchange, or intermediary. The "atomic" aspect means the trade either completes entirely or doesn't happen at all — there is no scenario where one party sends their crypto and the other doesn't, eliminating counterparty risk.

The mechanism relies on Hash Time-Locked Contracts (HTLCs), a cryptographic technique that works like a two-key lockbox with a timer. Here's the simplified process: Alice wants to trade 1 BTC for Bob's 50 ETH. Alice generates a secret number, creates a hash of it, and locks her BTC in a contract that only releases to Bob if he provides the correct secret within 24 hours. Bob sees Alice's locked BTC and creates a matching contract locking his ETH, using the same hash, with a shorter 12-hour timelock. Alice claims Bob's ETH by revealing her secret, which automatically enables Bob to claim Alice's BTC using the now-revealed secret.

While conceptually elegant, atomic swaps face practical challenges that have limited widespread adoption. They require both blockchains to support the same hashing algorithm, liquidity can be thin for exotic pairs, and the process is slower than centralized exchange trades. However, the technology underpins several important developments: Lightning Network cross-chain payments, THORChain's decentralized cross-chain swaps, and various DEX protocols. As cross-chain infrastructure matures, atomic swap principles continue to influence how value moves between blockchain ecosystems without trusted intermediaries.

Atomic Swap Example

  • 1Alice wants to trade 1 BTC for Bob's 20 ETH directly without using Binance or Coinbase. They use an atomic swap protocol: Alice locks her BTC with a hash lock, Bob matches it with his ETH, and when Alice reveals the secret to claim the ETH, Bob automatically gains access to the BTC. The entire trade happens without either party trusting the other.
  • 2THORChain implements a form of atomic swap using liquidity pools to enable native cross-chain trades. A user swaps real BTC for real ETH through THORChain, with the protocol's nodes coordinating the settlement on both chains. Unlike wrapped tokens, the user receives native ETH directly in their wallet.