Lab: free tools · size first · stock scanner · crypto scanner · journal
Atomic Swaps Explained
An atomic swap is a trustless, peer-to-peer exchange of cryptocurrencies between different blockchains without using a centralized exchange. Using Hash Time-Locked Contracts (HTLCs), atomic swaps make sure either both parties receive their tokens or neither does. That makes it impossible for one party to take funds without completing their side of the trade. Atomic swaps are the building block of trustless cross-chain exchange.
An atomic swap lets two people trade coins on different blockchains without a middleman, using hash time-locked contracts so that either both sides of the trade complete or neither does. If one party walks away, the funds return after a timeout. The idea is clean, but in practice atomic swaps have stayed niche: both chains need compatible scripting, the user experience is clunky, and liquidity is thin compared with exchanges and bridges.
A swap step by step
Say Alice has bitcoin and Bob has litecoin. Alice picks a secret and shares only its hash. She locks her bitcoin in a contract that pays Bob if he shows the secret, or refunds her after, say, 48 hours. Bob locks his litecoin in a matching contract on his chain, using the same hash, payable to Alice if she shows the secret and refundable to him after a shorter wait such as 24 hours. Alice claims Bob's coins, which reveals the secret on chain. Bob reads it and claims the bitcoin. If either one stops partway, the timeouts send the coins home.
Why the timeouts differ
Bob's lock has to expire first. If Alice's expired first, she could take her refund and then still claim Bob's coins with the secret. The gap between the two deadlines also gives Bob time to act after the secret appears, so he needs to be watching.
Swaps in practice today
The same hash time locked contract idea holds Lightning together. A Lightning payment routed through several nodes is a chain of these locks, so either the whole payment goes through or nothing moves. OTC desks also use atomic settlement so both legs of a trade settle together.
Why swaps stay niche
Both chains need to support the same hash function and time locks, which rules out many pairs. The party who moves second takes on timing risk, and fees on two chains plus the wait make small swaps poor value. That's a big part of why bridges and exchanges handle most cross-chain trading today.