Home » Finance » Atomic Swap Definition

What is an atomic swap?

An atomic swap is an exchange of cryptocurrencies from separate blockchains. The exchange is carried out between two entities without the intervention of a third party. The idea is to remove centralized intermediaries like regulated exchanges and give token owners full control.

The term atomic derives from the term “atomic state” in which a state has no substates; whether it happens or not, there is no other alternative. This refers to the state of the cryptocurrency transaction; either it goes or it doesn’t.

Most atomic swaps wallets and blockchains use smart contracts. Smart contracts are programs within blockchains that run when certain conditions are met. In this case, the conditions are that each party accepts the transaction before the end of a period. Using a smart contract in commerce prevents either party from stealing cryptocurrency from the other.

Atomic swaps are also called cross-chain atomic swaps.

Key points to remember

  • An atomic swap is a cryptocurrency exchange between two parties who want to exchange tokens from different blockchains.
  • Atomic swaps are useful if you only have one cryptocurrency but need to use another in a transaction.
  • Special wallets or exchange services are required to perform an atomic swap as the technique is still being developed and refined.

Understanding Atomic Swaps

Each cryptocurrency is backed by a blockchain, designed only to accept transactions in specific tokens. For example, Bitcoin (BTC) has a blockchain, and ETH (ether) has another one. You cannot easily trade BTC and ETH without first converting to fiat currency and then buying the other; another technique is to convert cryptocurrencies and exchanges multiple times to get the one you want. Atomic swaps allow you to swap tokens from different blockchains in a single transaction.

Decentralized exchanges can perform atomic swaps for you. A decentralized exchange (DEX) has no central authority regulating it; it is a platform where you can trade without a third party. You can also choose from cross-chain exchange providers, where you transfer your digital assets to another wallet, perform the exchange, and transfer them again.

Atomic exchanges rely on each party to provide proof by encrypting the key and accepting both parties via the encrypted key.

History of Atomic Swaps

The concept was conceived shortly after the materialization of altcoins, cryptocurrencies other than Bitcoin. The creation of altcoins has meant that some cryptocurrency owners have become interested in transferring capital between coins. This type of token swap first appeared in September 2017, when an atomic swap between Decred and Litecoin was made.

Since then, startups and decentralized exchanges have implemented swaps and allowed users to have the same setup. For example, Lightning Labs, a startup that uses Bitcoin’s Lightning Network for transactions, has done off-chain trading using the technology.

Special cryptocurrency wallets have also been developed that are capable of cross-chain atomic swaps – Liquality has developed a wallet that will swap Bitcoin, ETH, and more.

Atomic exchange process

In an atomic swap, two token owners agree to exchange their tokens for the agreed amount. The smart contract program sees that they both agree, so it performs the trade for them. The transaction is recorded in the blockchain and validated by the network nodes, then a new block is opened for another transaction.

The transaction cannot be undone. Both parties must agree on another transaction to exchange the tokens again if they wish to recover them.

Atomic swaps use Hash Timelock (HTLC) contracts to automate token swapping. As the name suggests, HTLC is a time-bound smart contract between parties that involves generating a cryptographic hash at each end.

A cryptographic hash function is an algorithm that converts variable-length data, such as a person’s wallet address and transaction information. It converts it to a fixed length hexadecimal number. In general, the number generated is called the hash.

HTLC requires both parties to acknowledge receipt of funds within a specified time frame. If either party fails to confirm the transaction within the specified time, the entire transaction is canceled and the funds are returned. This eliminates counterparty riskor the risk that a party will accept the coins offered and refuse the transfer of their coins.

For example, suppose Jane wants to convert 1 BTC into an equivalent number of Litecoins with John. She submits the transaction through a wallet compatible with atomic exchanges. A cryptographic hash function generates a hexadecimal number to encrypt the transaction during this process. The process is repeated when John ends.

Jane and John unlock their respective funds using their encrypted numbers. They must do so within a specified time, otherwise the transfer will not take place. The HTLC within the blockchains then executes the transaction.

Is an atomic swap expensive?

The ability for the general public to perform atomic swaps is new, but they do not yet incur fees unless blockchain fees are involved.

How do you do an atomic swap?

This is done using cryptocurrency wallets and Hash Timelock (HTLC) contracts, which enforce the exchange when both parties agree to it. In reality, only a few providers of atomic exchange wallets and decentralized exchanges can be used in an exchange.

What are cross-chain atomic swaps?

Cross-chain atomic swaps are exchanges or exchanges of cryptocurrencies between cryptocurrencies that use separate blockchains.

Investing in cryptocurrencies and other initial coin offerings (“ICOs”) is highly risky and speculative, and this article is not a recommendation by Investopedia or the author to invest in cryptocurrencies or other ICOs. Since each individual’s situation is unique, a qualified professional should always be consulted before making any financial decision. Investopedia makes no representations or warranties as to the accuracy or timeliness of any information contained herein.

Related Posts