Loading...
FinchTrade

Definition

Atomic swap

Learn how linked claims, secrets and deadlines enable peer-to-peer crypto swaps, and why compatibility, fees and timely action still matter.

An atomic swap is a peer-to-peer protocol for exchanging cryptocurrencies, commonly across different blockchains, with an all-or-nothing settlement property. The exchange is designed so that both participants receive the agreed assets or can recover their unspent deposits if it is not completed. “Atomic” describes this linked outcome, not instantaneous or simultaneous execution.

How an Atomic Swap Works

An atomic swap commonly uses hash time-locked contracts (HTLCs), which combine a hash-based claim condition with a deadline and a refund path. These may be separate contracts or locking scripts on each blockchain; the protocol is not necessarily a single smart contract. One participant generates a secret and shares its hash, but keeps the secret private. Both participants then lock the agreed assets under linked conditions using that hash, with each deposit designated for the other participant.

Once the deposits are confirmed and their terms checked, the secret’s creator claims the other participant’s deposit by revealing the secret and providing the required authorization. The revealed secret then enables the other participant to claim the corresponding deposit, also with the required authorization. The public hash alone cannot unlock funds: it allows the secret to be verified when presented. The swap secret is not a wallet private key, and participants do not need to share their private keys.

Deadlines and Refunds

The deadlines in an atomic swap are coordinated and staggered, rather than identical. The deposit claimed second must remain available long enough for its recipient to observe the revealed secret and submit a claim with sufficient time for confirmation. Poorly chosen deadlines or delayed action can undermine the intended protection.

If the exchange is abandoned, refund conditions let participants reclaim their own unspent deposits after the relevant deadlines. This generally requires submitting refund transactions; expiry does not automatically send the assets back. A refund does not reverse earlier blockchain transactions or reimburse network fees, and funds may remain locked while the participant waits.

Looking for liquidity, exploring on-ramp/off-ramp services, or seeking expert guidance?

Assets and Blockchain Compatibility

The assets exchanged in an atomic swap remain on their respective chains; ownership changes, rather than the same asset moving between networks. A direct swap of native assets can avoid wrapped representations, but this does not make arbitrary pairs compatible. Both chains and the chosen implementation must support compatible locking and redemption mechanisms, including the relevant hash and timing conditions.

The basic mechanism handles on-chain assets, not ordinary fiat balances held in bank accounts. Those balances cannot simply be placed under the same blockchain claim conditions. Tokenized fiat is a separate case: a token may be exchanged if supported, but the swap itself does not redeem it for a bank-account balance.

Custody and Practical Limitations

An atomic swap can remove the need to deposit assets with a centralized custodian, reducing dependence on that custodian’s security and solvency. However, assets are temporarily constrained by the swap contracts, so participants cannot freely spend locked funds. Safety still depends on correct software, suitable deadlines and timely action; atomic settlement addresses the risk of paying without receiving the agreed asset, not every counterparty, network or operational failure.

Participants also need a willing counterparty with compatible assets and acceptable trade terms. Setup, confirmation checks and deadline management can be technically demanding. Network fees, confirmation delays and temporary fund lockup remain, including when a trade fails and refunds are needed. The mechanism therefore does not guarantee a cheaper or faster exchange than trading through a centralized venue.

Power your growth with seamless crypto liquidity

A single gateway to liquidity with competitive prices, fast settlements, and lightning-fast issue resolution

Get started