An atomic swap is known as the technology of smart contract that allows the exchange of one cryptocurrency for the other without the use of any centralized intermediaries. These swaps can easily take place between blockchains of varying cryptocurrencies.
If not, they can also be executed off-chain, away from the primary blockchain. Exploring the history, they first came into the limelight back in September 2017 when an atomic swap between Litecoin and Decred was executed.
Since that time, several other decentralized exchanges and startups have enabled users to access the same functioning.
In the present scenario, the cryptocurrency exchange process is extremely complicated and time-consuming. The reasons behind it are several. To begin with, as it occurs today, the nature of the cryptocurrency ecosystem is quite fragmented that challenges several average traders.
And then, not every exchange of cryptocurrency supports every type of coin. Thus, if somebody wants to exchange coins for another that the current exchange doesn’t support, he will have to either make different conversions between intermediate coins or will have to migrate the accounts to achieve his objectives.
Furthermore, if one trader would want to exchange coins with another trader, there can be a counterparty risk. In such a scenario, atomic swaps can be used to solve the issue with the use of Hash Timelock Contracts (HTLC).
Put simply, HTLC is a time-bound smart contract that takes place between parties involved in the generation of a cryptographic hash function, which can easily be verified. Atomic swaps need both the parties to acknowledge the fund Receipt within a particular timeframe with the use of a cryptographic hash function.
If any of the parties doesn’t confirm the transaction within the timeline, the entire transaction will be term void, and funds will not be exchanged.
Talk to our investment specialist
To understand it better, let’s take an example here. Suppose there is a trader, called A, who is willing to convert 200 bitcoins to an equal Litecoin with trader B. A submits his transaction to the blockchain of bitcoin.
During this process, A manages to generate a number for the cryptographic hash function for the encryption of the transaction. And then, trader B replicates the same process himself by submitting his transaction to the blockchain of Litecoin.
Both A and B unlock funds with respective numbers. However, they must do so within the given timeline, or the transfer will not be executed.