Why Atomic Swap is the future of Decentralized Exchange [Must Read]

Atomic swaps are going to lessen the burden of crypto enthusiasts considerably. Today, if you want to trade one cryptocurrency for another, how do you do that? Traditionally, you have two choices. Firstly, you can either find someone you know and trust to do it in person. Secondly, which has been more of a practice today, you go through a centralized exchange.

You must be aware that the option of going through centralized exchange involves reasonable risk also. Because in the process, you take your funds off the blockchain and give its custody to a third party. Out of any incident if your keys are stolen or the whole exchange gets hacked you run out of luck.

Moreover, the involvement of any third party defeats the very spirit of cryptocurrency as a concept. If the cryptocurrency is a decentralized currency why a third party to mediate?

Thus, the Computer Science came up with a workaround called Atomic Swaps also referred as Cross-chain Atomic swaps.

An atomic swap allows the exchange of one cryptocurrency for another without the need for a trusted third party.

Meaning of atomic or atomicity in an Atomic Swap

In layman terms, atomicity in computer science refers to compulsory inter-dependence of events. Wherein, the two events are so tied together by programming in a specific manner. This specific allow both events happen simultaneously or do not happen at all. You can draw analogy of Atomicity with a scene where Aron shakes Jacob. Now, isn’t this impossible for Aron to be shaking Jacob without Jacob as well shaking Aron? De facto, they are both shaking hands or not shaking hands at all.

Atomic swap is being seen as a major breakthrough in crypto sphere.

Atomic swaps can happen in an On-chain manner or Off- chain manner. The latter is seen as more promising and revolutionary.

Why does Atomic Swap matter as a breakthrough in cryptocurrency?

Crypto Ecosystem would perform in its earnest spirit after having Atomic Swap in action for common users. This decentralizes and democratizes the whole trading process making it truly peer-to-peer.

When Atomic swaps are in place, neither of two parties can run away with others’ cryptocurrency. Either the swap will take place, or no currency will be swapped at all. This will be cryptographically ensured by smart contracts of atomic swaps automatically.

The trade will either happen and both parties will receive their respective coins or the trade will not be successful at all. So, neither of parties can default on trade.

Based on programming logic, Atomic swap makes it impossible for only one side of the trade go through. In fact, there aren’t two separate transfers, but a single transfer that does the swap at once.

No trading fee, however a nominal would be in place to maintain the network.

Chances of hacking, especially in the off- chain Atomic swaps are highly reduced.

Trades shall become faster by eliminating delays normally, caused by missing deposits/withdrawals, server downtime, etc.

Bigger volume of trade will be facilitated without fear of being stuck up. This would be possible because chances of defaulting by either of the parties is nullified.

Not Only this, Read On

You can always retain the custody of your private keys. This would prevent incidents of coins being stolen from centralized exchanges by hackers.

Atomic swap, esp. the Off-Chain would allow keeping your identity private by requiring no verification process. These Atomic Swaps would bear no record of transactions on the Blockchains after swap.

First On-chain Atomic swaps although was made although using SCRIPT contract language and between the currencies having same hash. The On-chain Atomic swaps too are under heavy research and developments. This would certainly eliminate the present-day limitations.

The Off-chain on the other hand is an envying arrangement. This is using hash time-locked contract (HTLC) and SegWit enabled Lightening Network. This arrangement has immense potential to revolutionize the whole crypto ecosystem.

So how does Atomic Swap work?

Swaps can happen in On-chain manner Or in an Off- chain Manner. But basic idea is that no party should be able cheat on the other.

The simple On- Chain Atomic Swap can be done although by a Common contract language between two currencies with same hashes.

An advanced version of On-Chain can include Time locked hashed contracts and lightening network also.

But an off -chain Atomic swap upon which researchers are eyeing on, essentially incorporate both these features.

In fact, Off-chain Atomic swap incorporating Lightening network is actual speed and efficiency the crypto world is concerned about.

