LearnAdvanced

Atomic Swaps Explained: Trustless Cross-Chain Trading

Atomic swaps enable trustless peer-to-peer trading across blockchains using Hash Time-Locked Contracts. Thorchain processes $5B+ in atomic swaps annually with zero intermediary risk.

Updated: April 11, 2026Reading time: 13 min
D
DegenSensei·Content Lead
·
Apr 10, 2026
·
Updated Apr 12, 2026
·
13 min read

What are Atomic Swaps?

Atomic swaps enable trustless peer-to-peer exchange of cryptocurrencies across different blockchains without intermediaries. An atomic swap means either both parties receive their assets or neither do—there is no partial execution or counterparty default risk. The entire transaction is either confirmed on-chain or reverted, eliminating the need for exchanges or custodians.

💡Why This Matters

This is one of those topics where surface-level understanding is dangerous. We've seen traders lose significant capital from misconceptions covered in this guide.

Historically, trading between Bitcoin and Ethereum required centralized exchanges (CEXs) like Kraken or Coinbase that custody both assets. Atomic swaps eliminate this custodial risk entirely—funds transfer directly on-chain between parties using cryptographic proofs, making counterparty default impossible. This is the ultimate "trustless" settlement mechanism.

Hash Time-Locked Contracts (HTLC)

The foundation of atomic swaps is the HTLC, a smart contract that combines two security mechanisms: a cryptographic hash requirement and a time lock. Funds are locked in the contract and can only be claimed by providing a secret that matches the contract's hash. If the secret is not provided before the timeout, funds automatically return to the original owner.

HTLC Structure

An HTLC requires three inputs: (1) A secret (preimage), which both parties agree on beforehand. Example: a 32-byte random number. (2) A hash of that secret, which is embedded in the contract. (3) A timeout timestamp—the deadline for the secret to be revealed. The contract logic: "If secret matches hash, release funds. If timeout expires without secret, return funds to sender."

How Hash Requirement Works

To claim funds from an HTLC, the recipient submits the preimage (secret) on-chain. The contract hashes it and compares with the stored hash. If they match, funds transfer. If they don't match, the transaction reverts. Only the party who knows the secret can claim—this creates the atomic property. When party A reveals the secret to claim from party B's HTLC, party B can use that same secret to claim from party A's HTLC. The secret's revelation on-chain makes both transactions succeed or fail together.

How Atomic Swaps Work: Step-by-Step

Consider Alice swapping 1 BTC for 20 ETH from Bob:

Step 1: Alice and Bob agree on the swap terms and a secret preimage. Alice generates a random 32-byte secret, computes its hash (using SHA-256), and shares the hash with Bob.

Step 2: Alice creates an HTLC on Bitcoin, locking 1 BTC with the hash of the secret. The contract specifies: "Whoever provides the secret gets this 1 BTC. If 48 hours pass, the BTC returns to Alice."

Step 3: Bob verifies the HTLC on Bitcoin (confirms Alice locked the BTC), then creates an HTLC on Ethereum, locking 20 ETH with the same hash. The timeout is set shorter (e.g., 24 hours) to protect Bob.

Step 4: Alice sees Bob's ETH locked in the HTLC and reveals the secret to claim the 20 ETH on Ethereum. When Alice submits the secret on-chain, it becomes public.

Step 5: Bob sees the secret on the Ethereum blockchain, uses it to claim the 1 BTC from Alice's Bitcoin HTLC. Both parties now have their assets. If Alice never revealed the secret, both HTLCs would timeout and funds return to original owners—no loss of funds, just transaction fees.

Thorchain Cross-Chain AMM

Thorchain is the most successful atomic swap implementation, a cross-chain AMM that enables swaps between Bitcoin, Ethereum, Solana, Binance Smart Chain, Cosmos, Polygon, Avalanche, Dogecoin, Litecoin, and other blockchains. Users can swap $1M in value between any pair with single-click simplicity, without wrapping, bridging, or DEX aggregators.

Thorchain Architecture

Thorchain consists of validator nodes that run Bifrost (software integrating multiple blockchains). Users send assets directly to Thorchain addresses, and validators coordinate the swap using HTLCs. Thorchain maintains liquidity pools for each asset pair—e.g., a BTC-USD pool holds both bitcoin and stablecoins. Swaps execute against these pools, with prices determined by constant product (like Uniswap).

Thorchain Performance Metrics

As of Q1 2026, Thorchain processed $5.2B in lifetime atomic swap volume. Daily volume averages $150M-300M depending on market conditions. Swap slippage is typically 0.3-0.8% on most pairs, better than centralized exchanges for illiquid altcoins. Average swap settlement time is 8-12 minutes (slower than bridges but fully trustless). Fee: flat 0.02% on all swaps, significantly lower than CEX trading fees (0.1-0.25%).

Liquidity Pools and Capacity

