What Are Atomic Cross-Chain Swaps?

March 16, 2018, by Doru D
An atomic cross-chain swap is a new tool that allows the direct and trustless exchange of cryptocurrencies across different Blockchains, without the need of an intermediary service.

Since the genesis of Bitcoin and the boom of cryptocurrencies, holders have always faced the issue of having to trust centralized exchanges. Using exchanges is a contrast to the fundamental purpose of cryptocurrencies, decentralization, and anonymity. Exchanges charge high fees; transactions can be delayed, in addition to the fact that they are prone to hackers’ attacks, like Mt. Gox, which suspended its operations in 2014 after $450 million worth of cryptos were stolen. Recent enhancements in the Blockchain, have successfully managed to eliminate the need for an exchange, by decentralizing cryptocurrencies trading.

How does an atomic cross-chain swap work?

Until now, if a user would wish to trade his Bitcoin for another coin, he would have to use a centralized service, to sell his Bitcoins and then perform a new transaction to purchase the cryptocurrency of his preference.

With the atomic cross-chain swaps, by utilizing hash time-locked contracts (HTLCs), user A (who owns Bitcoin) can open a payment channel by transmitting a transaction in the Bitcoin Blockchain to send Bitcoin to user B (who owns Litecoin). At the same time, user B opens a transaction in the Litecoin Blockchain to send his Litecoin to user A. Both transactions will remain sealed on each Blockchain with a deadline, until each party provides a proof of payment.
Each transaction is secured by a cryptographic hash, a unique code that both parties will share, which will act as, the aforesaid, proof of payment. Once the contract address is confirmed, the funds will be unlocked, delivered to each party and the smart contract will be completed. If the originator of the swap fails to fulfill the contract at the given deadline successfully, the HTLC will be canceled, and the funds will be returned to each party, respectively.

The atomic cross-chain swap milestones

Litecoin as the initial cryptocurrency to adopt the SegWit protocol in May 2017, was the testbed for the first swaps in the Blockchain. Later, the first ever on-chain swap was executed with success, on September 2017, between Litecoin and Decred. The interoperability of the atomic swap is still at its early stages and has certain limitations. For example, in the swap mentioned above between Litecoin and Decred, both cryptocurrencies share the same scripting language SHA-256. However, on October 7th, 2017, Altcoin.io announced that they successfully conducted the first on-chain atomic swap between Bitcoin and Ethereum, transferring 0.12345 ETH for 0.12345 BTC.

While on-chain swaps were an essential milestone in decentralizing the exchange of cryptocurrencies, they only prepared the path for off-chain swaps. Currently, in test mode, the advent of the anticipated Lightning network will escalate the capabilities of Blockchain transactions. Cross-chain swaps will happen off-chain. Therefore they will become much faster, with near-to-zero fees and payment channels will be able to remain open for multiple transactions. On November 2017, Lightning Labs, the developing team of the Lightning Network executed the first-ever off-chain atomic swap across Bitcoin and Litecoin. While the swap was performed on testnet cryptocurrencies, it indicates that the Lightning Network will introduce remarkable improvements in the industry.

Similar to Bitcoin, the Ethereum Blockchain has its own Lightning Network equivalent, the Raiden Network. As both networks are still under development, developers are working towards the direction of creating an off-chain atomic swap, between the two most popular cryptocurrencies. Their scripting languages have important differences; hence there are multiple complexities to overcome. Nevertheless, developing teams believe that they are not very far from accomplishing.

Disclaimer: information contained herein is provided without considering your personal circumstances, therefore should not be construed as financial advice, investment recommendation or an offer of, or solicitation for, any transactions in cryptocurrencies.