What is an atomic swap, and how does it work?

1 year ago

Atomic swaps region intermediaries and centralized control, thereby making cryptocurrency exchanges much decentralized.

Atomic swaps alteration peer-to-peer (P2P) transactions betwixt individuals with antithetic cryptocurrencies connected 2 abstracted blockchains, eliminating the request for an intermediary (such arsenic a centralized exchange). Atomic swaps let users to speech integer assets arsenic per self-executing astute contracts.

Centralized exchanges (CEXs) present a trading acquisition resembling accepted stocks and fiat trading — supply plus liquidity, manage trading pairs and bid books, guarantee just marketplace prices, and link buyers and sellers connected a platform. They are custodial and exert centralized control arsenic they person entree to idiosyncratic backstage keys. 

CEXs are fashionable with precocious trading volumes, but they are contravening the decentralized ethos of cryptocurrency and blockchain. This is wherever decentralized exchanges (DEXs) question to embody a noncustodial infrastructure. Atomic swaps alteration greater interoperability crossed assorted blockchain networks. They alteration decentralized multichain cryptocurrency speech fostering a existent decentralized concern (DeFi) ethos. 

Related: Why cross-chain interoperability matters for DeFi

Atomic swaps alteration DeFi and lick the inefficiencies associated with exchanging cryptocurrencies wrong centralized concern (CeFi).

To speech Ether (ETH) connected the Ethereum network and Bitcoin (BTC) connected the Bitcoin network, 1 tin travel the steps beneath portion utilizing a CEX, specified arsenic Coinbase oregon Binance:

  • Registering an relationship connected a centralized speech level that supports the ETH/BTC trading pair. This whitethorn necessitate a sign-up process and a KYC mandate, arsenic per the CEX’s policy.
  • Transferring ETH to the centralized exchange.
  • Converting ETH to BTC, which whitethorn impact incurring transaction fees and, sometimes, a agelong waiting period.
  • Withdrawing the acquired BTC to a Bitcoin wallet, which whitethorn impact further fees.
  • Lastly, patiently waiting for the exchange’s processing and the eventual accomplishment of funds.

This emblematic CEX speech presents a bid of steps, uneconomical fees and aggregate imaginable complications. Additionally, CEXs tin present unanticipated information risks related to plus custody. CEXs store idiosyncratic funds successful custodial wallets, and the speech retains power of the backstage keys. In the lawsuit of a information breach, hack oregon regulatory withdrawal freeze, the user’s cryptocurrency could beryllium exposed to imaginable threats. 

To lick these problems, DeFi and DEXs alteration atomic swaps, which destruct the request for intermediaries successful trading, streamline the process, and importantly trim galore imaginable information hazard points for cryptocurrency users.

Related: How to mitigate the information risks associated with crypto payments

Atomic swaps, besides called cross-chain atomic swaps, were theorized successful 2013 but gained practicality post-2017.

In July 2012, Sergio Demián Lerner, a developer, produced the archetypal mentation of a trustless speech protocol. However, a afloat moving paper was fixed successful 2013 by Tier Nolan, who is wide acknowledged arsenic the pioneer developer of atomic swaps owed to his broad statement of the atomic swap procedure. 

In 2017, the conception saw its archetypal actualization erstwhile Charlie Lee, laminitis of Litecoin, tweeted the historical infinitesimal of the completion of the archetypal palmy atomic swap. He successfully performed a cross-chain atomic swap involving LTC/BTC, wherever helium exchanged Litecoin (LTC) for BTC. 

Ever since this milestone, galore DEXs and swaps person been leveraging this exertion to make caller cryptocurrency trading solutions. Popular DEXs and networks that enactment atomic swap trading see AtomicDEX, the Lightning Network, Liquality and others.

Atomic swaps enactment by utilizing astute contracts and hashlock cryptographic techniques to unafraid integer plus exchanges.

“Atomic” is simply a word utilized to picture processes that either reason successfully oregon bash not initiate astatine each — determination is nary different alternative. An atomic swap for crypto trading implies lone 2 imaginable outcomes: Either the commercialized is successfully executed, oregon nary enactment occurs.

In simpler terms, an atomic swap creates a mechanics wherever some sides of the cryptocurrency trade indispensable fulfill each predetermined conditions earlier the commercialized tin beryllium finalized. This is achieved done the implementation of astute contracts, which are self-executing programs designed to enforce the conditions indispensable for a transaction to beryllium successful.

Atomic swaps utilize hashed clip fastener contracts (HTLCs), which are a signifier of smart contract, to alteration unafraid and trustless exchanges of cryptocurrencies. HTCLs, successful essence, “lock” a transaction and request that some parties verify the accusation earlier the speech tin proceed.

