Cryptocurrencies were created to do transactions without a trusted party. There are many cryptocurrencies around, so the need to exchange them was created. There are many cryptocurrency exchanges, but they are a trusted party needed for the exchange transactions. Some peer to peer exchanges came up, but there is another option. Cross-chain trade transactions. With cross-chain trade transactions, you get the security that blockchain offers without the need of a trusted party.
To exchange one cryptocurrency to another, atomic swaps is the tool, that let this happen, without the need of a trusted third-party. This new piece of technology, is looking to revolutionize the way in which users transact with each other. To ensure that either party will do the transaction, atomic swaps utilizes what is known as hash time-locked contracts (HTLCs). Hash time-locked contracts ensure that the atomic swap process is completely trustless by ensuring that both fulfill the requirements of the trade.
The recipient has to acknowledge receiving payment prior to a deadline with the generation of a cryptographic proof of payment. If the receiver does not do this, he risks the payment, and the funds will return to the sender. The receiver must send this number to the other party, so the sender uses this number to inform the contract that the receiver has accepted the payment and the funds are released for both.
There are some fundamental requirements for the technology to work. First, it is 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. Both parties must be linked with payment channels. Another requirement is, that both blockchains should use the same cryptographic hash function, like Bitcoin and Litecoin, that use the SHA-256 function. This is needed, because if a different hash function is used, then the other contract of the atomic swap, will not generate the same hash value from the number provided, so there is no agreement about the payment status.
Atomic swap transactions, have been tested on a few SHA-256 blockchains. Decred and Litecoin Atomic Swap happened in September 2017, Litecoin and Vertcoin Atomic Swap were done in the same month but it is still at work. On-chain atomic swaps, have limitations, and that’s why they are not used very much. In addition to the same cryptocurrency hash function, time locked contracts should be supported also, and programming skills are needed to understand the whole concept.
The lightning network, will help for off-chain atomic swaps, that overcome the limitations of on-chain swaps with time locked contracts. There are services like Komodo, that try to make atomic swaps available to different blockchains. This will boost usage, and a friendly user experience is needed, for not technical savvy users, to use the atomic swap contracts. Atomic swaps, are in their infancy, and we will see many developments soon.
Image from Pixabay