An Introductory Guide to Atomic Swaps

Learn Altcoins Bitcoin Blockchain Ethereum
An Introductory Guide to Atomic Swaps

Cryptocurrencies are broadly thought of as decentralized, trustless digital assets that can be transferred peer-to-peer. However, based on the process by which most cryptocurrencies are transferred today, it is clear that we are still relying on intermediaries.

Atomic Swaps are the direct transfer of cryptocurrencies between users without going through intermediaries like centralized exchanges. The idea for a trustless exchange protocol was first developed in 2012 by a coder named Sergio Demian Lerner. A year later, another developer named TierNolan created the first proof of concept of an atomic swap.

Unsurprisingly, it is one of the core features behind many of today’s decentralized exchanges and is quickly gaining popularity as a growing subset of crypto users begin to shy away from the KYC-induced world of centralized exchanges and embrace more private and peer-to-peer alternatives.

Centralized Exchanges

Centralized exchanges have become crucial to the adoption of cryptocurrencies because they provide an entry point for the fiat world to transition into the world of digital assets.

Coinbase, Binance, OKEx, KuCoin and other large exchanges hold large sway over which cryptocurrencies get exposed to new investors. Due to KYC requirements, however, these exchanges have as much access to users’ data as a traditional bank. The downside of such platforms is that they are more vulnerable to hacking, censorship, and mismanagement.


Like most centralized entities, many exchanges have more security vulnerabilities because they operate with one single point of failure.

There have been several cases of centralized exchanges being hacked, the most famous being the Mt. Gox exchange, which had about $450 million in bitcoin stolen.


Centralized exchanges make it easier than ever for regulators to censor users by requiring the exchange to implement KYC policies. Individuals with public profiles often own these exchanges, which makes it easier for them to be targeted by governments and forced to give up information about their users.


When dealing with a centralized exchange, users are forced to place their trust in the people running the exchange, rather than the systems that operate it. If founders are corrupt, they can easily develop back doors to their exchange which allow them to steal funds or create hidden rules that allow the exchange to bet against its own users as a way to gain additional profit.

Censorship-Resistant and Highly-Secure

Security threats, censorship, and mismanagement are the most common disadvantages of using intermediaries to handle transactions. Atomic swaps counter all of these problems by enabling cryptocurrency transactions to be performed as they were originally intended to be: trustless, peer-to-peer and offering full control and ownership of one’s private keys.

Atomic swaps allow users to exchange cryptocurrencies from different blockchains without the need of a centralized intermediary. This increases efficiency and flexibility for users to exchange cryptocurrencies based on Proof-of-Work (PoW), Proof-of-Stake (PoS),  Directed Acyclic Graph (DAG), and other protocols in a method that is truly peer-to-peer.  

How it Works

Atomic swaps can be conducted between separate blockchains, or between one blockchain and its off-chain channel.

The process starts by having two or more participants who want to engage in a transaction. The participants come together and open up a special payment channel that exists off-chain. They then form a Hash TimeLock contract (otherwise known as HTLC or a time-bound smart contract).

The HTLC’s main purpose is to facilitate the secure payment between the parties based on each participant acknowledging the receipt of funds within a specified time frame using a cryptographic hash function. If the receipt of funds is not acknowledged within the specified period, the transaction is automatically canceled and the funds are returned to the sender.  

This diagram illustrates the atomic swap process between Alice and Steve:

An Introductory Guide to Atomic Swaps - 1

(Source: Hackernoon)

Let’s breakdown what is occurring in this image step by step:

  1. Alice holds BTC and wants to swap it with Steve’s LTC.
  2. Both participants open up a payment channel and Alice creates a contact address (this contract address is like an escrow that safely locks both of their funds)
  3. Alice then deposits her BTC into this address, creating a unique cryptographic hash that is sent to Steve.
  4. Steve is then able to create a contact address using the hash he received from Alice.
  5. Steve sends his LTC to this contact address
  6. Alice receives the LTC and is able to unlock it because she created the hash.
  7. At this point, both parties are able to get access to each other’s funds by signing a transaction for the sender’s contact address (Alice signs for Steve’s contract address, Steve signs for Alice’s contract address).
  8. Alice needs to be the first participant to sign Steve’s contract address in order for Steve to unlock the value within the transaction. Once unlocked, Steve signs Alice’s contract address to receive his BTC

On-Chain vs. Off-Chain Atomic Swaps

An on-chain atomic swap is one that takes place on either cryptocurrency’s blockchain. Both cryptocurrencies must support HTLC and have the same hashing algorithm. The earliest and most popular case of an on-chain atomic swap being conducted was between Decred and Litecoin in September 2017.

Off-chain atomic swaps allow transactions to be made off the blockchain, or on what is known as layer 2 of a blockchain. Bitcoin’s Lightning Network is the most popular example of a layer 2 scaling solution. The earliest off-chain transaction occurred between the Bitcoin and Litecoin blockchains using the Lightning Network.

Today, some of the most popular projects adopting atomic swaps are:

  • Blocknet – A second layer blockchain interoperability protocol that enables communication, interaction, and exchange between different blockchains.
  • Komodo – An open-source infrastructure for an interoperable blockchain ecosystem.
  • – A cryptocurrency exchange that leverages cross-chain atomic swaps, cryptographic protocols, and payment networks such as Lightning and Ethereum’s Raiden Network to establish a bridge between different blockchains.
  • AirSwap – An Ethereum-based peer-to-peer trading network.

Atomic Swaps Enforce Decentralization

Atomic swaps bring many advantages to the crypto space. They enable cryptocurrencies belonging to different blockchains to be transferred seamlessly from wallet to wallet, without the need of a centralized exchange. This functionality helps create bridges between the dozens of blockchains that currently exist in silos.

The more currency-agnostic the crypto markets become, the easier it is for blockchain projects to build a user base and for the technology as a whole to reach mainstream adoption.

Atomic swaps also help increase the transaction volume on middle to lower market cap cryptocurrencies. Currently, if one wants to transfer this demographic of coin between each other, users usually have to first exchange them for ether or bitcoin, and then purchase the coin they really want.

This process helps create more transaction volume for large-cap coins at the expense of the lower capped coins. A direct transfer of value via cross chain atomic swaps would make it easier for lower ranked cryptocurrencies to dramatically increase their transaction volume and one day compete with larger cryptocurrenices for market cap dominance.  

Atomic Swaps still have some limitations, such as the need for cryptocurrencies to meet three conditions before they can engage in a cross chain transaction:

  1. Having an inherent hash algorithm.
  2. Initiating TimeLock contracts.
  3. Having specialized programming functionalities.

Further limitations include the inability to maintain speed as transaction volume increases, which is essential if atomic swaps are expected to help blockchains scale. Lastly, the number of wallets that are compatible enough to engage in an atomic swap is still relatively low.

Despite these shortcomings, atomic swaps hold massive promise as the ultimate solution to the problem of centralized intermediaries in the crypto space. If cryptocurrencies are truly about financial autonomy, then atomic swaps are a must-have feature to enforce decentralization through trustless, peer-to-peer exchanges of value.

Aisshwarya Tiwari

Aisshwarya is currently working as the Chief Editor at and holds more than 4 years of experience in the digital assets industry. He holds an undergraduate degree in Commerce with Honours and a post-graduate diploma in Liberal Studies. Before entering the crypto industry, Aisshwarya worked as an SAP Consultant for a global IT firm. He also cleared the CFA Level 1 exam before pivoting to the crypto industry due to its novel and exciting propositions.