In this article I will explain what atomic swaps are and their impact on the blockchain technology.
About 3 weeks ago the nifty guys over at the Decred project opened a new chapter in blockchain technology: They successfully completed the very first cross-chain atomic swap with Litecoin. This is a big achievement for the blockchain developers...and yet another one of them confusing, fancy, technical terms for the novice in the Cryptoworld.
But don't worry - I got your back. Let's dive in and see what it's all about!
The trust problem
Let's start with a little background: A fundamental problem in trading is the trust issue. Let's imagine the following scenario: Alice sees Bob advertising a hat online and she wants to buy it. They live far apart and don't know each other. How can they complete this transaction in a safe manner? If Alice sends the money first, Bob might choose not send the product at all. If Bob sends the hat first, Alice might back out on sending the money, since she already got her product.
You get the problem. Ideally, we want the transaction of money and item to happen simultaneously.
How can we solve this?
Alice and Bob could meet in person and conduct the trade. This approach is expensive due to the money and time consumed for traveling to the meeting point for both parties, but it does solve the trust problem.
They could find an escrow (third-party authority) that would receive and hold money and product until both parties have fulfilled their obligation. But what if they cannot agree on a trusted escrow? And what if the escrow is malicious and decides to scam both of them? Examining this approach, we are reminded of one of the fundamental goals of cryptocurrencies, which is to eliminate the necessity for third-party oversight and unnecessary involvement of authority for these exact reasons.
It's time to swap
In the digital world it is actually possible to make the both sides of the trade dependent. We can create a programming logic that makes a trade only go through if both parties oblige. Either both parties get their respective item or neither do. This process happens in a single transfer, that executes the trades at once and it goes by the fierce name - atomic swap.
So how does this atomic swap, or as the educated reader might say instantaneous sub-molecular exchange work?
The digital safe paradigm
Let's imagine that Alice wants to trade her coin A for Bob's coin B.
Alice places her coin A into a digital safe and gives the specifications of the lock to Bob. To unlock it you would need the key and Bob's signature. Now it's Bob's turn: He creates a similar safe, making sure that his lock matches the specifications Alice gave him, and stores his coin B there. Bob's safe requires the same key, since it's built using the same lock specifications, but also Alice's signature to unlock.
We have constructed a model where each safe can only be opened by the counter-party, but uses the same key.
When Alice opens Bob’s safe to obtain the B coin, her key for the lock is revealed and Bob can use the same key Alice just revealed, to unlock the safe Alice constructed and get his A coin.
This works beautifully, since opening one safe gives the trade partner access to the other safe. Because each safe requires both key and signature to open, the safe's are secure.
If something goes wrong along the way, or someone backs out in the middle of the transaction, the digital safes have a mechanism, according to which the coins are refunded to the respective owners once a predefined time limit is exceeded and both safe's have not been opened.
Pretty neat, huh? ( ಠ◡ಠ )
Where we are now
In recent news, Creator of Litecoin, Charlie Lee, successfully completed atomic swaps using Litecoin in exchange for Bitcoin, Vertcoin and Decred. If we continue down this innovative path, the technology of atomic swaps will allow us to run them decentralized exchanges your grandmother warned you about.
Link to tweet
However, a current drawback should be mentioned: the recent atomic swaps all required local coin daemons. In short, this means that in order to perform an atomic swap, an average user would be required to download the blockchains of either currency.
Yeah...that's not very practical, is it?
However, the talented devs are looking into a solution to this problem. In fact, the Komodo team has already successfully completed an Electrum server atomic swap, that did not require the download of the whole blockchain.
And they aren't the only ones. Decred is looking to integrate atomic swaps into their wallets. The Komodo team is working hard on their decentralized exchange called BarterDEX and other projects like Blocknet and Lykke are ones you might want to have on your radar.
Conclusion
Atomic swaps are a significant innovation in the crypto space. We have now found a way to trade coins without having to rely on trusting a third party or exchanges, coming even closer to our vision of a completely self-governed and free crypto world! We can use alternative coins with privacy features to disassociate ourselves from the coins and protect our privacy and preserve our anonymity. We can use coins like Bitcoin as a store of value, but use other coins, with their special features, as a medium of exchange - why not get the best of both worlds?
Image sources:
Information sources:
https://blog.decred.org/2017/09/20/On-Chain-Atomic-Swaps
https://www.cryptocompare.com/coins/guides/what-are-atomic-swaps
https://bitcointechtalk.com/atomic-swaps-d6ca26b680fe
More Articles like this:
Do you want to know more about the upcoming Bitcoin Gold fork? (Read article)
Do you want to find out more about the Ethereum Metropolis update? (Read article)
- Nick ( @cryptonik ) -