Atomic Swaps
Script error: No such module "Draft topics". Script error: No such module "AfC topic". Script error: No such module "AfC submission catcheck".
Atomic Swaps[edit]
An atomic swap is a type of peer-to-peer cryptocurrency trade. Each swap is "atomic" because either it is successfully completed and each trader receives the other one's funds, or nothing happens and both traders simply keep the funds they started with. This technology also provides a secure way to trade natively across various blockchain networks without the need for third parties such as centralized cryptocurrency exchanges or cryptocurrency minting/burning protocols.
Characteristics[edit]
- Users do not need to give up their private keys at any during a swap.
- Atomic swaps are designed such that the swap takes place and both parties receive the funds they desire, or nothing happens at all and both parties retain the funds they started with (minus a very small transaction fee for the “order-taker” and blockchain network/gas fees).
- Atomic swaps enable trading between any two cryptocurrencies either on the same blockchain protocol or across two separate blockchain protocols.
History[edit]
In 2012, Sergio Demien Lerner published the first known online post on atomic swaps.[1] In 2013, Tier Nolan posted the first basic outline for atomic swaps.[2] In 2014, James 'jl77' Lee launched InstantDEX, which was the earliest example of a functional atomic swap-powered decentralized exchange. In 2019, the Komodo development team launched AtomicDEX — a third-generation atomic swap software that improved upon Lee’s initial atomic swap research and development.[3] In 2017, the Decred development team completed the first Litecoin (LTC) < -- > Decred (DCR) atomic swap.[4] In 2020, the Liquality development team launched the first-known web browser extension for atomic swaps.[5]
How Atomic Swaps Work[edit]
According to Komodo, the general atomic swap implementation has five steps.[6] In this scenario, suppose that there are two traders: Bob and Alice. Let’s say that Bob has BTC he would like to exchange for ETH. Meanwhile, Alice has ETH and she is hoping to swap it for BTC.
Step 0[edit]
The Market Maker posts a trade order on the exchange. This is listed as Step 0 because, technically, it’s not part of the atomic swap process. However, this step must happen before the atomic swap can begin.
Step 1: <DEXfee> payment[edit]
The Taker sees Maker’s offer and accepts it. She commits to the trade by paying a platform fee, which is a percentage of the total trade amount. The purpose of platform fees on DEXs is to make sure Takers don’t spam the network with rapid requests.
Once Taker has paid the DEX fee, the atomic swap has officially begun. Maker observes the fee payment and initiates the second step of the swap.
Step 2: <MakerPayment> Is Sent[edit]
Maker sends his payment, known as the Maker Payment, to a P2SH address (for Bitcoin-protocol coins) or to a smart contract address (for ETH and ERC-20 tokens).
The Maker Payment is locked with the hash of a 32-byte secret code that Maker randomly generates. Only Maker knows the secret but the hash of the secret is public. This means that Taker knows the hash of the secret but she cannot spend the funds until she knows the 32-byte secret code itself.
The Maker Payment is also time locked. The length of the time lock varies according to the block times of the two assets being swapped. Since Bitcoin has long 10-minute block times, the lock time must be longer, too. In most cases, the lock time for Maker Payment is 15,600 seconds, which is 4 hours and 20 minutes. If the time lock expires before the atomic swap is complete, then Maker receives the Maker Payment back.
Step 3: <TakerPayment> Is Sent[edit]
Taker sees that Maker has sent the hash-locked and time-locked Maker Payment. At that point, she sends the Taker Payment to a second secure P2SH address. Significantly, the Taker Payment is hash-locked with the same hash that Maker used to lock the Maker Payment. Taker can use the hash to lock the funds, despite the fact that she still does not know the secret code that Maker used to generate the hash. The Taker Payment is time-locked, but with a length of time that is half of that used to lock the Maker Payment.
Step 4: <TakerPayment> Is Spent[edit]
Maker sees that Taker has sent the Taker Payment, which is locked by the hash of the 32-byte secret code he generated in Step 2. Maker reveals the 32-byte secret code, broadcasting it to the blockchain's peer-to-peer network in order to send the Taker Payment to his own address. Once this transaction has been initiated, the secret code is publicly visible.
Step 5: <MakerPayment> Is Spent[edit]
Taker sees that Maker has spent the Taker Payment and also sees that the secret code has been revealed. She uses the same secret code to unlock the Maker Payment and sends the funds to her personal address. The atomic swap is now complete.
This process ensures a secure, trustless, peer-to-peer exchange. There are no intermediaries, only a cleverly designed protocol that leverages cryptographic techniques to make sure neither party in the trade can cheat. It is also an atomic process, which literally means that either: (a) the swap occurs exactly as Bob and Alice agreed, or (b) nothing takes place and both Bob’s and Alice’s funds are returned to them.
Examples of Decentralized Exchanges Using Atomic Swaps[edit]
- AtomicDEX is a non-custodial wallet and atomic swap exchange rolled into one app. It supports UTXO based chains like Bitcoin, Dogecoin, Litecoin, and DigiByte as well as EVM based chains like Ethereum, BNB Chain, Polygon, and Avalanche.[7]
- Decred DEX is a system that enables the trustless exchange of different types of blockchain assets via an API.[8]
- Liquality is a multi-chain browser extension wallet. It supports Bitcoin, Ethereum, Rootstock, NEAR, and Polygon ecosystems.[9]
References[edit]
- ↑ Magazine, Bitcoin. "What Are Atomic Swamps?". Bitcoin Magazine - Bitcoin News, Articles and Expert Insights. Retrieved 2022-07-21.
- ↑ Sergeenkov, Andrey (August 20, 2021). "A Beginner's Guide to Atomic Swaps". Retrieved July 21, 2022.
- ↑ July 5 2019 (2019-07-05). "Komodo launches AtomicDEX mobile app". Coin Rivet. Retrieved 2022-07-07.
- ↑ "Decred - Decred Adds Support for Atomic Swaps". decred.org. Retrieved 2022-07-07.
- ↑ Foxley, William (2020-09-24). "ConsenSys-Incubated Startup Releases In-Browser Atomic Swap Wallet for DeFi". www.coindesk.com. Retrieved 2022-07-07.
- ↑ "Atomic Swaps: Trustless, P2P, and Cross-Chain Crypto Trading". Komodo Academy | En. 2018-08-03. Retrieved 2022-07-07.
- ↑ "AtomicDEX - The Evolution Of Wallets And Exchanges Into A Single Application". AtomicDEX. Retrieved 2022-07-07.
- ↑ "DCRDEX | Cryptocurrency Exchange". dex.decred.org. Retrieved 2022-07-07.
- ↑ "Liquality". liquality.io. Retrieved 2022-07-07.
/
This article "Atomic Swaps" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:Atomic Swaps. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.