Atomic swap astute contracts person 2 indispensable components:

Hashlock

The hashlock mechanics allows the declaration to beryllium locked with a unsocial cryptographic key that tin lone beryllium generated by the cryptocurrency depositor. This key, which is simply a unsocial information piece, ensures that the swap is lone finalized erstwhile some parties o.k. the transaction.

Timelock

The timelock mechanics is similar a deadline for the swap. It ensures that the transaction is completed wrong a definite magnitude of time, and successful the lawsuit it does not happen, it returns the depositor’s funds. Timelock fundamentally helps unafraid the transaction. Both parties indispensable o.k. the swap wrong the specified clip bounds oregon other the transaction gets aborted and the crypto is returned to its respective owners.

Working of atomic swaps

Atomic swaps amended blockchain interoperability and trim risks portion providing traders with greater flexibility astatine a little cost.

Atomic swap benefits include: 

Fully decentralized nature

Atomic swaps connection traders the vantage of decentralization. Peer-to-peer trading grants autonomy connected one’s funds and independency from CEX platforms oregon a centralized liquidity pool.

Enhanced security

The hashlock and timelock mechanisms successful the self-executing astute contracts utilized by atomic swaps supply traders with a higher level of security. Traders person the certainty that their cryptocurrency volition beryllium returned successful the lawsuit of delays oregon conflicts.

Interoperability and altcoin commercialized flexibility

Atomic swaps alteration the swap for users connected antithetic blockchains. Many CEXs bash not let traders to swap each sorts of altcoins. Atomic swaps lick this occupation by allowing practically each forms of altcoins to beryllium swapped.

Atomic swaps tin beryllium technologically complex, with higher blockchain hold times resulting successful slower adoption rates. 

Atomic swap disadvantages include: 

Complexities with commercialized swap

Atomic swaps necessitate the speech of data, accusation and hashed cryptographs. This tin beryllium daunting for beginner traders. 

Lack of fiat-crypto on-ramp

For traders who privation to liquidate to fiat, this tin beryllium challenging due to the fact that fiat-to-crypto and crypto-to-fiat exchanges are not imaginable connected atomic swap DEXs.

Currently, fewer platforms enactment atomic swaps. In addition, 1 mightiness necessitate circumstantial programming skills and hash cognition to utilize atomic swaps. Nevertheless, cryptocurrency wallets volition apt integrate this exertion into their bundle successful the future. 

Atomic swaps are designed to guarantee idiosyncratic anonymity truthful that their identities are not exposed. 

As opposed to CEXs, atomic swaps bash not necessitate KYC. Atomic swaps themselves are designed to beryllium trustless and private, meaning they purpose to guarantee that the transaction details and participants’ identities are not straight exposed. 

However, it is important to enactment that the underlying blockchains utilized successful atomic swaps, specified arsenic Bitcoin and Litecoin, are nationalist ledgers wherever transactions are recorded and disposable to all. While the atomic swap transaction itself whitethorn not beryllium easy distinguishable from different transactions connected the blockchain, the idiosyncratic transactions progressive successful the swap tin inactive beryllium tracked connected their respective blockchains. 

To further heighten privacy, participants tin usage further techniques specified arsenic coin mixing oregon privacy-focused cryptocurrencies. Coin mixing involves obfuscating the transaction past by combining aggregate transactions to marque it harder to hint the funds. Privacy-focused cryptocurrencies, similar Monero (XMR) oregon Zcash (ZEC), connection built-in privateness features that tin beryllium utilized successful conjunction with atomic swaps to heighten anonymity.

Atomic swaps alteration P2P exchange, portion cross-chain bridges supply a transportation betwixt blockchains for the transportation of assets done tokenized representations.

While some cross-chain bridges and atomic swaps heighten blockchain interoperability and service the intent of transferring crypto coins crossed assorted blockchains, they relation successful antithetic ways. Cross-chain bridges service arsenic a transportation oregon nexus betwixt aggregate blockchain networks. They enactment arsenic intermediaries that facilitate the transportation of assets betwixt these networks.

Cross-chain bridges necessitate the burning oregon locking of a token earlier its availability connected a antithetic blockchain. A wrapped token is created, and an equivalent magnitude is made disposable wrong a liquidity excavation connected the people chain. These wrapped tokens tin past beryllium transferred, traded connected the people blockchain, oregon redeemed for the archetypal assets connected the root blockchain.

Cross-chain bridges are becoming fashionable acknowledgment to their easiness of usage and bully idiosyncratic interface and are viewed arsenic a modern, accessible mode to swap cryptocurrencies connected abstracted blockchains. 

View source