Atomic Swaps: A Potential New Way to Transfer Digital Currency
Up until recently, if two parties wanted to exchange between two digital currency, like Bitcoin and Litecoin, there was no way to do this without the use of a third party.
The problem inherent in blockchain technology is that there is no way to undo a transaction. If you decided to trade someone some of your Litecoin for some of their Bitcoin, once you’ve sent your Litecoin if they decide to cheat you there is nothing you can do to get your Litecoins back. This places the person initiating the transaction at a serious disadvantage.
The solution to this problem has been the use of a third party exchange. The exchange acts as a mediator between parties and guarantees the two parties complete the transaction without anyone losing their coins.
The problem with using an exchange requires people to deposit their coins onto the exchange first. This poses a few problems, there are security risks, it takes time and there are fees involved.
No need for a third party
With an atomic swap the element of trust is removed from the transaction in what is called a ‘trustless system.’
Let’s say Jim and Tina agree to trade 100 of Tina’s Litecoins for one of Jim’s Bitcoins. Tina then sends her 100 Litecoins, and along with her Litecoin she also sends a randomly generated number called a hash.
Jim also sends his transaction of 1 Bitcoin along with his own hash. When both recipients view the other’s hash, which confirms the promised coins are submitted, the network is notified and the transaction is completed. With current technology, the two parties could execute an atomic swap without the use of the blockchain in what is called an off-chain atomic swap, meaning that the process is not embedded into the blockchain coding itself but sits on top of it.
Developers are currently working towards implementing what is called on-chain or cross-chain atomic swaps, which is a way to quickly transfer digital currency from one chain to another within the blockchain code.
Implementing atomic swaps to the blockchain
On-chain atomic swaps would allow different cryptocurrencies to act essentially as one. In an on-chain atomic swap, if Jim was selling his car for 1 Bitcoin and Tina only had 100 Litecoins, she could pay with the Litecoins and Jim would receive 1 Bitcoin.
Previously, Tina would have had to take the 100 Bitcoins to an exchange, which would take time and she would lose a portion of her 100 Litecoins to transaction and exchange fees.
This has become especially relevant in a time where governments like China are cracking down on exchanges, since atomic swap technology removes the need for exchanges for simple transactions.
Still working out the bugs
So far developers have accomplished only a few successful atomic swaps, and the details of exactly how the functionality will be added are still in unclear. However, the most likely solution will be the lightning network, which was designed as a scaling system for Bitcoin.
As Bitcoin’s popularity rose, so did its fees and transaction times. The lightning network solves this problem by opening up what are called payment channels which can process multiple transactions faster and with lower fees.
When the payment channel is closed, after the atomic swap completed, there is only one transaction recorded in Bitcoin’s ledger.
Since the lightning network runs using Bitcoin’s built-in scripting language, most altcoins that were designed based off of Bitcoin, like Litecoin and Dogecoin, are capable of hosting the lightning network as well. Many other coins that were not based on Bitcoin, like Ethereum, have their own built-in scripting language which means they can also readily adopt the lightning network technology.
Although there are many benefits to adopting atomic swap functionality to a coins core code, it is not clear which coins will implement it and which won’t.
The coins themselves don’t just disappear of the blockchain, this is just a transfer of value from one chain to the next. So if Jim spends 100 Litecoin for 1 Bitcoin, the value is transferred but the coins remain. In theory, there would also be someone willing to trade Bitcoin for Litecoin, similar to how a third party exchange works.
The lightning network will likely not replace exchanges entirely, but it can take the place of an exchange when it is more practical and convenient.
The reason to not adopt the lightning network may be as simple as not being the priority of the development team in their current roadmap, or that the coin was developed to function as a standalone network. However, there is a lot of research being done in this area and it is something we can expect to see rolled out in many of the major coins in the near future.
Image credit: picpedia.org
Buy Bitcoin, Ethereum, XRP, and other cryptocurrencies on Coinsquare.
Get the latest blockchain and digital currency news from Canada and around the world, delivered each week to your inbox.
Your Email address