What Are Atomic Swaps? – TrustlessBank

An atomic swap is a smart contract technology that allows cryptocurrency owners to exchange coins in a peer-to-peer network. Atomic swaps can occur on the main blockchain or off-chain.

The need for atomic swaps rises from the disconnected nature of the cryptocurrencies and race to eliminate third parties controlling the funds during an exchange. For example, not all currencies may be supported on one platform, so exchanges may have to happen through multiple intermediaries. During the trade, there is always the counterparty risk where one could be robbed of their money because the other partner fails to uphold their end of the deal or if a third party steals their money.

Atomic swaps solve this problem using Hash Timelock Contracts (HTLC). The process works as described in the example scenario below:

Short animated clip illustrating the process.
  1. Amy wants to exchange 0.1 Bitcoins for Ethereum currency. She makes this request on a cryptocurrency wallet or software that can provide her with a peer to trade with and the ability to record the exchange on a blockchain.
  2. The swapping platform finds a peer, Billy, who is willing to trade 4.70 ETH for the offered 0.1 BTC. Now, both parties have to deposit their coins for the swap to occur and they have to do it within a set time.
  3. Amy submits her transaction to the Bitcoin blockchain and receives a hash (a unique code) that encrypts the transaction and a secret number (used to unlock funds).
  4. With the hash Amy sends over, Billy submits his transaction to the Ethereum blockchain. This means both funds are locked by the same hash.
  5. To claim the Ethereum Billy deposited, Amy reveals the secret number that only she knows.
  6. Upon the secret number being revealed, Billy can now claim the Bitcoins Amy deposited, and the exchange is completed.

As can be seen, only after both parties have submitted their transactions can either unlock his/her funds. If either party fails to keep up his or her end of the trade before the timelock expires, the exchange does not occur and the user that may have already submitted his/her transaction to the blockchain has his/her coins returned.

The above example is an on-chain swap. This requires the involved currencies to use the same hashing algorithm and support HTLCs. Because few currencies are likely to adopt the same technological features, on-chain swaps are probably not going to occur on a large scale.

Interface for Atomic Swaps on TrustlessBank’s Wallet

On the other hand, off-chain swaps use payment channels. Payment channels only write the net results of multiple transactions between two or more parties on the blockchain. Because these swaps do not require a block to be mined on the blockchain of each currency involved, they are much quicker.

 

Atomic swaps are already being implemented in multiple cross-chain wallets such as TrustlessBank’s. TrustlessBank is a “Cross-chain Liquidity Protocol”: a blockchain infrastructure that allows atomic swaps between crypto-assets and stable coins, and allows OTC dealing without having to trust another counterparty using both fiat and crypto.

It’s evident that atomic swaps reduce third party involvement and give the user more freedom and security when making exchanges. Thus, they are helping to unlock a more fluid and connected crypto world.

 

Source: Crypto New Media

Close

Request For My Information

 
Close

Request For Account Deletion

Close

Request For Information Deletion

Close

General Request / Query To DPO