← GlossaryTrading & DeFi
What Is an Atomic Swap? Cross-Chain Trades Without a Middleman
An atomic swap is a peer-to-peer exchange of cryptocurrencies across different blockchains in which both transfers happen or neither does, typically enforced by hash time-locked contracts, without a trusted third party.
Key takeaways
- It lets two people swap coins on different chains without an exchange holding the funds.
- Hash time-locked contracts make each side's payment conditional on the same secret.
- If the swap is not completed in time, the funds are returned to their owners.
- It requires both chains to support the needed scripting, so not every pair of coins works.
The idea
Suppose Alice has Litecoin and Bob has Bitcoin and they want to swap. Normally they would trust an exchange or each other to send first. An atomic swap removes that trust: the exchange is atomic, meaning it either completes fully or does not happen at all.
How it works
The common method uses hash time-locked contracts, or HTLCs. Alice creates a secret and locks her coins in a contract on one chain so that they can be claimed by Bob only if he reveals the hash preimage, which is the secret, within a time limit. Bob locks his coins on the other chain with the same hash condition. When Alice claims Bob's coins she must reveal the secret on that chain, which lets Bob use it to claim hers. If either party fails to act before the timeouts, each can reclaim their own coins.
Strengths
No third party holds the funds, so there is no exchange to fail, freeze or be hacked. Both sides keep control of their keys until the moment of the swap, which fits the self-custody principle. The mechanism is enforced by code on the chains.
Limits
Both chains must support the scripting needed for hash and time locks. The parties must be online in the right order, and liquidity is a problem: you need a counterparty who wants the opposite trade. Fees and delays on two chains add up, and mistakes with timeouts can lose funds. In practice, many people use exchanges, bridges and decentralised exchanges instead, but atomic swaps remain a notable way to trade without custody.
Example
Alice locks 1 LTC in an HTLC claimable by Bob with a secret within 24 hours, and Bob locks 0.003 BTC claimable by Alice with the same secret within 12 hours. When Alice claims the BTC she reveals the secret, and Bob uses it to claim the LTC.
Put it into practice
Swap without handing over custody
Scrypt Wallet connects to in-app swap providers and a decentralised exchange link-out, so you can trade between supported assets without leaving your wallet.
Create a free wallet Get Scrypt for AndroidSources and verification
Last reviewed 2026-10-02 by the Scrypt Wallet team. The factual claims on this page, and where each comes from:
- An atomic swap is an exchange of cryptocurrencies between parties without a trusted third party, executed either entirely or not at all. [1]
- Atomic swaps are commonly implemented with hash time-locked contracts. [1]
Sources
- Atomic swap · Wikipedia · secondary source
Primary sources are protocol papers, specifications, source code or a project's own documentation; secondary sources are wikis and explainers. We checked each claim against the source text on the review date. Found an error? Tell us and we will correct it.
Frequently asked questions
Is an atomic swap the same as a bridge?
No. A bridge moves value to another chain as a wrapped token. An atomic swap exchanges native coins between two parties.
Is it safe?
If implemented correctly it removes custodial risk, but mistakes in timing or software can still cause loss.
Why aren't they more common?
They need liquidity, compatible scripting on both chains and careful coordination.
Written by the Scrypt Wallet team · Updated 2026-10-02. General education, not financial, tax or legal advice.