Thorchain pools are funded by liquidity providers (LPs) who deposit paired assets (e.g., 50 BTC and 1.5M USD). LPs earn swap fees (0.02%) and receive block rewards. The total value locked (TVL) in Thorchain pools is $800M+, enabling large-value atomic swaps without excessive slippage. Larger pools can absorb multi-million dollar swaps with minimal price impact.

Other Atomic Swap Protocols

Komodo AtomicDEX

Komodo's AtomicDEX is a peer-to-peer decentralized exchange enabling atomic swaps without validators. Users run a desktop client that matches orders on an order book and settles directly using HTLCs. Security: all trades are peer-to-peer, no central custodian. Limitation: lower liquidity than Thorchain, smaller daily volumes ($5-10M).

Lightning Network Atomic Swaps

Lightning Network uses HTLCs as core layer for payment channels. Users can do atomic swaps between Bitcoin and other chains (Ethereum, Litecoin) using Lightning directly. Settlement is fast (seconds) and cheap. Limitation: Bitcoin's Lightning Network has smaller liquidity than Thorchain, and not all blockchains support Lightning.

Submarine Swaps

Submarine swaps (pioneered by Statechain) enable trustless swaps between on-chain and Layer 2/off-chain assets. Example: lock 10 ETH on Ethereum Layer 1, receive 10 ETH on Arbitrum Layer 2 via submarine swap. Uses HTLCs to ensure atomicity. This enables capital-efficient movement between layers without centralized bridges.

Comparison Table

ProtocolChains SupportedMethodSettlement TimeFees
Thorchain10+ (BTC, ETH, SOL, etc)HTLC with validators8-12 min0.02%
Komodo AtomicDEX50+ (P2P enabled)HTLC peer-to-peer10-20 min0%
Lightning Atomic SwapsBTC, Litecoin, othersHTLC channelsSeconds0.01%
Submarine SwapsL1 to L2 (Ethereum, SOL)HTLC + custodian5-10 min0.1%

FAQ

What is a Hash Time-Locked Contract (HTLC)?

An HTLC is a smart contract that locks funds and requires a secret preimage (hash proof) to unlock. If the secret is revealed, either party can claim the funds. If the timeout expires, the funds return to the original owner. This enables trustless swaps: party A locks BTC with hash H, party B locks ETH with same hash H. When B reveals the secret to claim BTC, A can use the same secret to claim ETH.

How do atomic swaps differ from bridge protocols?

Atomic swaps are peer-to-peer (P2P) trustless trades between two parties without intermediaries. Bridge protocols have validators/guardians that custody assets across chains. Atomic swaps need both chains to support smart contracts; bridges work with any blockchain. Atomic swaps are slower (require multiple sequential confirmations) but fully trustless.

What is Thorchain and how does it handle atomic swaps?

Thorchain is a cross-chain AMM that enables atomic swaps between Bitcoin, Ethereum, Solana, and 15+ other chains. It maintains liquidity pools for each blockchain and uses HTLCs for trustless settlement. Users can swap $1M BTC to ETH in ~10 minutes with <0.5% slippage. Thorchain processed $5B+ in cross-chain volume and charges only 0.02% fees.

What are the limitations of atomic swaps?

Both parties must have compatible blockchain support. BTC/ETH atomic swaps require both blockchains to support timelocks. Slower settlement (10-30 minutes vs 1-2 minutes on bridges). Less capital efficient than bridges (users provide liquidity, cannot scale as easily). Security depends on honest hash function usage and proper timeout configuration. Not suitable for high-frequency trading.

What is a submarine swap and how does it work?

Submarine swaps (used by Statechain, Light Chain) swap on-chain assets for off-chain or Layer 2 assets using HTLCs. Example: lock ETH on Layer 1 with preimage hash, receive equivalent on Lightning Network by providing the preimage. Enables L1-to-L2 movement without bridges, with custody remaining with original party (true non-custodial).

How secure are atomic swaps compared to centralized exchanges?

Atomic swaps are more secure—no counterparty risk (no exchange holding your funds), no exchange hack risk. Worst case: timeout expires and you recover your original funds. CEXs expose you to custody risk. Atomic swap risk: bugs in smart contracts, improper timeout configuration. Always use established protocols (Thorchain) over experimental atomic swap implementations.

Disclaimer: This content is for informational purposes only and should not be construed as financial or investment advice. Cryptocurrency investments carry significant risk including total loss of capital. Always conduct your own due diligence and consult with qualified financial advisors before making investment decisions.

Educational disclaimer: This guide is for informational purposes only and does not constitute financial advice. Crypto involves significant risk — do your own research before making any decisions. Learn more about our team.

Educational disclaimer: This guide is for informational purposes only and does not constitute financial advice. Crypto involves significant risk — do your own research before making any decisions. Learn more about our team.