What Are Atomic Swaps in Crypto?

An atomic swap refers to a cross-chain transaction between cryptocurrency wallets. The exchange is called “atomic” because there are only two possible outcomes of the trade.

Either both parties get their desired cryptocurrencies, or they both remain with their original cryptocurrencies.

Atomic swaps are purely peer-to-peer transactions. There's no need for an intermediary such as an exchange. Instead, the swaps happen directly between the user wallets while being governed by a smart contract.

How Does an Atomic Swap Work?

The entire process of an atomic swap is overseen by a Hash TimeLock Contract (HTLC). This smart contract ensures that both wallets receive their crypto within a specified time.

If one of the wallets doesn't confirm having received the funds within the time limit, the entire transaction is canceled, and both peers are returned their original assets.

Related: What Is a Decentralized Cryptocurrency Exchange (DEX)?

This process happens through cryptographically secure hashes. There are two specific features of a Hash TimeLock Contract (HTLC) that make atomic swaps possible:

1. Check-Lock-Time-Verify (CLTV).

According to BIP-65, this command “allows a transaction output to be made unspendable until some point in the future.” Simply put, it's a time lock feature that prevents a receiver of the funds from accessing (or spending) the funds until a particular time has passed. It also acts as a safety measure to return funds to the sender if the atomic swap isn't completed within a given time.

2. Pay-To-Script-Hash (P2SH).

This feature requires that funds sent to a certain address need special permission before the funds are spent again. This special permission is known as a hashlock. A hashlock “restricts the spending of an output until a specified piece of data is publicly revealed.” This piece of data is the result of hashing a secret code.

Why Are Atomic Swaps Useful?

Atomic swaps enable you to make cross-chain crypto transactions from the safety of your crypto wallet. You don't need to give your keys to a centralized exchange for the trade to take place. Better yet, if the transaction doesn't happen, then both parties are refunded their assets.

Another key point is variety. If the coins you want to exchange are not listed on the centralized exchange you use, you can't trade them. More so, centralized exchanges usually take months to list new coins. On the other hand, atomic swaps offer you the ability to exchange any coins so as long they are integrated with the atomic exchange platform.

Atomic Swap vs. Decentralized Exchange

Traditional DEXs generally allow you to swap coins on a particular blockchain. In comparison, atomic swaps allow users to make swaps on different blockchains.

For example, Uniswap, the largest DEX by market capitalization, only allows you to swap ERC-20 (Ethereum-based) tokens. You can't exchange Bitcoin for Ether on Uniswap—but you can do so on the Komodo decentralized exchange.

Related: What Is the Bitcoin Lightning Network and How Does It Help Scale Bitcoin?

Komodo was the first platform to implement atomic swaps. It reportedly allows atomic swaps on 95% of all cryptocurrencies.

The platform has a native coin called KMD that is used to pay for transactions on the network. It's important to note that the transaction costs are paid for by the liquidity taker.

As mentioned earlier, two parties take place in an atomic swap. The two parties are the “Maker” and the “Taker.” The liquidity provider is referred to as the “Maker” (market maker), while the liquidity taker is referred to as the “Taker.”

The Taker initiates the atomic swap and pays the transaction fee. The transaction fee that the Taker pays is meant to deter them from spamming the network with false transactions. On Komodo, the transaction fee is about 1/777th of the order amount.

Komodo even offers an open-source wallet called AtomicDEX. With this non-custodial wallet, you can trade any coin added by the developers.

Does Your Crypto Wallet Support Atomic Swaps?

The AtomicDEX wallet mentioned above is a non-custodial wallet, meaning you have full possession of your private keys. However, there are numerous crypto wallets out there, ranging from custodial wallets to multisig wallets, so you have to take your time and figure out what suits your crypto requirements.

Now you know about atomic swaps and how they work, you can factor that into the equation, too.

Author: Jerome Davidson

Source: Jerome Davidson.” What Are Atomic Swaps in Crypto?”. Retrieved From https://www.makeuseof.com/what-are-atomic-swaps-in-crypto/

All Rights Of This Article Reserved To MakeUseOf

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: