Blockchain > Explainer
Due to the popularity of cryptocurrencies, the number of cryptocurrencies and blockchains are steadily increasing. Blockchain and cryptocurrency have huge potential and are evolving on a daily basis. With the progression of blockchain and cryptocurrency, many new challenges present themselves.
One of these challenges is scalability. Many projects and developers are working hard to solve the scalability issue. It is very important that the scalability issue is addressed. Some solutions to scalability include sharding, lightning network and atomic swaps. This guide will look at atomic swaps, and how they solve issues such as scalability.
What are Atomic Swaps?
Bitcointalk user Tier Nolan first described the idea of atomic swaps in 2013. Since then there has been a lot of innovation and collaboration to make air swaps a reality.
Why would we prefer atomic swap technology, rather than existing centralised and decentralised exchanges?
The reason this is preferred is the fact that trusting a third party is a risk, as that third party could, accidentally or on purpose, leave one or both clients without their funds. Atomic swaps are also called peer-to-peer trading because the trade is made wallet to wallet.
An atomic swap is an exchange in cryptocurrency that either happens completely or not at all, without the funds going through a third party.
At its core, atomic swaps are based on smart contract technology. Atomic swaps enable two people to exchange different cryptocurrencies, without one of the two people defaulting. It allows trading in a trust less environment.
Because atomic swap technology is based on smart contract technology, it ensures that the contract is not released until all the terms have been met. When an atomic swap contract is open, both parties must receive their coins, only then is the contract released. Very little, or no fees will be charged for atomic swap transactions.
How Atomic Swaps Works
If two individuals want to exchange, for example, Bitcoin (BTC) for Ether (ETH) without the use of a centralized exchange, an exchange rate would be agreed and person A would send Bitcoin (BTC) directly to person B, while person B would send Ether (ETH) to person A.
However, as cryptocurrency transactions are irreversible, person A is at a disadvantage if they send their coins or tokens first as there is no certainty that person B will also send their coins or tokens. This is when atomic swap technology comes in handy.
With Atomic Swaps we get on-chain atomic swaps and off-chain atomic swaps. There are currently two types of on-chain atomic swaps:
Single-chain swaps: Single-chain swaps are done by having both parties send their funds to a single swap contract.
Cross-chain swaps: cross-chain atomic swaps use the Hashed TimeLock Contract. A Hashed TimeLock Contract (HTLC) is a type of smart contract used in cryptocurrency channels to eliminate counter party risk, it does so by having recipients of a transaction acknowledge payment by generating cryptographic proof within a certain time frame, otherwise the transaction will not take place.
Another type of atomic swap technology is being tested and developed known as off-chain swaps. To support this, a blockchain needs to implement the Lightning Network, Lightning Network is a second layer technology, meaning that off-chain atomic swaps take place on a secondary layer of nodes.
Reasons for Atomic Swaps
Decentralised exchanges (DEXs) have solved many issues that were presented with centralised exchanges, but in turn, decentralised exchanges have also encountered some issues that need to be solved. A decentralised exchange (DEX) is not capable of handling a large amount of trades. To understand why atomic swaps are important, we need to look to look at existing technologies and see if they meet the requirements for a truly decentralised trading environment. One that is free from regulation, fast and secure.
Here are the key reasons why atomic swaps are important:
More decentralised: If we look at current centralised exchanged, we see there are many requirements in order to trade your coins or tokens. You need to register an account, and in most cases, you will have to go through KYC (Know Your Customer), in order to trade crypto. With atomic swap technology, you do not even need an email account, only a compatible wallet. That’s it. Atomic swap technology embraces blockchain as a distributed system.
Less dependence on (centralised) third parties: With atomic swap technology, users stay in control of their assets, and trades are settled directly between peers, without any third party or any intermediary, thus air swap trading is private.
Less chance of loss of funds: Since exchanges became popular, many hacks have occurred, and many people lost their funds. If cryptocurrency is to succeed in the long term, there needs to be secure methods of trading and transacting with cryptocurrency. Air swaps enable individual parties to trade with each other directly. You are not required to send your funds to an exchange, nor give someone access to your private keys. This allows participants to trade securely, and know that there is little risk of them losing their funds.
Fair trading: Because orders are created and transmitted directly between two parties, no outside participants can have an advantage. Those placing orders can do so without fear of being taken advantage of by automated, low-latency trading strategies.
Atomic swaps streamline the entire trading process to a point of complete convenience, while ensuring fair trade, and privacy.
Progress of Atomic Swaps
Since 2013, a lot of progress has been made with atomic swap technology. Yet it is still far from its potential, there are a few aspects of atomic swaps that need to be improved. First of all, it is not the most user-friendly technology. Traditional centralised exchanges are generally more user friendly, and make it as easy as possible for users to buy and trade cryptocurrencies. A lot more has to be done to enable less experienced cryptocurrency users to have a good user-friendly experience when conducting trades via atomic swap technology.
Atomic Swaps also add an unprecedented amount of liquidity to the cryptocurrency ecosystem, while having the potential to increase the number of merchants who accept cryptocurrencies. Cross-chain atomic swaps are not possible for fiat currency so for investors who want to purchase digital assets using fiat currency, traditional fiat-to-crypto exchanges will still be necessary.
Limitations of Atomic Swap Technology:
- Atomic swaps are still slow: Atomic swap technology is still being refined and a lot of innovation still needs to take place, before atomic swaps become fast enough to handle large volumes of transactions. Lightning Network is one of the innovations that is making atomic swaps faster.
- They aren’t yet supported by all wallets or exchanges: Not all wallets and exchanges allow the ability for a user to partake in an atomic swap. Newer wallets are trying to make use of this technology, but we need to see older wallets, and exchanges with a large user base also make use of air swap technology.
- They won’t work for coins and tokens that do not have smart contract support: Not all coins and tokens are yet supported by atomic swaps. This is changing though, as new coin and token creators realise the importance and the benefits that atomic swapping provides.
You no longer need to trust a trading platform with your assets. In fact, you do not even need to create an account. With continued innovation, the technology of atomic swaps will allow us to run decentralised exchanges that will be convenient for any user regardless of their experience with cryptocurrency.
As atomic swaps gain momentum, more and more cryptocurrencies will begin to support them. Not all cryptocurrencies are currently able to accommodate atomic swaps, but many that are unable right now, should be able in the future.