$EX5 pre-sale — Seed tier · 500M fixed supply · 50% burn · sign up at portal.ex5.comJOIN →
Updated

Atomic Swap

In short: An atomic swap is a peer-to-peer token exchange without intermediaries, often between two different blockchains.

An atomic swap is a peer-to-peer token exchange without intermediaries, often between two different blockchains. It is called “atomic” because the trade either completes for both sides or does not happen at all, so neither party can end up with both assets.

Why it matters

Atomic swaps remove the need to deposit funds with a custodian or to trust a counterparty to send their half first. They rely on hash time-locked contracts (HTLCs), which combine a cryptographic secret with a deadline, so both blockchains must support these features. Finding a counterparty, waiting for confirmations on two chains and a technical user experience keep atomic swaps a niche tool, but the same technique underpins payment channels such as the Lightning Network.

Example

Alice holds coin A and Bob holds coin B on another chain. Alice creates a secret and locks her coins in a contract that pays Bob only if he reveals that secret, or refunds her after a deadline. Bob locks his coins in a similar contract that uses the same secret’s hash but a shorter deadline. When Alice claims Bob’s coins, she must publish the secret on-chain, and Bob then uses it to claim hers. If either party stops midway, the timelocks return the funds.