What are Atomic Swaps?

Jeffrey Hancock
6 min readAug 28, 2020
Cryptocurrency users will have access to a truly decentralized means of trading crypto through atomic swaps, whilst being able to retain control over their digital assets at all times. Here is everything you need to know about this trend.

The list of cryptocurrencies, despite their volatility, is constantly growing. Today, according to CoinMarketCap, there are more than 4000 coins, which in different percentages are present in the investment portfolios of crypto holders. Because of the abundant market supply, users need to exchange one coin for another. Digital assets are converted with the help of third parties — exchanges. But the blockchain industry by its principle denies intermediaries. Thus, in 2019, the Qtum blockchain project introduced atomic swaps for direct exchange of cryptocurrencies. Let’s review the structure of this technology and its potential for further development.

What is it?

Atomic swaps can completely change the system of money transactions in the crypto world. Simply put, the technology of sending and conversion of coins will allow people to directly trade and exchange them without third parties.

The ideas to implement the exchange of cryptocurrency on “their own” appeared with first altcoins. In July 2012, the developer Sergio Demian Lerner presented the first project (its theoretical component) of the protocol of exchange without trust. The idea was quite attractive, but then it was not implemented. The breakthrough in atomic swap research occurred in May 2013, when Tyr Nolan presented the first complete report on atomic swap procedure.

Example: Suppose Alice has bitcoins, and she wants to sell them for litecoins. Luckily, Bob has LTCs, which he doesn’t mind exchanging for BTC. To do this, users need to transfer their coins to the cryptocurrency exchange and with the help of a third party — in this case the intermediary is a trading platform — to sell their existing assets and acquire others.

However, centralized exchanges have many problems: the threat of hacking, assets may be subject to improper management (for example, the situation around Mt.Gox hack), volume requirements. Exchanges can not cope with the change in demand, especially when there is a sharp increase in demand for assets. In addition, legal crypto trading platforms are subject to state regulation, because they are registered in a country, so user data is transferred to third parties.

For these reasons, the crypto industry, which considers itself to be truly advanced, cannot rely on third parties that are more social rather than technologically related. In addition, the blockchain paradigm implies an open industry with no less open innovation, including in the field of digital assets.

The ability of individual blockchains to interact with each other, for example, between Bitcoin and Ethereum, is extremely limited. After all, networks use different protocols, algorithms and security procedures to conduct transactions. And most crypto exchanges require the user to convert to the base currency before transferring one coin to another, and this is often Bitcoin, as it is the most liquid and easily available. Due to the high crypto volatility, it is possible to eventually pay a large sum for the exchange transactions, as the exchanges take fees to perform all transactions.

Of course, to avoid the risks and problems that are present at a centralized exchange, a user can exchange coins at a decentralized one. However, atomic swaps differ from DEX — they create an encrypted escrow account using a cryptographic protocol, which guarantees immediate reimbursement to users if a transaction is not completed or interrupted by one or the other party for any reason. This reduces the risk to zero by default. In addition, if the user trades on a centralized exchange, it makes no sense to use a decentralized platform, since there will be a fee for transferring assets from one platform to another.

How does it work?

On September 20, 2017, Decred and Litecoin blockchains with DCR and LTC cryptocurrencies made the first successful coin conversion thanks to atomic swap implementation. At that time two projects used hash time-locked contracts (HTLC). In order for Decred to qualify for the LTC and Litecoin for the DCR, teams took turns revealing a secret number in the blockchain, which was previously only known to coin holders. In addition, in order to perform the exchange, blockchains are required to be downloaded.

HTLCs are a special form of out-of-concept payment channels. Due to this, the main network is not clogged or overloaded, and the time of transaction processing is reduced. Therefore, HTLC is referred to a special type of smart contract that allows you to perform transactions with time between the two parties, which was done in the interaction between Decred and Litecoin.

Atomic swaps require interconnected payment channels between blockchains of traded cryptocurrencies. Communication is carried out through the Lightning Network. Initially it was needed to solve the issues of scaling in Bitcoin, but now its capabilities have been used for other purposes as well. The Lightning Network connects payment channels, which use the same hashing algorithm. Therefore, Bitcoin can only be linked with altcoins on the SHA-256 algorithm.

Projects that work with atomic swaps

The founder of Litecoin, Charlie Lee, who can be rightly considered one of the main adherents of atomic swaps, in September 2017, successfully exchanged LTC for BTC, as he reported on his Twitter. Most users thanked Lee for the great work done, the essence of which was to improve the process of converting some digital coins to others.

A few days later, inspired by the activities of Litecoin’s founder, the Komodo project developers managed to complete an atomic swap between the BTC and internal coin of the KMD project, using only the Electrum server. This important event made crypto enthusiasts even more excited, because this was the proof that atomic swaps can be used without downloading both blockchains for exchange in a cryptocurrency pair.

Then, in October 2017, the development team of Bitcoin-Ethereum Atomic Swap Code presented an open access technology for exchanging Bitcoin and Ethereum. This code on GitHub has already been used to run Altcoin Exchange, which meant “atomic swap” between coins at market value.

Transfer of BTC and ETH through atomic swaps can be made using the open protocol OFGP, which has jointly developed a decentralized exchange DEx.top and crypto wallet iBitcome. In addition, the exchange protocol allows you to monitor the flow of digital assets of a particular user and transactions in the network at any time.

On January 9, 2019 Qtum Blockchain platform introduced its HTLC-based atomic swaps. In fact, their proposal does not differ from the above projects and is implemented with the help of QTUM internal token.

Conclusion

Like all new emerging technologies, atomic swaps have disadvantages. It is often necessary to install both blockchains of digital assets pairs to perform the exchange of cryptocurrencies. In addition, the networks involved must be able to initiate HTLC, atomic swaps do not work with digital assets that do not support smart contracts. After the transfer is complete, not all crypto wallets are able to accept coins. Exchange processes can be slower if large amounts are converted, so the problem of scalability is still to be solved.

In general, these disadvantages do not present difficulties in terms of technology and implementation of the exchange network. Most likely, as the researchers assume, the flaws will be corrected in the near future, because, for example, the Komodo project has proved that it is no longer necessary to install two blockchains for instant cryptocurrency conversion. This means that ordinary users will be able to exchange and transfer digital assets without intermediaries. The blockchain industry will get rid of third parties in the coin conversion process and will be even more in line with its ideas.

If you want to earn Ethereum easily, visit our fair crypto lotto Ethex.bet! It rewards everyone who is lucky enough to guess symbols of the next Ethereum block mined.

--

--

Jeffrey Hancock

Blockchain enthusiast developer and writer. I love video games, blockchain and the hot symbiosis of these two worlds.