Centralized exchanges are mediators between users during crypto trades. They help the users to trade between different cryptocurrencies existing in distinct blockchains. These exchanges have many threats to face. This marked the way to a new technology called Atomic Swap.
What Is Atomic Swap?
An atomic swap is a peer to peer exchange of cryptocurrencies without passing through any third party exchange. There are many problems faced by centralized exchanges which are solved by atomic swaps, some are:
- Threat from Hacking: Centralised exchanges often falls victim to hackers. A large number of cryptocurrencies are being stolen by hackers. This causes a lot of financial damage to the users as well as the exchanges.
- Government Regulations: As exchanges are physical entities situated in a particular country, they are registered under the government of that country. So they are bound to follow all the government regulations.
- Mismanagement Threats: Exchanges are managed by a group of people. The inefficiency of this group of people can also cause a great loss to the crypto community.
- Market Demand: Exchanges are not proportional to sudden changes in market demands.
The atomic swap was first introduced by Tier Nolan in 2013. He introduced it as a new technology that makes cross-blockchain cryptocurrency exchange easier. The first atomic swap was successfully conducted by Litecoin founder Charlie Lee in 2017 when he exchanged Litecoin over Bitcoin through the swap. Atomic Swaps uses Smart Contract technology to make exchanges possible. This technology allows users to trade coins directly from their personal wallets.
Working of Atomic Swap
Atomic swaps use Hashed timelock contracts or HTLC to make transactions. HTLC uses two keys for transactions which are:
- HashLock Key: This key makes sure that the currencies are traded only after all the parties are signed.
- TimeLock Key: This is a safety mechanism that returns the currencies to their initial owners if the transaction is not completed in a specified time period.
If user A needs to trade Ethereum for Bitcoin to user B, First the user A creates an HTLC address and deposits Ethereum into it. After that, a secret passcode called pre-image is created. This locked pre-image is sent to user B. User B subsequently verifies that the given value of cryptocurrency is available in the address. He can only unlock the address after creating another address and deposit Bitcoin of the same value. The second HTLC address has the same secret key as that of the first one. Thus both the users can claim their currencies at the same time and thus a swap occurs.
Advantages of Atomic Swap
- Decentralized nature: There is no need for a mediator so that inter blockchain swaps can be done even without trusting each other.
- Increased level of security: The users don’t need to give funds to an exchange or external agency.
- Less operational cost: As there are fewer trading fees, an Atomic swap is more economical.
Limitations of Atomic Swap:
Atomic Swaps can only be performed by satisfying some conditions. They are:
- Atomic swaps can only be performed by currencies whose blockchains follow the same Hashing algorithm.
- The blockchains should also be compatible with HTLC.
Even though the atomic swap has limitations, they provide a better opportunity to make trading easier. The use of decentralized exchanges can make a lot of changes in the crypto world including more secure trading and increased value.