What Are Atomic Swaps?

Atoms for atomic swaps cryptocurrency

Atomic Swaps

Atomic swaps of coins, or atomic cross-chain trading, is the exchange of one cryptocurrency to another cryptocurrency without the need to trust a third-party. A relatively new piece of technology, atomic cross-chain trading is looking to revolutionise the way in which users transact with one another. For example, if Alice owned 5 Bitcoins but instead wanted 100 Litecoins, she would have to go through an exchange, i.e. a third-party. However, with an atomic swap, if Bob owned 100 Litecoins but instead wanted 5 Bitcoins, then him and Alice could do a trade. In-order to prevent for example, Alice accepting Bob’s 100 Litecoins but then failing to send over her 5 Bitcoins, atomic swaps utilises what are known as hash time-locked contracts (HTLC).

Hash time-locked contracts ensure that the atomic swap process is completely trustless by ensuring both fulfil the requirements of the trade. HTLCs require the recipient of a payment acknowledge receiving payment prior to a deadline by generating a cryptographic proof of payment. Or, the recipient risks losing the right to the claim the payment, therefore returning the funds back to the sender.

Therefore, for a trade between Alice and Bob to take place, both must submit their transaction to their respective blockchains. Alice on the Bitcoin blockchain and Bob on the Litecoin blockchain. In-order for Alice to claim the 100 Litecoins sent from Bob, she must produce a number that only she knows that was used to generate a cryptographic hash, therefore providing proof of payment. Similarly, in-order for Bob to claim the 5 Bitcoins that was sent from Alice, he must also provide the same number that was used to generate the cryptographic hash.

Requirements for Atomic Swaps
As exciting as this technology is, there are some fundamental requirements for a cryptocurrency before it can successfully support atomic swaps. One such requirement is the implementation of the Lightning network.

If a hash time-locked contract can be thought of as linking two blockchains together, the lightning network can be thought of as linking payment channels together. That is, for Alice and Bob to transact with each other, they must be linked through payment channels. The lightning network allows for that.

In addition, for a transaction to occur between two different blockchains, it is necessary for both blockchains to share the same cryptographic hash function, such as SHA-256. This is to allow for the hash-time locked contract to function properly when it comes to the user providing the number that was generated via the hash function.

To find out more about hash functions, check out this article here.



SHARE