How do you trade coins on different networks? Before atomic swaps, there were only two ways:

  1. Use a centralized exchange that held both coins and conducted the actual trading for you.
  2. Arrange a trade directly with another crypto asset holder where you send your coin to them then they send their coin to you.

Both ways require you to trust either the centralized exchange or the other coin holder, which is hardly the blockchain dream. What makes blockchain unique is that you only need to trust the math. Atomic swaps were the first way to trade Bitcoins for a coin on another blockchain network that did not require trust in any other party.

Below explore this small but mighty moment in blockchain's history.

What are atomic swaps?

Atomic swaps enable crypto asset holders to directly exchange coins between different blockchains. Atomic swaps use smart contracts that are designed to execute only when all the conditions of the trade are met. For example, if you had Bitcoin and wanted to trade for Litecoin with some guy named Lenny then you would have to complete the following simplified steps to complete an atomic swap:

  1. Agree with Lenny on the price of the trade
  2. Lock up your Bitcoin in the atomic swap contract on the Bitcoin network
  3. Lenny locks his Litecoin in the atomic swap contract on the Litecoin network
  4. When both coins are locked up then both you and Lenny can withdraw your trades
    1. Both you and Lenny have to withdraw your trades in a certain amount of time (24 to 48 hours) for the atomic swap to be fully completed.

With atomic swaps, you don’t have to trust that Lenny will hold up his side of the bargain. You trust that the atomic swap will only execute completely when both you and Lenny are in possession of the coins that you agreed to trade.

Who invented atomic swaps?

Tier Nolan, a developer, is most widely recognized for inventing the atomic swap in May 2013.

A brief history

The first atomic swap was completed between Decred and Litecoin in September 2017. A few days later Charlie Lee, the founder of Litecoin, completed the first atomic swap between Bitcoin and Litecoin.

What’s so special about it?

Atomic swaps remove the need for a centralized authority like an exchange and allow trades to be completed conditionally so that both trades happen or none do. This is made possible by using Hash Timelock Contracts:

  • Hash refers to the secret number that is only generated through fancy math called cryptography. This secret number is crucial in completing the atomic swap.
  • Timelock means that the function only lasts a certain period of time.
  • Contract stands for the smart contract that only executes the swap when the conditions are met.

Did you know?

The

Lightning Network, which is developing technology for high speed, high volume, and low cost Bitcoin payments, also enables atomic swaps.

How do you use atomic swaps

An atomic swap between two different crypto networks requires that they both have similar foundations such as the same hashing algorithm and smart contract language. Since Decred and Litecoin are both forks of Bitcoin, it is possible to do atomic swaps between the three networks because they share enough similarities that make atomic swaps possible.

However, because Ethereum uses a different smart contract language as well as a different hashing algorithm, enabling an atomic swap between Bitcoin and Ethereum is not yet possible.

What can you do with atomic swaps?

For the technical user, Decred has created open source tools to engage in atomic swaps between a select number of tokens such as Bitcoin, Bitcoin Cash, Quantum, Monacoin, and Litecoin. For the less technical, easier-to-use solutions are available or in progress such as SparkSwap, Atomic Wallet, and Swap.Online. Please note that we have not verified the authenticity or usability of these solutions so please proceed carefully and do your own research when trading any crypto assets.

The Future

Atomic swaps are meant to function as an alternative to centralized exchanges. However, adoption and innovation in atomic swaps has been slow. It has been nearly two years since the first atomic swaps were completely and they are still a relatively rare occurrence. Centralized exchanges are still where nearly all trades between crypto assets from different networks occur.

Other methods for exchanging assets between differing blockchains have gained more community interest in recent months with the most exciting being interoperable blockchain networks such as Polkadot and Cosmos. In the crypto world, innovations and developments happen at a ridiculous pace and if a technology isn’t growing then it is likely dying.

Daily Debrief Newsletter

Start every day with the top news stories right now, plus original features, a podcast, videos and more.