Back to Glossary

Entry · Investing

Atomic Swap

A technique for exchanging one cryptocurrency for another directly between users, using smart contracts. The contracts ensure either both sides of the trade complete or neither does. No exchange or other intermediary holds the funds.

From the Money Master HQ dictionary, founded by Shihan Sheriff (FCMA, VP of Finance at Nomod, CFO at Esanjo Ventures). How these definitions are written.

What it means

Trading one cryptocurrency for another usually means trusting an intermediary: deposit coins at an exchange, trade, and withdraw. An atomic swap removes the intermediary.

Two parties exchange coins on their own chains through linked smart contracts, with cryptography guaranteeing that the trade either completes on both sides or refunds everyone. The word atomic comes from database theory, where an atomic transaction is indivisible: it happens completely or not at all.

Applied to crypto, the mechanism is typically a hashed timelock contract. One party locks coins with a secret's hash and the counterparty locks coins against the same hash; revealing the secret to claim one side automatically reveals it to claim the other, and if either side walks away, timelocks refund the locked coins after a deadline.

The idea has an academic pedigree. Maurice Herlihy's paper on atomic cross-chain swaps, available on arXiv, formalised the protocol and proved its correctness conditions.

That work anchors the technique in distributed computing theory rather than marketing, which is rare enough in the space to be worth noting. Atomic swaps matter for what they remove.

Centralised exchanges concentrate custody risk, fees, and regulatory exposure; a successful swap protocol lets holders trade across chains without surrendering custody at any point. Decentralised exchange designs and cross-chain bridges borrow heavily from the same primitives, and hashed timelock contracts also became a building block for payment channel networks.

The limitations are practical. Both chains must support compatible contract features, liquidity must be found peer to peer, and the timing windows create their own strategic games, including the optionality problem where one party can wait and back out if prices move.

These frictions are why atomic swaps remain more foundational concept than everyday tool, and wallet software usually hides the machinery behind an offer, a waiting period, and either a completed trade or a refund. For managers, the term is a lens on counterparty risk.

Atomic settlement is the crypto version of delivery-versus-payment in securities: principal risk disappears when both legs settle or neither does. Regulators watch the technique because it moves value between chains without a reporting intermediary, so any corporate use should run through compliance first, and any product claiming trustless exchange should be judged by whether it actually achieves that atomicity.

In practice

Real-world examples.

1

Example

Two traders exchange bitcoin for litecoin through hashed timelock contracts without using an exchange. Each locks coins on their own chain, and the first claim reveals the secret that lets the other side be claimed. Neither trader ever deposits funds with a third party.

2

Example

A swap expires unclaimed after a price swing, and both timelocked deposits refund to their owners. One trader had waited, hoping the price would move in their favour, and decided not to claim in time. The refund path leaves both parties with their original coins, minus only the network fees.

3

Example

A decentralised exchange protocol builds its cross-chain feature on atomic swap primitives. Users see a single swap screen, while the software creates the contracts, watches the confirmations and handles refunds in the background. The protocol's documentation explains the timelock periods so that users know how long funds may be locked.

Formula

Calculation

Agreed exchange rate = units of coin B given / units of coin A given. The guarantee itself is logical: completion means both transfers execute, or both refund after timelock expiry. The timelock for the party who locks first must be longer than the timelock for the second party, so the first party cannot be left exposed. Example: Party A offers 2 coins of type A valued at $1,500 each, a total of $3,000. Party B offers 300 coins of type B valued at $10 each, also $3,000. The agreed rate is 300 / 2 = 150 B per A. If A locks first with a 48-hour timelock and B locks second with a 24-hour timelock, B has a full 24 hours of margin to claim before A's refund becomes possible.

Case study

Seen in the real world.

This is a fictional example. Noor Haddad, an invented crypto holder, agrees to swap tokens worth $5,000 with an overseas counterparty she has never met. Both lock their coins into timelocked contracts. When Noor claims her side by revealing the secret, the counterparty uses the same revealed secret to claim his.

Neither ever held the other's coins, and no exchange took a fee. A month later a second swap fails because the counterparty goes offline. Noor waits out the timelock, her coins return automatically, and she loses nothing except a small network fee, which is the outcome the protocol is designed to guarantee.

Watch out

Common mistakes.

  • Believing atomic swaps need a trusted third party, when the whole point is that the protocol enforces the exchange by itself. The contracts themselves enforce the exchange.
  • Ignoring the timelock's free option, which lets one side abandon the trade if market prices move against them mid-swap. Longer timelocks price that option.
  • Assuming any two chains can swap, when both must support compatible hash and timelock contract features. Compatibility is a technical precondition.

Questions

People also ask.

Do atomic swaps use an exchange?

No. The swap executes through linked smart contracts on the two chains, so no centralised intermediary holds the funds. Custody stays with each party throughout.

What happens if one side backs out?

The timelocks expire and each locked deposit refunds to its original owner, so nobody loses coins to an abandoned trade. The refund path is the safety guarantee.

Why aren't atomic swaps everywhere?

They need compatible chains, peer liquidity, and patience for confirmation windows, which keeps them niche compared with exchanges. Tooling and liquidity are the remaining gaps.

Was this explanation helpful?

From the founder's library

Accounting Fundamentals: A Non-Finance Manager's Guide to Finance and Accounting, by Shihan Sheriff

Take it further with the book.

Build your financial confidence beyond this definition. Shihan's full-length guide, Accounting Fundamentals, takes the same plain-English approach and turns it into a complete, practical playbook for non-finance managers, business owners and students - with chapter-end quiz answers and presentation slides included.

US$2.24US$2.99

25% off with code MMHQ25, applied at checkout. Priced in USD - checkout may show the equivalent in your local currency.

View the book and save 25%
Last updated · October 8, 2026
Browse all terms →

Disclaimer

The information provided in this finance dictionary is for educational and informational purposes only. It should not be construed as financial, investment, legal, or tax advice. Always consult with a qualified professional before making any financial decisions. Money Master HQ makes no representations or warranties about the accuracy, completeness, or suitability of this information. Use of this content is at your own risk.