What does atomic mean in a swap?
In computing, an atomic operation cannot stop halfway: every part happens or none does. An atomic swap applies that rule to a trade between two blockchains. Your coins on one chain and your counterparty's coins on another are locked so that claiming one side reveals the key that opens the other. The classic failure it prevents is painfully simple: you send first, and the other side never sends back. In an atomic swap nobody can walk away with only your half, and no exchange operator, bridge or escrow agent ever takes custody along the way.
How does a hashed timelock contract work?
A hashed timelock contract (HTLC) is a smart contract that locks funds behind two conditions at once:
- A hashlock releases the funds only to whoever presents the secret value behind a cryptographic hash. The hash can be published freely; it reveals nothing about the secret itself.
- A timelock sends the funds back to their original owner if the secret has not appeared before a set deadline.
Together they make honest completion the only way to claim anything. To take the other side's assets you must reveal the secret, and revealing the secret is exactly what lets your counterparty claim yours. Walk away instead, and both deadlines pass and both deposits go home.
What are the steps of an atomic swap?
- 1
Agree and hash
Two parties agree on the amounts. One of them generates a secret value and shares only its hash.
- 2
Lock the first escrow
The initiator locks assets on chain A in a contract that pays the counterparty if the secret appears before the first deadline.
- 3
Lock the counter-escrow
The counterparty verifies that escrow, then locks assets on chain B behind the same hash with a shorter deadline, so the initiator has to reveal the secret first.
- 4
Claim and reveal
The initiator claims the assets on chain B, which publishes the secret on-chain. The counterparty reads it there and claims the assets on chain A.
Where did atomic swaps come from?
Developer Tier Nolan described the first complete atomic swap procedure in May 2013, in a Bitcoin Forum thread titled Alt chains and atomic transfers. Turning the idea into practice took about four years: the first widely documented on-chain atomic swap ran between Decred and Litecoin on September 20, 2017, using prototype tools the Decred team published. Litecoin founder Charlie Lee shared one of the first runs, a swap of 1.337 LTC for 2.4066 DCR, and a Litecoin-to-Bitcoin swap followed within days. The volumes were tiny; the proof was not. Two unrelated blockchains had settled a trade with no exchange, no bridge and no trusted third party in the middle.
Why did classic atomic swaps stay niche?
The security model held up; the experience did not. The 1inch white paper on atomic cross-chain swaps puts it plainly: decentralized alternatives such as atomic swaps suffer from poor user experience. Volumes stayed thin after the 2017 proof for reasons that have little to do with cryptography. Running a swap by hand asks a lot:
- You find your own counterparty, someone who wants the exact opposite trade, in the same amounts, at the same time.
- Both chains must support compatible hash functions and timelock scripts, which rules out many pairs.
- Both parties stay online through the whole flow and post their transactions in the right order.
- You wait out confirmations on two networks before either side is final, and timing mistakes can leave one side exposed.
How does 1inch build on atomic swaps?
Cross-chain swaps on 1inch keep the atomic core and remove the parts people struggled with. Escrow contracts still lock assets on both chains, one secret still unlocks both and timelocks still refund anything left behind. What changes is who does the work: you sign a single order stating what you pay and what you want to receive, and verified professionals called resolvers compete in a declining-price auction to fill it. The winning resolver funds both escrows, handles the secret exchange and pays the gas on both networks. The secret is shared only after both escrows are confirmed and each chain reaches finality, which protects the swap from chain reorganizations. Safety deposits reward whoever completes or refunds a swap, so orders are not left stranded when someone goes quiet. See the cross-chain swaps guide for the full flow. The design is specified in the 1inch white paper on atomic cross-chain swaps (PDF).
The order model also allows partial fills, where several resolvers complete slices of one large swap. The white paper documents a 5,436 WETH order filled through 11 partial fills within one minute; the user received 40,524 USDC more than swapping the whole amount at once at the market price of the moment.
Why do atomic swaps still matter?
Because the alternative is trust. Most value that crosses chains today still moves through bridges and custodial services, and each adds a party you have to believe in. Atomic escrows remove that party: the code on each chain enforces the deal, and everything a counterparty does is verifiable on-chain. Cross-chain swaps on 1inch keep that property while making the flow feel like any other swap.
How is that different from a classic atomic swap?
- Who takes the other side
- By hand: a counterparty you find yourself. On 1inch: resolvers competing in an auction
- What you sign
- By hand: several transactions in strict order. On 1inch: one order
- Gas along the way
- By hand: you pay on both chains. On 1inch: resolvers cover it, priced into the quote
- If the swap stalls
- Both refund through timelocks; on 1inch, safety deposits reward whoever finishes the cleanup
Common questions
They are related, not identical. Atomic swap names the all-or-nothing settlement mechanism; a cross-chain swap is the product built on top of it. On 1inch, cross-chain swaps settle through atomic escrows without asking you to manage secrets, deadlines or counterparties.
An incomplete swap refunds both sides once the timelocks expire, so the mechanism itself does not strand assets. The realistic risks sit around it: interacting with an unaudited contract, mispricing the trade or signing something you did not read. Audited implementations and clear interfaces matter.
No. Nothing crosses between the chains except the secret value, which is revealed on both. Each side is paid from an escrow that already lives on its own network, so there is no wrapped token and no bridge contract to trust.
They need a way to enforce a hashlock and a timelock. On Bitcoin-style chains that is transaction script; on EVM chains it is a contract. For cross-chain swaps, 1inch deploys its escrow contract on each supported network.
Want the basics first? Read what a crypto swap is, or browse every guide on the learn hub.
Swap across chains without managing secrets
Atomic escrows enforce the trade; you pick the pair and sign once.