Atomic Swaps: What They Are, How They Work, and What They Mean for Digital Currencies
Many people in the development community have been working on a new feature for some coins called Atomic Swaps. These swaps completely remove the need for third-party oversight and put the trading of different cryptos into the user’s hands
In recent weeks there’s been a lot of talk in the crypto development community about a revolutionary idea known as a cross-chain Atomic Swap. Atomic Swaps are a new tech that is still undergoing heavy development that allows for trustless, peer to peer trading between different types of digital assets. Both trades happen instantly, so there’s no chance for one party to not hold up their end of the bargain. And in a scenario where one party backs out halfway through, funds are returned to both parties after a specified amount of time.
This has enormous implications for the future of crypto-currencies, as the ability to swap coins seamlessly between blockchains opens a whole new world of potential uses. Atomic Swaps could make traditional crypto-exchanges obsolete, as this new tech can grant users complete control over their money if they are looking to trade between different currencies.
How Atomic Swaps Work
Imagine two people, Alice and Bob, want to trade some Vertcoin for Bitcoin. Alice is the initiator in this scenario and creates a “lockbox” of sorts that holds funds during the swap. It is also known as a contract address. This lockbox is special, as to open it requires Bob’s signature and a secret number that Alice generates herself. It is important that Alice does not share the number with Bob, as he could simply open the box and take the coins before the swap even takes place.
From there, Alice takes the secret number and creates a hash of the number. A hash is a number derived from the first that is mathematically tied to the first, but it is impossible to figure out the first number from the hash. However, it is very easy to get the hash from the original number. The hash acts as the lock, the number being the key. So, while Alice has both the lock and key, she cannot open the box and get her funds back because it still needs Bob’s signature.
Bob will then look over Alice’s contract address and make sure everything is in order before he creates his own lockbox. Alice will send Bob the hash of her box so that Bob can make a similar box with the exact same key, but in his case, he needs Alice’s signature to open it.
From this point, Alice has both the key and the ability to sign for Bob’s box and can redeem the funds tied to the address. When this is done, the secret number that Bob needs but does not know is broadcasted for all to see. Bob can then take the secret number, open Alice’s box, and redeem the funds.
In a scenario where Alice or Bob backs out halfway through the swap, both lockboxes are made so that if the swap does not take place all funds are returned to their owners depending on a specific time period set by each party.
Both parties agree on an exchange rate and then the trade is completed. No third party required.
Currently, there are only select currencies that can participate in an Atomic Swap. Recently, Litecoin and Decred made headlines when the founder of Litecoin, Charlie Lee completed one of the first atomic swaps between himself and the Decred development team. Bitcoin, Litecoin, Decred, Viacoin, and Vertcoin are the only currencies that have successfully completed Atomic Swaps, the code being open source to allow anyone interested to give it a shot for themselves.
— Charlie Lee [NO2X] (@SatoshiLite) September 20, 2017
Decentralized exchanges could spawn thanks to this new advancement, once much more rigorous testing can take place. This is huge, especially with constant news stories of this exchange getting hacked for all their worth and that one losing customer info. With an atomic swapping based exchange, users would have control over their funds the entire time and could be as anonymous as their currency of choice allows.
What do you think about atomic swaps? Do you think they’ll become mainstream moving forward? Let us know in the comments below!
Images courtesy of Pixabay, Pexels