An atomic swap, is a type of cryptocurrency exchange that occurs in a decentralized way and without the need for intermediaries in the process.

Los atomic swaps or atomic exchanges, refer to a type of exchange between cryptocurrencies, where there is no need to trust a third party. Throughout the process, users maintain full control of their funds and private keys. With this new technology, the aim is to make it easier for users to exchange without intermediaries
of different cryptocurrencies.

An example of the use of this technology would be the following:

Example: How does an Atomic Swap work?

Miguel has 5 ETH in his possession, but he wants to exchange them for BTC. However, Miguel does not want to use a traditional exchange service, in which he must relinquish control of his cryptocurrencies, since he will have to make a prior deposit to make the currency exchange. To deal with this, you decide to use a Atomic Swap. With this service, Miguel announces that he wants to exchange his ethers for the equivalent in bitcoins. That's where Miguel's order is published and another user, for example Daniela, sees it. Daniela has BTC and wants ETH, that's why she accepts the order that Miguel has published and the exchange process begins jointly and simultaneously, that is, the coins they move from one direction to another at a time.

To facilitate this process, the so-called  Limited Time Hash Contract (HTLC). This ensures that each party receives their funds seamlessly.

Next, Miguel sends his ETH to an address indicated by the platform, while Daniela does the same with her BTC. Once both transactions are made and verified on their respective blockchain, Miguel and Daniela generate a cryptographic proof (hash). This test confirms the completion of such transactions. With this, the platform ensures that both parties have complied with the shipment of their cryptocurrencies, in the stipulated time and amount.

Once all the verifications have been completed, the process is finished and by then, Miguel will have his BTC and Daniela his ETH.

HTLC, the core of the functioning of the Atomic Swaps

HTLCs are the basic technology for the operation of atomic swaps and the guarantee of their operation. A HTLC or Limited Time Hash Contract it's just a Smart contract that manages a payment channel. These channels make use of blockchain properties hashlocks y timelocks. Through them, the recipient of a payment is asked to acknowledge having received it before a deadline. To do this, you must generate a cryptographic proof of payment or, otherwise, you will lose the ability to claim it, with which the amount will be returned to the payer.

The receiver generated cryptographic proof of payment can be used to trigger different actions on other payments. This makes HTLC a powerful technique for producing conditional payments in Bitcoin or others cryptocurrencies with such capacity.

In addition to this, HTLCs have the ability to produce interactions on-chain (within the blockchain) u off-chain (outside the blockchain). This allows the Transactions performed by the parties participating in an HTLC are much faster and less expensive.

Types of Atomic Swaps

On-chain

This type of exchange is what occur directly in de la blockchain of each of the cryptocurrencies that intervene in it. That is, they are transactions that are carried out and verified by the cryptocurrency blockchain. Due to this, the process of these transactions is usually more slow, since network verification is required to be able to validate them within the atomic swaps platform. However, this process makes them safer and more suitable for high value exchanges.

Example: Atomic Swaps on-chain

Sofia wants to make a 100 BTC exchange for Litecoin. To do this, go to the website of the atomic swap platform of your choice and announce your exchange. Luis accepts the exchange and together they begin the process. The atomic swap platform raises the HTLC on-chain and records each transaction. However, to validate it, you must wait for the transactions made by Sofía and Luis to be validated on their respective blockchain. This means that Luis will see a quick confirmation from him, but Sofia will have to wait much longer. Only once both sides are confirmed will the exchange be complete.

Off-chain

These exchanges are what occur in channels fuera de la chain or blockchain of each cryptocurrency. They are generally performed on platforms Layer 2 (Layer 2) as Lightning Network o Liquidity Network. The purpose making changes under these systems is accelerate el process de exchange. This, then, allows these to be practically snapshots. All this without any of the parties losing total control over it.

Example: Atomic Swaps off-chain

Matías wants to exchange 0,5 BTC for Litecoin. David accepts the swap, but in this case they will use the atomic swap off-chain option. To make payments, they will use Lightning Network. With this, both parties guarantee the corresponding payment in cryptocurrencies to the other party immediately. The process of using HTLC is the same, all in order to ensure the process and that both parties receive what is fair. Once both parties have completed the transactions, the exchange is terminated.

Advantages and disadvantages

Advantages

  1. Atomic swaps allow one way more transparent y personal de exchanges. All this thanks to the fact that the intervention of third parties in the process is not necessary.
  2. Allow mayores niveles de fullfilment of security requirements in exchanges and in the handling of users' cryptocurrencies or tokens. Firstly, the theft of cryptocurrencies or tokens due to a malicious attack on the service is ineffective. This is because the user's funds are not in the atomic swap service, but in his personal wallet. In this way, it is guaranteed that a malicious attack will not mean the theft of funds, a fairly common situation. Examples of these are the robberies that happened in Binance, Cryptopia or Mt. Gox.
  3. They allow the interoperability between different cryptocurrencies. This by allowing users to interact with each other much more easily and directly.

Disadvantages

  1. The use of atomic swaps is limited a cryptocurrencies able to use HTLC. If one of the exchange cryptocurrencies lacks this functionality, it cannot be performed. This is because HTLC is the one that guarantees compliance with obligations and if the networks of the currencies involved do not allow HTLC to be implemented, the Atomic Swap platform cannot carry out that specific exchange.
  2. The platforms Aun están en development and your options are limited in scope. In addition to this, its community is still small, which limits the capacity and supply of exchange.

How much do you know, cryptonuta?

Is one of the primary objectives of atomics swaps to return and maintain custody of assets during exchanges?

TRUE!

The fundamental objective of atomic swaps is to return and maintain full custody of the assets in exchange by users. With this, the atomics swaps respect the rule of the cryptoanarchists that says: "The best intermediary is the one that does not exist."

Bit2Me DEX: third generation trading with Atomic Swap

Bit2Me DEX is a third generation cryptocurrency trading platform, based on the protocol 0x. This protocol has been created in order to to exchange decentralized a growing number of Ethereum-based tokens, including all of type ERC-20 y ERC-721.

For this, it uses atomic exchange operations, where in a decentralized way and in a single transaction, two different tokens can be exchanged between two parties (humans or machines) without depending, at any time, on an intermediary that stores your cryptocurrencies (not even for one thousandth of a second).

The only thing you have to do is connect your normal wallet (Metamask) or you hardware type wallet (Ledger) and start operating from any of them. And best of all, the DEX operations are totally without commissions from Bit2Me, only the normal commission of the network (commission of miners).

Thus, this platform ensures you the portfolio to portfolio trading service in the safest way possible. To make this a reality, Bit2Me avoids being in the scene of the exchange between you and other users, avoiding taking control of deposits. This mechanism is the cause of stealing your funds is impossible, since these will not have left your portfolio. Also, no one can manipulate the volumes or visible information due to the way the protocol is built.

Bit2me DEX enables Atomic-Swap

Also, in Bit2Me DEX you can use cash to buy Ethers (ETH) thanks to coupons Tikebit. These coupons can be purchased at more than 150 official points that are throughout Spain and later redeem them within Bit2Me DEX.

Last but not least: the platform is 100% responsive. This means that Bit2Me DEX It can be used on mobiles and tablets without the need to install an app for it. As you can see, Bit2Me DEX has been created thinking of the comfort of veteran traders but also of the new and intrepid crypto lovers who start trading tokens.