Atomic Swap

A trustless exchange of one cryptocurrency for another without using a centralized intermediary.

An atomic swap is a smart contract technology that enables the exchange of one cryptocurrency for another directly between two parties, without the need for a centralized exchange or trusted third party.

How Atomic Swaps Work

Atomic swaps use Hash Time-Locked Contracts (HTLCs) to ensure that either both parties complete the trade or neither does. The "atomic" part means the swap is indivisible — it either happens completely or not at all.

The Process

1. Party A creates a secret and generates a cryptographic hash of it, then locks their tokens in an HTLC.

2. Party B sees the hash and creates their own HTLC locked with the same hash, depositing their tokens.

3. Party A claims Party B's tokens by revealing the secret.

4. Party B uses the revealed secret to claim Party A's tokens.

Types

On-Chain Atomic Swaps: Occur directly on the respective blockchains. Slower but fully decentralized.

Off-Chain Atomic Swaps: Use Layer 2 channels (like Lightning Network) for faster, cheaper exchanges.

Significance

Atomic swaps represent a key step toward true decentralization in crypto trading, eliminating the need to trust centralized exchanges with custody of your funds.

Frequently Asked Questions

What is an atomic swap?

An atomic swap is a trustless way to exchange one cryptocurrency for another between different blockchains without using a centralized exchange. It uses Hash Time-Locked Contracts to ensure either both parties complete the trade or neither does.

How do atomic swaps work?

Both parties create time-locked smart contracts secured by the same cryptographic hash. Party A locks their tokens, Party B locks theirs with the same hash. When A claims B's tokens by revealing the secret, B uses that secret to claim A's tokens.

What are the limitations of atomic swaps?

Atomic swaps require both blockchains to support compatible scripting and hash functions. They can be slow for on-chain swaps and currently lack the liquidity and ease of use of centralized exchanges.

Related Terms