It is an intelligent contract that agrees between the interested parties an exchange of one crypto for another, this does not require the use of third parties as cryptocurrency exchange platforms.
Such contracts take place in the middle of two blockchains of different crypto. The first recorded exchange was in September 2017, when an Atomic Swap was carried out between Decred and Litecoin.
Since that time some platforms make it easier for their users to run atomic swaps, crypto and platforms, such as 0x and Altcoin.io, have also incorporated this technology.
As we know, the cryptocurrency exchange process takes time and it’s complex, we can say that this is due to the way cryptocurrencies are built, which leaves a complex process to run when you exchange them for another user.
Currently there are cryptocurrency trading platforms that do not handle all crypto. This makes someone who wants to change their cryptocurrency to one not supported by that platform require a migration of the account to another platform that has the desired cryptocurrency.
Security: the HashLock and TimeLock technology in HTCL contracts that are used in Atomic Swaps, are those that offer security to both merchants and buyers, this security is due to the fact that the participants in the transaction have recovered their crypto, in case of irregularities.
Decentralisation: The ideal of cryptocurrencies is to be totally decentralized, but even so, to exchange cryptocurrencies we need a centralized platform, because Atomic swap does not need a platform to carry out the exchange because it works between blockchains can transfer funds from one portfolio to another without the need for third-party intervention.
Ease in trading altcoin: Atomic Swaps do not have the disadvantages of some cryptocurrency trading platforms that, like when you buy an altcoin like Monero or Dash, some platforms first require the exchange of Dash for Bitcoin and then the purchase with Bitcoin Monero, Atomic Swap does not have this problem since you can exchange Dash directly with Monero without restrictions.
Lower costs: trading between users with an Atomic Swap reduces the cost of commissions charged by the platforms, when a change is made from Dash to Bitcoin or when an exchange is made, a charge is generated, when an Atomic Swap is made, these commissions are reduced since the extra that the platforms take does not exist.
Complexity: because of its high level of safety, the rules imposed by the smart contract are stricter than those available to crypto trading platforms, even an Atomic Swap does not have the ease in which users interact on a platform, as an Atomic Swap requires data exchange with the hash.
Privacy: a curious detail of Atomic Swap, is the time when the exchange is delayed, but since this would affect privacy, then delaying more time in processing offers a wider port to hackers so that they can enter and collect private transaction information.
Centralization: Although centralizing a process in anti crypto, cryptocurrency trading platforms are necessary and provide certain comfort to their users, Atomic Swaps do not have these comforts, a missing and important comfort would be the exchange of a cryptocurrency with a currency fiat.
As it happens today, the process of exchange of cryptocurrencies is long and complex. This is due to several reasons. For example, the fragmented nature of the current cryptocurrency ecosystem presents several challenges for medium traders.
Not all cryptocurrency exchanges support all coins. For this, a merchant who wants to change his currency with another that is not supported in the current exchange rate may have to migrate accounts or make several conversions between intermediate currencies to achieve its goal. There is also an associated counterparty risk if the trader wishes to exchange his currencies with another merchant.
Atomic exchanges solve this problem by using Hash Timelock contracts (HTLC). As the name suggests, the HTLC is an intelligent fixed-term contract between the parties that involves the generation of a cryptographic hash function, which can be verified between them.
Nuclear exchanges require both parties to certify receipt of funds, within a set deadline using a cryptographic hash function. If one of the parties concerned does not confirm the transaction within the deadline, the entire transaction shall be cancelled and funds are not exchanged. The latter action helps to eliminate counterparty risk.
The main features of a smart atomic swap contract are:
HashLock: This is the technology that allows to close the contract with a key that can only be accessed by the user who deposits the crypto, this crypto can only be unlocked with a unique key that is a unique data chain.
TimeLock: This is the time locking mechanism which ensures that a transaction takes place within a certain period of time and returns funds to users if it is not completed. This assures users that through a time limit you get to deposit and the transaction is not completed immediately, we are certain that the funds are safe and will be returned
Suppose a User (1) and User (2) wish to exchange crypto through an atomic exchange.
User (1) deposits its encryption in an HTCL address, which serves as a virtual safe and can only be opened with a special key to which it can access.
User (1) shares a special key cryptographic hash with User (2), that deposits its own cryptos on an address created using the same cryptographic hash.
Once User (2) deposited the cryptocurrency, User (1) can use the currency “unlocking” the transaction with the appropriate key obtained from its initial deposit.
After User (1) uses the key to “unlock” the transaction, User (2) can access its share of the exchange.
Once both parties have access to their respective funds, the atomic exchange is completed.