On that note, atomic swaps make use of a Logic called hashed time lock contract (HTLC).  Which is itself an amalgamation of two technologies Hashlock and Timelock. The two technologies set individual conditions on a multi-signature (or multisig) transaction. And the individual conditions functions much like escrow in action.

Lightning Network already uses the same Logic arrangements to establish bidirectional payment channels on top of a single blockchain. So, it can conveniently open channels across two chains.

Functioning of HTLC and Lightning Network(LN)

Role wise, a hash time-locked contract (HTLC) can be thought of as linking two blockchains together. The lightning network (LN) on the other hand can be thought of as linking payment channels together.

The Lightning Network is however basically developed as an Off-Chain network. And this aims to help reduce the load on the main Bitcoin blockchain.

Experts draw analogy of a bridge between an empty highway and busy highway for Lightning Network. So, in practice, the Lightning Network would ease the traffic of Bitcoin Blockchain. The LN will facilitate traffic to go through empty Blockchain say, that of Litecoin.

Practical functioning of Atomic swaps could be complex. But for the sake of convenience you can understand it as an exchange of a lockbox. And this lockbox requires a common key and respective signatures of two parties on trade. As soon as one of the parties opens the lockbox the key is reflected on other side too.

The time lock in action ensures that the exchanged coin is claimed by the parties within time frame. If either of the party fails to claim the coins are refunded to the respective sides.

How Lightning Network(LN) Eases Cross-Chain Swaps?

Off-chain swaps on LN are instant as opposed to On-Chain swaps without LN. Because the swaps through LN happens outside the respective blockchains of the both parties on trade. Only condition is that the LN should be activated on either side of the blockchains which is becoming a reality with SegWit.

Lightning Network require funds to be committed for off-chain Atomic Swaps. That is, any funds in a Lightning Network channel can only be used on the Lightning Network until the channel is closed.

LN transactions are a lot cheaper, lot faster and more useful for smaller transactions and have better privacy protections. However, bigger transactions would prefer On-chain atomic swaps because this requires off line signatures also. With that said, On-Chain Atomic Swaps reduce privacy. Because the payments on the two chains can be linked. This makes easier for a passive observer to detect your transactions.

State of Development on Off- Chain Atomic swap

The first atomic swap (On- chain) occurred in September 2017 between Decred and Litecoin AND between Litecoin and Vertcoin.

Down the line, the first swap (Off- chain) occurred in November 2017 between Bitcoin and Litecoin.

Currently Atomic swaps are supported by Decred and Komodo and shortly Bitcoin atom will be offering this feature. Once fully developed, the Atomic Swaps shall likely be a part of all future exchanges.

SegWit which is a protocol upgrade is also a prerequisite for Lightning Network. In background it has made the Off Chain Atomic Swaps a reality. After implementation of SegWit with Litecoin & Bitcoin, the Atomic Swap is a march ahead in crypto sphere.

Leading from front, the decentralized exchange BarterDEX developed by Komodo has done remarkable feat. It has successfully completed Atomic Swaps on Electrum server. This could be seen as a significant achievement. Because this server provides for a user to make exchanges without having to download the whole blockchain.

Another ambitious project such as Blocknet is on way to create the internet of blockchains through the use of atomic swaps.

Yet another semi-decentralized exchange such as Lykke is offering exchanges of cryptos at 0% commission.

With that said, the Atomic Swap is still in primitive stage and has miles to go before it becomes user friendly.

Atomic Swap with Lightning Network- More of good

Lightning Network provides the possibility to make a number of transactions that aren’t recorded on the blockchain. This is the major reason behind eliminating the transaction fee. Because the miner’s involvement is ruled out in the process.

While, this is good news for general users, it is not so good for the miners. As the transaction will not happen on the Blockchains, the miners will end up making less of profit from receiving transaction costs.

Important READS on this Blog:

Decentralized Exchanges as the Future Needs

What is Bitcoin in simplest approach of understanding?