What is an Atomic Swap?
An atomic swap is a cryptocurrency exchange between two blockchains. The swap is carried out between two entities with no intervention from a third party. The goal is to eliminate centralised intermediaries such as regulated exchanges and give token owners complete power.
The phrase atomic comes from the term “atomic state,” which refers to a state that has no substates; it either happens or it doesn’t—there is no other option. This relates to the status of the cryptocurrency transaction; it either occurs or does not occur.
Smart contracts are used by the majority of atomic swap wallets and blockchains. Smart contracts are programmes that run within blockchains when specific criteria are met. The prerequisites in this scenario are that each participant consent to the transaction before a timer runs out. The use of a smart contract in the transaction prevents one party from stealing cryptocurrency from the other.
Cross-chain atomic swaps are another name for atomic swaps.
KEY TAKEAWAYS
- An atomic swap is a cryptocurrency exchange between two parties that wish to exchange tokens from different blockchains.
- Atomic swaps are helpful if you only have one cryptocurrency but need to use another in a transaction.
- Special wallets or exchange services are needed to conduct an atomic swap because the technique is still being developed and refined.
Understanding Atomic Swaps
Each cryptocurrency is backed by a blockchain that is solely designed to handle transactions in certain tokens. Bitcoin (BTC), for example, has one, and ETH (ether) has another. You cannot easily trade BTC and ETH without first converting to fiat currency and then purchasing the other; another method is to convert between cryptocurrencies and exchanges many times to obtain the desired one. Atomic swaps allow you to exchange tokens from multiple blockchains in a single transaction.
Atomic swaps can be carried out through decentralised exchanges. A decentralised exchange (DEX) is a platform that allows you to trade without the involvement of third parties. You can also use cross-chain swap providers, which allow you to send your digital assets into another wallet, do the swap, and then transfer them back out.
History of Atomic Swaps
The idea emerged immediately after altcoins (cryptocurrencies other than Bitcoin) became available. With the development of altcoins, some cryptocurrency owners grew interested in transferring funds across coins. This sort of token exchange first surfaced in September 2017, with the execution of an atomic swap between Decred and Litecoin.
“On-Chain Atomic Swaps.” Decred.
Since then, startups and decentralised exchanges have integrated swaps and made the same functionality available to users. Lightning Labs, a business that exploits Bitcoin’s lightning network for transactions, has used the technology to conduct off-chain swaps.
Special cryptocurrency wallets capable of cross-chain atomic swaps have also been developed—Liquality has created a wallet that can swap Bitcoin, ETH, and other cryptocurrencies.
Atomic Swap Process
Two token owners agree to exchange their tokens for whatever amount they agree on in an atomic swap. When the smart contract programme notices that they have both agreed, it conducts the trade for them. The transaction is recorded in the blockchain and validated by network nodes before a new block is created to accommodate another transaction.
The transaction is irreversible. If they want the tokens back, both parties must agree to another transaction to exchange them.
Atomic swaps automate the exchange of tokens by utilising Hash Timelock Contracts (HTLC). HTLC, as the name implies, is a time-bound smart contract between two parties that entails creating one cryptographic hash on each end.
Both parties must acknowledge receipt of cash within a certain timeframe, according to HTLC. If one of the parties fails to confirm the transaction within the timeframe specified, the entire transaction is cancelled and the money are returned. This reduces counterparty risk, or the chance that one party will accept the provided coins while refusing to transfer their own coins.
Assume Jane and John want to convert 1 BTC to an equivalent number of Litecoins. She submits the transaction using an atomic swap wallet. During this process, a cryptographic hash function generates a hex number to encrypt the transaction. At the end of John’s life, the process is repeated.
Jane and John both use their encrypted numbers to unlock their separate funds. They must complete this within a certain time range or the transfer will be cancelled. The deal is subsequently executed by the HTLC within the blockchains.
Is an Atomic Swap Expensive?
The capacity of the mainstream to perform atomic swaps is new, but they do not yet produce fees unless there are blockchain fees involved.
How Do You Do an Atomic Swap?
It is accomplished through the use of bitcoin wallets and Hash Timelock Contracts (HTLC), which enforce the trade when both parties agree. In practise, only a few atomic swap wallet providers and decentralised exchanges are available for usage in a swap.
What Are Cross-chain Atomic Swaps?
Cross-chain atomic swaps are cryptocurrency exchanges or trades that take place between coins that use different blockchains.
Investing in cryptocurrencies and other Initial Coin Offerings (“ICOs”) is extremely dangerous and speculative, and this article is not a recommendation by Investopedia or the author to do so. Because every person’s circumstance is different, a knowledgeable specialist should always be consulted before making any financial decisions. Investopedia makes no guarantees or warranties about the accuracy or timeliness of the information provided on this site.