Decentralization is one of the key elements of the cryptocurrency industry. The hope is for a world where more peer-to-peer interactions can take place online and third-party intermediaries are removed -- giving two parties the ability to execute a direct transaction.

Centralised vs Decentralised business diagram with icon
Source: Getty Images

However, there are lots of different blockchain networks in existence. That can muddy the waters a bit for the vision of a more decentralized and frictionless world. Enter the atomic swap.

Here’s what you need to know about atomic swaps, how they work, and the implications for crypto investors.

What are they?

What is an atomic swap?

An atomic swap is when cryptocurrencies from different blockchains are exchanged without a third party to validate or process the transaction. The crypto exchange that would typically handle a trade (like Coinbase Global (COIN -0.34%), for example) is completely removed from the equation. This gives the two parties making the exchange further autonomy and is a truly “decentralized” peer-to-peer transaction. Atomic swaps are also sometimes called atomic cross-chain trading.

An atomic swap can be used when trading cryptocurrencies, removing the need to trade using a fiat currency (dollars, euros, etc.) as a baseline value. But, as more merchants accept cryptocurrencies as a form of payment, atomic swaps could also come into play when online purchases are made.

How they work

How atomic swaps work

The “atomic” in “atomic swap” comes from the software world. In a database system, atomicity is when a transaction is all or nothing -- it either executes in full or not at all. The term “atomic swap” describes an exchange of two cryptocurrencies that is automatically executed in full (or not at all) when certain conditions are met.

This idea of swapping two cryptocurrencies from different blockchains was first envisioned early in the crypto industry’s history. It was first described in 2012, just a few years after Bitcoin (BTC -0.38%), the first cryptocurrency, made its debut. The first atomic swap took place in 2017 when Decred (CRYPTO:DCR) and Litecoin (LTC 0.81%) were exchanged without using a fiat currency as part of the conversion. A few days later, Litecoin and Bitcoin were exchanged.

But how is a trustless transaction between two parties who don’t know each other carried out, especially without an intermediary (a bank, an exchange, a payments network, etc.) making sure everyone plays fair? Cryptography and smart contracts are the answer.

In an atomic swap, smart contacts are used to create a virtual vault that can be used to perform an agreed-upon swap of cryptos. To use it, the first person sends their money to a specific contract address, where it is locked. The second person is notified and can confirm the first deposit, and then they lock their money into a second vault address. After the contract verifies that both parties have locked their money as promised, then they can each retrieve their swapped funds. If either party fails to perform, the swap times out and both get their money back.

Sound complicated? You don’t need to be a blockchain software developer to execute an atomic swap. Decentralized crypto exchanges such as Uniswap (UNI 1.17%) and PancakeSwap (CAKE -2.68%) can facilitate atomic swaps. All users need to do is connect a crypto wallet to get started.

Pros and cons

Pros and cons of atomic swaps

Atomic swaps are an important development for the crypto space as they attempt to create a more frictionless economy. There are benefits to technology-powered peer-to-peer transactions, but atomic swaps aren’t always the best method of exchange.

Pros of atomic swaps

  • A centralized exchange is removed from the equation, which can lower fees.
  • Eliminating intermediaries can speed up transaction time.
  • The need for making exchanges using fiat currency is removed.
  • Atomic swaps make it possible for different blockchain networks to be more interoperable.

Cons of atomic swaps

  • Not all cryptos can be traded with atomic swaps; two cryptos have to be based on blockchain networks that utilize the same cryptographic hashing algorithm.
  • There are a few more steps involved with atomic swaps versus using a centralized exchange, although the process is getting easier.
  • Atomic swaps don’t facilitate exchanges between crypto and fiat currency.
  • As with most things in digital currency, privacy and security risks are a potential factor; current atomic swap implementations do not offer strong transaction privacy, but there are proposals in the works for privacy enhancements.

Related Investing Topics

Atomic swaps and crypto investing

Atomic swaps and crypto investing

Lower trading fees and faster transaction times have always been a priority in investing and trade. Atomic swaps hold a lot of promise on this front for the crypto universe. However, ease of use and low cost don’t automatically mean an investment class is for every investor.

Atomic swaps are an emergency technology. They likely will continue to evolve and be implemented by more blockchains since interoperability expands a blockchain's ecosystem, and that's a good thing. If your favorite blockchain doesn't support atomic swaps yet, there's a good chance that it will in the future, whether you directly use them or not.

The cryptocurrency industry is still young and is developing quickly. There is debate on how -- or even if -- the value of cryptocurrencies can be accurately measured like other assets. Use cases for crypto and blockchain technology are also still being implemented at a limited scale in the economy, although a growing number of companies are testing the waters. As a result, the value of cryptocurrencies are highly volatile, atomic swaps or not.

Keep these risks in mind when deciding whether or not to make crypto a part of your diversified investment portfolio. And, if you’re just getting started, remember to take a measured approach as you learn more about how crypto and blockchain works.

Nicholas Rossolillo has positions in Bitcoin. The Motley Fool has positions in and recommends Bitcoin, Coinbase Global, and Uniswap Protocol Token. The Motley Fool has a disclosure policy.