articleStartImage

Atomic swaps is not just a buzz term, it’s actually a very critical advancement which will change the way we exchange cryptocurrencies today. In order to explain atomic swaps and how they work, I am going to keep this article as simple as possible and refrain from any jargon. Let’s get down to it now. 

What is an Atomic Swap?

In cryptography, computer language and science, Atomic = something that is whole or indivisible. It would be the simultaneous occurrence of two events, such that they could be referred to as a single event. Think of it as ‘all or nothing’, like a handshake. Either two peoples’ hands are shaking or they are not, there is no middle ground or half shaking because if Tom is shaking Bob’s hand, that must mean that Bob is also shaking Tom’s hand, so this single event with two parties has occurred simultaneously. A swap on the other hand is,  an act of exchanging one thing for another.

In the cryptoworld, an atomic swap is the exchange of different cryptocurrencies on different blockchains, without the need to trust a third party/intermediary. It utilizes a specific type of smart contract called ‘Hash-time locked contracts’ (or HTLCs for short) that enables two people to exchange different cryptocurrencies in a trustless manner, without the inherent risk of one person defaulting or backing out of the trade.

What is a ‘Hash time locked contract’ or HTLC?

A ‘hash time locked contract’ is the underlying smart contract used to facilitate atomic swaps. It ensures that both parties involved hold up their end of bargain and keeps the process completely trustless. Since these contracts are ‘time-locked’, each participant in the atomic swap only has a set amount of time to confirm their end of the swap, or the entire thing is nullified and the cryptocurrencies are returned to each participant.

Let’s use an example to illustrate. Today, Jim wants to exchange 1 BTC with Mary for 1,000 ETH.  Jim will create a specific hash with represents the amount of BTC he will pay Mary. To receive payment, Mary will create a cryptographic proof of payment, and they will both need to do this within a specific amount of time. Think of it as Jim as Mary both sending their cryptocurrencies to a locked box that requires a secret key to open. Jim can see that Mary’s ETH is in the box and Mary can see Jim’s BTC, but they can only claim each other’s cryptocurrency by entering the secret key. When Jim enters the secret key and claims the 1,000 ETH, it will be sent to the Blockchain and revealed to Mary, effectively unlocking the BTC and making them claimable for Mary.

 

The Next Wave

The current abundance of centralized exchanges like Binance, Kucoin, Coinbase, are all temporary in nature in my opinion. The whole point of a decentralized system like Blockchain and cryptocurrencies was not meant to be traded on centralized exchanges, it actually goes against the entire fundamental principle of what this technology was created for. Even more worrisome have been the flaws prevalent in these systems which we’ve seen time and time again with DDOS attacks and exchange hacks resulting in the loss of millions of dollars in cryptocurrencies.

With cross-chain atomic swaps set to hit mainstream in 2018, and being the underlying technology behind most decentralized Exchanges (DEX), it’s only fitting that we need a decentralized solution for our decentralized currencies to conduct peer to peer (p2p) transactions on our own terms. Atomic swaps seem to be the key to the death of centralized exchanges.