Atomic swap describes a cross-blockchain P2P transaction between two independent parties in which they exchange two different crypto assets (usually cryptocurrencies) directly with each other without involving intermediaries.
Atomic swaps are intended to make blockchains interoperable by allowing holders of crypto assets to conduct transactions across different blockchains. For this reason, they are also referred to as cross-chain peer-to-peer trades. The biggest advantages of atomic swaps are that they do not require the exchange of the private key at any point (increased security) and that they do not involve central intermediaries such as crypto exchanges (leading to cost efficiency, as there are no fees associated with depositing, withdrawing or trading).
The concept was first introduced in 2013 by Tier Nolan, with the goal of enabling independent parties to exchange crypto assets directly through their wallets.However, the P2PTradeX protocol, introduced by Daniel Larimer in 2012, is widely considered the foundation of the concept. Today, atomic swaps are seen as a potential answer to the increasing fragmentation of the global blockchain ecosystem.
How does an Atomic Swap work?
The technology behind Atomic Swaps is based on hash functions and so-called Hash Time lock Contracts (HTLC), a type of smart contract that ensures that a swap either happens in its entirety or not at all (partial transactions are thus excluded). Confirmation is done via cryptographic hash functions.
In addition, atomic swaps are bound to deadlines (predefined time period) within which they can be executed. Otherwise they are automatically cancelled. This means that an atomic swap is only considered to be completed when both parties have confirmed its validity within the predefined time frame and both assets have been transferred in full.