Loading glossary...
Loading glossary...
The transfer of cryptocurrency from one party to another, without the use of an exchange or other intermediary.
Share this glossary term with your community.
The transfer of cryptocurrency from one party to another, without the use of an exchange or other intermediary.
Traditionally, in order to buy or sell a cryptocurrency, a user is required to use a centralized exchange. This arrangement has several drawbacks: both parties must find an exchange they trust, exchanges often suffer downtime during periods of high demand, and exchanges are subject to state oversight.
By contrast, an atomic swap enables direct wallet-to-wallet trading between two peers, using a specially designed smart contract for decentralized exchanges.
Atomic swaps offer a more decentralized alternative to trading on Automated Market Maker (AMM) DEXs like Uniswap, which rely upon centralized liquidity pools. AtomicDEX, one of the most popular atomic swap-powered DEXs, provides a true peer-to-peer order book system for crypto trading.
Atomic swaps are based on hash timelock contracts (HTLC). Every HTLC includes a hashlock, which can be used to lock and unlock the deposited currency with a key available only to the depositor, and a timelock, which automatically returns funds to the depositor if the transaction is not completed within a set timeframe.
Atomic swaps are designed in such a manner that when a swap takes place, either both parties receive the funds they desire or nothing happens at all and both parties retain the funds they started with (minus a very small transaction fee for the “order-taker”). Atomic swaps make digital asset trading as secure as it can possibly be..
In an example scenario, Party A creates an HTLC address and deposits their cryptocurrency. This creates a passcode, along with a hash of that code. Party A sends the hash to Party B, who uses it to generate an address. Party B deposits their cryptocurrency with that address. Because Party A has the passcode used to generate the hash, they can access the coins deposited by Party B.
At this point, the contract sends the passcode to Party B, who uses it to access the coins deposited by Party A. If the contracts are not signed within the specified timeframe, both deposits are automatically returned to the relevant depositor.
Atomic swaps can be used to trade on-chain across different blockchains with different native coins. Atomic swap technology is protocol agnostic, meaning it’s possible to swap assets like Bitcoin for Ethereum without having to trust the security of a wrapped token or centralized exchange. Off-chain atomic swaps offer significantly improved transaction speeds, but they have not yet been fully developed.