All you need to know about Atomic Swaps

Atomic swap is cryptographically secured smart contract cross-chain transection between one crypto to another. It is first introduced by Komodo Platform. Atomic swaps are one of the most important things when it comes to exchanging cryptocurrencies. Atomic swaps allows individuals to trade crypto without having any third party involvement this is the main highlight of atomic swap.

How it works

Let suppose Alice have 1 Bitcoin and she wants it to exchange with 10 ethereum, in traditional way she has to go on centralized exchanges which’s involves high risk of fraudulent but she only wants to exchange it in decentralized manner so let suppose another random guy Bob have 10 Ethereum and he also wants to convert his 10 ETH to 1 BTC so Alice and Bob could make a tarde so there are two scenarios might happen.

  1. Alice sends her 1 btc to Bob but Bob never sends his 10 Eth back to Alice.
  2. Alice receives Bob’s 10 Eth but she never sends back her 1 btc to Bob.

In order to prevent these kind of scenarios atomic swap uses something called Hash Time Locked contracts. It ensures that transaction between them are completely trustless. For Example – If Alice receives Bob’s 10 eth and she failed to send her 1 btc to Bob or vice versa then Hash Time Locked contract prevent these kind of fraudulent situation.

How Hash Time Locked contracts works (HTLCs)

In HTLCs there are two concept

  1. Hash Locked
  2. Time Locked

So, in order to have a trade between Alice and Bob, both must have to submit their transaction to their respective blockchain, Alice on the Bitcoin blockchain and Bob on the Ethereum blockchain. First Alice must have to generate a private key that only she knows then using her private key she’ll have to sign a 1 BTC transaction to Bob then she sends the hash of the transaction to Bob, then Bob’ll sign his 10 Eth transaction back to Alice using Alice’s hash sent so after signing the transaction now Alice is able to redeem her 10 Ethereum sent by Bob then after redeeming Bob’s 10 Eth now Bob also can redeem his 1 bitcoin sent from Alice. So even Alice has her private key before Bob there is no way to fraud to Bob because Alice transaction have already committed on the blockchain. She can’t reverse her 1 btc. There is one thing to keep in mind Bob can’t redeem his 1 BTC sent by Alice before redeeming Alice her 10 Eth sent by Bob first.

So there is a problem in between

What if Alice signed a 1 btc transaction on the blockchain to Bob but Bob’d never send his 10 Eth transaction using Alice transaction hash. Here’s Time Lock contracts comes into play. What it does is basically sets a time limit for transaction. When blockchain will not get Bob’s transaction back to Alice under a fixed period of time then Alice transaction which is already committed on the blockchain will reverse to her wallet and this same applies for Bob as well.

Ledger Nano X - The secure hardware wallet

The Latest

Elon Musk unveil Neuralink a brain-computer interface

Elon Musk recently unveils Neuralink a brain-computer...

Why China at Galwan?

The reason behind China standoff against India...

Dzhanibekov effect suggests Earth might flip upside down at any time, event would be catastrophic

Every planet rotates counter clockwise in our solar system as...

Modi’s government plans to make India self- reliant

Due to the pandemic Indians have to face the...

China asks India to support the principle of One-China policy

Ji Rong The spokesperson of Chinese embassy...

Companies are choosing India as a Destination to move out of China

China is worlds manufacturing superpower after...

China’s search engine giant Baidu launches its own blockchain called Xuperchain

China’s biggest search engine Baidu launches its...

Actual reason behind the so planar design of Tesla Cybertruck

Ever since Tesla CEO, Elon Musk unveiled...

IIT Madras has developed Iron-ion battery, an alternative to Lithium-ion

Researchers at IIT Madras has successfully developed...

Hubble found water vapor on an exoplanet beyond our solar system

Water vapor have been detected in the...

iPhone 11 pro and pro max are here, everything you need to know

By saying we have always believed by...

This creature’s silk is stronger than steel, here’s how

Tougher than any man-made material, spider silk...

Lander Vikram has finally been found, ISRO confirms orbiter took its thermal image

After loosing contact with the lander Vikram...

Huawei starts rolling out emui 10 with android 10

As you know, tensions between Huawei and...