Everything you need to know about atomic swaps and why they are poised to revolutionise the way we exchange cryptocurrencies.
Trading one cryptocurrency for another can be difficult. Depending on the obscurity of the coin, it can often mean a process of using several different exchanges to trade several different cryptocurrencies before getting the one you want.
Multiple transactions also incur many fees which add up quickly, and considering the difficulty and time involved, it may not be worth the trouble. There is a real risk that by the time you buy the cryptocurrency you’re after, the market’s volatility has caused the price to increase significantly.
So what stops us from trading one cryptocurrency directly for another? To put it simply, the problem is that because each type of cryptocurrency exists on its own blockchain, coins cannot simply move between chains as they are incompatible. This is a fundamental hurdle of blockchain software that has not been solved yet, although there are several proposed solutions in the works.
Atomic swaps are one possible solution to this problem. If they become a success, soon anyone will be able to trade a range of cryptocurrencies directly with another user.
Read on to learn more about atomic swaps and their potential, and how they may change the way we think about cryptocurrency trading.
What are atomic swaps?
An atomic swap, or more precisely, an atomic cross-chain swap, is a flashy way of saying the trade of one cryptocurrency for another. The difference is that atomic swaps eliminate some of the risks associated with performing that same trade on an exchange.
For example, trading from bitcoin (BTC) to Ether (ETH) on traditional cryptocurrency exchanges involves two separate transactions. Essentially, the trader sells the BTC and the exchange buys it. At the same time, the exchange sells ETH and the trader buys it.
For performing this service, the exchange takes a fee. As a third party, the exchange is in control of the traders' funds at all times, may act dishonestly, be hacked or otherwise pose a potential risk.
But atomic swaps don’t need a third party. Atomic swaps are done on a peer-to-peer (P2P) basis. Just like I am writing to you and you are reading this (thank you) we are working on a P2P basis. Atomic swaps begin like this, between two people. The two people agree on the exchange rate of the two cryptocurrencies and confirm it to complete the trade.
The technical term for this type of trade is Hashed Timelock Contract (HTLC). There are three conditions that need to be met for the HTLC to succeed. If a cryptocurrency does not have them it cannot support atomic swaps.
- Both blockchains need to have the same type of hashing algorithm. The type of hashing algorithm can vary between blockchains, but some share the same, such as bitcoin and Litecoin.
- Both blockchains need to have time locked contracts. This is a common security feature to prevent double spending.
- Specialised programming functions. This is where atomic swaps become more complex.
There are two specialised programming functions for the bitcoin blockchain called layered solutions. Both layers address the problem of scaling, among others. The first layer solution is called SegWit. The second layer solution is called the Lightning Network.
Can every cryptocurrency do atomic swaps?
Not all cryptocurrencies will be able to do atomic swaps. But many that can’t do it right now will be able to do it in the future. Many cryptocurrencies have hashing algorithms and time locked contracts, but lack the specialised programming functions required to interact with other blockchains. Only a handful are experimenting with the technology required.
One cryptocurrency making headway in this area is Ether. There is a development on the Ethereum blockchain called Raiden which is similar to the Lightning Network for bitcoin. In the future, both blockchains may meet the required conditions for successful atomic swaps.
It’s likely that many more popular cryptocurrencies will be able to do atomic swaps in the future as they develop abilities like Lightning Network.
For example, Stellar Lumens plans to implement Lightning Network channels in 2018, Ethereum has Raiden and IOTA has a similar system called Flash.
The technology is at an immature stage, but there’s a lot of interest in the required functions and the results so far are encouraging.
Someday, atomic swaps might fade into the background and become a regular part of the cryptocurrency world. The majority of cryptocurrency users may not even know what happens, much like how an engine powers a car without the driver knowing what happens under the hood.
Atomic swaps to power decentralised exchanges
Decentralised exchanges bring together peers to trade, like an old-school poster board. People who want to exchange coins can post their offers or browse offers currently available. Decentralised exchanges can let strangers easily trade with each other without the need for a central authority.
In many cases, decentralised exchanges and this kind of peer-to-peer trading between two casual cryptocurrency owners would not be possible without atomic swaps.
Did you know?
Swapping tokens issued on an individual blockchain is already common.
Neblio is one of few leading blockchains leading the way. The Neblio blockchain recently released its Neblio Token Protocol 1 (NTP1). The NTP1 allows any Neblio blockchain user to trade any token issued using the Neblio blockchain directly. This is done with the use of side chains, which is a programming function that helps direct swaps of NTP1 tokens.
Ethereum's blockchain has the ERC20 token standard. Because there are certain qualities defined by the ERC20, it’s easier to compute and swap between ERC20 tokens and this also helps scaling issues. Just like with the NTP1, Ethereum uses side chains to swap ERC20 tokens only.
The trouble is that right now, you can’t swap an NTP1 token directly for an ERC20 token. Those tokens can only be swapped on their respective blockchain. Both blockchains meet the first two conditions listed above. However, there is no specialised programming for the different blockchains to communicate.
To swap between any two tokens issued on different blockchains, it is necessary to make the trade on a centralised exchange. That means accepting the exchange’s rates, fees, terms and conditions. Atomic swaps remove the need to use a centralised exchange. Decentralised exchanges will be able to take the atomic swap technology and pair any two traders for almost any pair of compatible cryptocurrencies.
Compare decentralised cryptocurrency exchanges
What effects could this have on the cryptocurrency market?
At the time of writing, the number of atomic swap transactions taking place is very small. With such an immature technology it’s impossible to say with certainty what impact more widespread adoption may have on the broader cryptocurrency market.
What is certain is that atomic swaps will make exchanges even more global. Let’s pretend, for example, that Alice lives in Australia and Bob lives in Paris. Transferring money to one another would be borderless and the only fees Alice and Bob would pay would be to the decentralised matchmaker.
In terms of future markets, it is a common belief that cryptocurrency adoption, positive speculation and ease-of-use tends to have a positive impact.
Atomic swaps might benefit traders already positioned in cryptocurrency markets by making it easier to exchange different cryptocurrencies. But this does not necessarily help new entrants to the market. The difficulty of trading national fiat currencies for cryptocurrency still exists and is not made easier by atomic swaps.
In economic theory, fewer barriers to trade increases supply. In this case, that means more trading in cryptocurrencies, which in theory could lower the price of cryptocurrencies. Most importantly, because the space is so young and the regulatory environment so uncertain, any price prediction going forward cannot be based on anything more than speculation.
Some risks to be aware of
- One of the most important factors going forward is the evolving regulatory environment. The reputation of cryptocurrency owners being on the fringes of legal use and transacting unsupervised is a concern for governments around the world.
- Atomic swaps could further increase growth in illicit markets. Decentralised exchanges built around atomic swaps are useful to merchants and consumers alike. The trouble is that the Lightning Network and decentralised exchanges will make regulating the cryptocurrency space more difficult.
- It’s possible that the future of atomic swaps might be impacted by changing cryptocurrency regulations around the world.