What is Atomic Swap?

TLDR at the bottom of the page


Many crypto-exchanges are centralized, run by organizations which holds funds of their user. As a result, crypto-exchanges are a popular target among hackers. 

Atomic swap promises decentralized exchanges of cryptocurrencies between users. Futhermore, exchanges are no longer restricted to available coins on the cypto-exchanges.

What is it?

Atomic swap is a smart contract technology, allowing cryptocurrencies to be utilized without the need for centralized intermediaries such as exchange. The ability to conduct cross-chain transactions without intermediaries presents a huge step towards creating a decentralized cryptocurrency market, which currently is dominated by centralized crypto-exchanges.

"Atomic" in computer science terms refers to an operation that is whole and indivisible. In an atomic swap, either the trade executes for both parties, or the whole transaction does not go through.

In today's cryptocurrency market, buying a coin involves buying Bitcoin or Ethereum with fiat currencies and exchanging BTC or ETH with your desired altcoins (alternative coins, referred to as all other coins other than Bitcoin) via crypto-exchanges.

Atomic swaps resolves the latter utilizing Hash Timelock Contracts (HTLC) which happens on both blockchain.. Using time bounded cryptographic hash function, both parties are required to acknowledge the transaction within the time limit. Both parties will only be able to receive their funds once both have signed off on their side.

Atomic swaps can be carried out on a Lighting Network.

How It Works:

When Alice deposits her BTC and provides a key which creates a hash. Alice send the Hash to Bob, who than produces a similar contract address and deposits 1BTC equivalent of ETH. 

When Alice unlocks Bob contract address with the key used to create the hash, the key is revealed to Bob, who then proceeds to unlock Alice's BTC contract address using the same key. Both parties essentially sign off each other's transaction to receive their desired cryptocurrencies (ETH for Alice, and BTC for Bob).

As seen, both parties depended on each other in order to receive the cryptocurrency they desired. If the transaction fail to go through, the HTLC function ensures that all funds are refunded to their owners (BTC back to Alice, and ETH back to Bob)


Atomic swaps removes the involvement of crypto-exchanges to exchange cryptocurrencies, eliminating the risk associated with holding cryptocurrencies with crypto-exchanges.

Transactions will only proceed within the time limit, and upon acknowledgement by both parties, adding another layer of security for users involved in the transaction. 


Only cryptocurrencies that have the same hash alogrithm and support time lock contracts will be able to be exchanged.


Litecoin and Decred conducted the first on-chainatomic swap in September 2017, setting off a discussion within the cryptocurrency community.

In November 2017, the first off-chain atomic swap was conducted using the Lighting Network between Bitcoin and Litecoin.

Decentralized exchanges touting the use of atomic swaps are sprouting all over the industry, promising to overthrow centralized exchanges which often charges high transaction and withdrawal fees. Blocknet and BarterDEX are some of the decentralized exchanges that are seeing significant progress.


Alice is interested to exchange 1BTC to an equivalent amount of ETH with Bob. He submits his transaction to the Bitcoin blockchain while generating a key for a cryptographic hash function to encrypt the transaction. The same process repeats for Bob who does it for the Ethereum blockchain using Alice's hash.

Once both transactions are uploaded. Both Alice and Bob have a specific time limit to decrypt and unlock their funds using the key which Alice have.

Leave a comment

Please note, comments must be approved before they are published