Atomic swap is a technology that facilitates the exchange of two different cryptocurrencies through the use of a smart contract, which allows users to make exchanges from their personal wallets in a peer-to-peer transaction.
The first who described an Atomic Swap protocol was probably Tierra Nolan in 2013. But already in 2012 Daniel Larimer had presented his P2PTradeX, an untrusted exchange protocol that many have considered as the prototype of the Atomic Swap.
Since then, many developers have experimented with these protocols that have played an important role in communities such as Bitcoin, Litecoin, Decred and Komodo.
As it is known, the first Atomic Swap were seen in 2014, but it was in 2017 when it became publicly known with the first successful exchanges between cryptocurrencies. We have exchanges BTC / LTC and LTC / DCR.
How the Atomic Swap protocol works
As we have already said, it is a protocol designed to facilitate the exchange of different cryptocurrencies. So, if someone needs to exchange Bitcoin for Litecoin, just find someone who needs your Bitcoin and is willing to deliver Litecoin in return.
This exchange is possible thanks to a smart contract (smart contrat), designed for a peer-to-peer transaction.
Atomic Swap in practice
Let’s think that Andrés needs to exchange his LTC for BTC, and Rubén has BTC. Alicia is willing to receive the LTC from Andrés, so Andrés deposits her LTC at a Smart Contrat address, which will pretend as a safe.
When Andrés generates his safe, he must create an access code; This key must be shared by Rubén through a cryptographic hash. But Ruben can’t access cryptocurrencies yet because he barely has the hash, but not the key.
Rubén then uses the hash he received from Andrés to generate another Smart Contrat to deposit his BTC.
Now for Andrés to withdraw the BTC he needs to use the same code Rubén used and in doing so he reveals the code to Rubén. Thus, as soon as Andrés claims the BTC, Rubén can withdraw the LTCs by completing the exchange. This key distribution is known as Hashlock.
How Atomic Swap Occurs
These transactions are named atomic, because they will only be completed if the parties do what corresponds to each one. If, on the contrary, one of the parties gives up and does not comply, the contract is dissolved and the funds are automatically restored, providing great security for the parties.
These contracts can be made in two ways, within the blockhain and outside it.
- On chain: these Atomic Swap occur within the networks of any cryptocurrency, that is, within the blockchain, be it Bitcoin, Litecoin or other.
- Off chain: for these Atomic Swap to be performed they must take place in a second layer and usually is done through two-way exchanges, very similar to those made through Lightning network connections.
Generally these exchanges are made through smart contracts with multifirms and limited time hash contracts (HTLC)
Wallet for Atomic Swap review
Atomic Wallet is one of the most popular decentralized wallets, designed specifically for the use of this blockchain protocol. Available for Windows, Mac, OS and Linux.
The protocol is available for use with more than 300 cryptocurrencies, for fast and secure transfers thanks to the company’s own design, Atomic Distributed Orderbook.
Cryptocurrencies available for Atomic swaps include: Bitcoin, Ethereum, Litecoin, Ripple, Dash, Zcash, Monero, and an extensive list of ERC20 tokens.
For the security of the storage of funds, the Atomic portfolio provides the client with all his private keys, so he is the only one capable of controlling them.
Creative editor and trader of cryptocurrencies, fiat currencies and commodities.