Atomic swap are automated, self-enforcing cryptocurrency exchange contracts that allow cryptocurrencies or digital assets to be traded peer-to-peer from two different blockchains without the need for a trusted third party. 
Atomic swap was first introduced by Tier Nolan on the BitcoinTalk forum in 2013. Nolan outlined the basic principles for cross-chain cryptocurrency swaps by using simple cryptocurrency trades across different types of blockchains. The atomic swap technology was brought to life in 2017 by Charlie Lee, who founded Litecoin when he tweeted about how he “did a cross-chain atomic swap with LTC/BTC” and exchanged 10 LTC (Litecoin units) for 0.1167 BTC (Bitcoin units). Since then, many decentralized exchange platforms, as well as independent traders, have been using the technology to trade cryptocurrencies. Special cryptocurrency wallets have also been developed that are capable of cross-chain atomic swaps, including Atomic Wallet, Exodus, Liquality, Switcheo, and more.
Atomic swap, short for "atomic cross-chain swap," is a cryptographic technique that allows two parties to exchange different cryptocurrencies or digital assets directly in a secure and trustless manner, without the need of an exchange platform. The term "atomic" refers to the indivisible and irreversible nature of the swap—either the entire swap happens, or none of it does ensuring that both parties involved in the transaction are protected from any potential risks or losses. In a way, this system preserves the autonomy of crypto users and enables trustless transactions in which users do not need to know one another and are void of counterparty risks. Due to the trustless, peer-to-peer nature of atomic swaps, it is widely considered one of the few truly decentralized trading techniques.
Atomic swap employs a hashed timelock contract (HTLC) to ensure that both parties hold up their ends of the bargain. These contracts make use of a multisignature transaction system that holds both traders accountable for a swap to be successful. In order to make this possible, a hashlock uses a cryptographic algorithm that only allows users to access funds once both parties have signed off on their respective transactions, and a timelock is like an insurance policy that ensures that both users will have their funds returned to them if the trade is not successful under a specific timeframe.
Atomic swap is considered a critical blockchain mechanism because it eliminates the need for cryptocurrency exchanges. Traders can execute cross-chain trades without relying on the infrastructures of centralized trading platforms. Since intermediaries are sidelined using atomic swaps, the transactions are fast, more affordable, and void of security incidents associated with custodial-based exchanges. These advantages collectively underscore the autonomy that atomic swaps offer, granting users heightened authority over their assets, as all trades occur directly from their personal wallets.
On-chain atomic swap
On-chain atomic swaps take place on either currency’s blockchain, both currencies must use the same hashing algorithm, and they also must support HTLC. In September 2017, Litecoin and Decred conducted the first successful on-chain atomic swap. On-chain atomic swap transactions are completely transparent, but limited, swaps can take 20 minutes or longer to be confirmed and incur costly network fees.
Off-chain atomic swap
Off-chain atomic swaps take place on a secondary layer of nodes off the underlying blockchain. Transactions can be private, instantaneous, and almost free. Bitcoin and Litecoin executed the first ever off-chain atomic swap using the Lightning Network back in November of 2017.
How was your experience?
Give this wiki a quick rating to let us know!