This page uses content from Wikipedia and is licensed under CC BY-SA.

Atomic swap

An atomic swap allows for the exchange of one cryptocurrency for another cryptocurrency without the need for a trusted third party.

Overview

In traditional cryptocurrencies a trusted third party such as an cryptocurrency exchange or decentralized exchange (DEX) is necessary to perform a swap of cryptocurrencies in order to prevent one party from sending a currency without receiving a currency in return. An atomic swap is an all-or-nothing way to trade cryptocurrencies without those risks. An atomic swap system can use a hash time-locked smart contract so that a party must deliver the currency to be swapped within a specified time, or else the transaction will be cancelled. This preserves atomicity in that either the swap will take place, or no currency will be swapped. [1][2]

Atomic swap process

Atomic swap or atomic cross-chain trading (ACCT) is a mechanism, where two (or more) parties own coins in separate cryptocurrencies, and want to exchange them without having to trust a third party. The term “atomic” here means indivisible, and refers to the fact that sending cryptocurrency on one chain and sending other cryptocurrency on the other chain cannot be performed independent of each other. If these transactions could be performed independent of each other, then while one party could fulfill their side of the bargain and send some cryptocurrency on one chain, the other party would have the option of going back on their end of the bargain and simply not following through with the protocol, ending up with both cryptocurrencies.

A decentral exchange where two parties, A and B, want to exchange cryptocurrencies can be based on the following process:

  1. A generates some random data (called the secret) x.
  2. A generates T x1 (the payment) containing an output with the chain-trade smart contract in it. It allows coin release either by signing with the two keys (Ak and Bk) or with (secret x, Bk). This transaction is not broadcast. The chain release script contains hashes, not the actual secrets themselves.
  3. A generates T x2 (the contract), which spends T x1 and has an output going back to Ak. It has a lock time in the future and the input has a sequence number of zero, so it can be replaced. A signs T x2 and sends it to B, who also signs it and sends it back.
  4. A broadcasts T x1 and T x2. B can now see the coins but cannot spend them because it does not have an output going to them, and the tx is not finalized anyway.
  5. B performs the same scheme in reverse on the alternative chain. The lock time for B should be much larger than the lock time for A. Both sides of the trade are now pending but incomplete.
  6. Since A knows the secret, A can claim his coins immediately. However, A, in the process of claiming his coin,reveals the secret x to B, who then uses it to finish the other side of the trade with (x, Bk).

Atomic swaps have the disadvantage that both chains need to implement the atomic swap (of course in addition to being capable to provide smart contracts) in order for this to work.[3]

History

The idea of atomic swaps was first described in 2013 by Bitcointalk user Tier Nolan.[4]

ZCash releases their tool atomic swap tool, ZBXCAT, in experimental stage Oct 2017. [5][6]

Usage

In September 2017, Decred began to support atomic swaps between Decred, Bitcoin and Litecoin .[4]

Using multi-hop locks, atomic swaps can be realized without hashing.[7]

A Lightning Network is a second, optional layer that removes the mining fee and creates an instantaneous transaction.[8][9][5] Lightning Network was released March 2018 by Lightning Labs.[10]

See Also

References

  1. ^ van der Hoeff, Mitchel (9 May 2018). "Atomic Swaps Simply Explained: How to Swap Cryptocurrencies without a Middleman". Hackernoon. Retrieved 29 September 2018.
  2. ^ van Aaron, Wirdum (11 Jan 2017). "Atomic Swaps: How the Lightning Network Extends to Altcoins". Bitcoin Magazine. Retrieved 29 September 2018.
  3. ^ PoC Consortium - a CryptoGuru SIG (27 Dec 2017). "The Burst Dymaxion" (PDF).
  4. ^ a b "Decred Adds Atomic Swap Support for Exchange-Free Cryptocurrency Trading". NASDAQ.com. 2017-09-20. Retrieved 2017-10-24.
  5. ^ a b O'Leary, Rachel Rose (11 Jan 2018). "Atomic Action: Will 2018 Be the Year of the Cross-Blockchain Swap?". Coin Desk. Retrieved 29 September 2018.
  6. ^ "zcash-hackworks/zbxcat". GitHub. ZCash. 19 Oct 2017. Retrieved 29 September 2018.
  7. ^ Malavolta, Giulio; Moreno-Sanchez, Pedro; Schneidewind, Clara; Kate, Aniket; Maffei, Matteo. "Multi-Hop Locks for Secure, Privacy-Preserving and Interoperable Payment-Channel Networks" (PDF). International Association for Cryptologic Research. Retrieved 29 September 2018.
  8. ^ "Decentralized Exchanges, Off-Chain Atomic Swaps, And A Brief Look Into The Future". Coin Telegraph. 20 Apr 2018. Retrieved 29 September 2018.
  9. ^ Castor, Amy (27 May 2017). "Cross Blockchain Trades? Lightning Gives New Life to Atomic Swaps". Coin Desk. Retrieved 29 September 2018.
  10. ^ Torpey, Kyle (11 Mar 2018). "Bitcoin's Highly-Anticipated Lightning Network Goes Live As Startup Raises $2.5 Million". Forbes. Retrieved 29 September 2018.