An Atomic Swap is a peer-to-peer swap between various cryptocurrencies without an agent. The term “atomic” is a sumptuous computer science word suggesting they either occur exclusively or not at all.
History and principle
In May 2013, Tier Nolan presented the idea of Swaps on BTCTalk . For the theoretical demonstration of an atomic swap, we assume two bitcoin-like blockchains. Frank has 10 Bitcoin he wants to trade for 50 Litecoin. Maria has the 50 Litecoin and agrees to the exchange.
Cross-chain atomic swaps
First, Maria gives the bitcoin address MB, to which she wants the bitcoin. Now Frank hashes a random value x and gets its hash h. Next, Frank sends his 10 bitcoin to a special bitcoin address. This address has the information MB, h and Frank’s bitcoin address from where the bitcoin came and the following conditions:
MB can get the bitcoins if it knows x or Frank can get the bitcoins if, for example, if 24 hours have passed.
Now Frank passes on this special Bitcoin address to Maria, on which he would like to have the Litecoins. Maria checks if the bitcoins are on and the withdrawal conditions are ok. If everything fits, she moves on the Litecoins. She sends the 50 Litecoins to a special Litecoin address. This Litecoin address has FL, h and Maria’s Litecoin address as information. h knows Maria from the special bitcoin address on which Franks store 10 BTC, which is visible on the blockchain. The address has the conditions:
FL can get the litecoins if he knows x or Maria can get the litecoins if 12 (<-play time) hours have passed. All these conditions can represent Bitcoin via the OP codes on-chain.
Scenario 1: Swap will be cashed
Frank checks if the conditions on the Litecoin-blockchain are set correctly and gets the 50 Litecoins with his x. He releases x, it is then in the transaction on the Bitcoin-blockchain. Maria recognizes the x and takes it for the retrieval of bitcoins. The Atomic Swap is complete.
Scenario 2: Time is running out
Something goes wrong with Maria or Frank and Frank can not redeem the swap. After the 12 hours have elapsed, Maria can get her litecoins back from the special address. Frank has to wait another 12 hours longer.
These types of addresses are also called HTLC for Hashed Timelocked Contract, so-called timed lock contract, because you have access to it either with the hash input or after a certain amount of time. It is important that in our example more time must pass for Frank until he can access his bitcoins than for Maria, because he has the key x. He could wait until the expiration date of his time-lock has ended, then get his Bitcoins and Maria’s Litecoin.
See, not all cryptocurrency exchanges back every coin. As such, a trader envying to exchange coin for another one that is not maintained on the prevailing exchange may require to transfer accounts or compose various exchanges between central coins to achieve the goal. There is also affiliated counterparty jeopardy if the trader wants to exchange coins with another trader.
Atomic swaps resolve this dilemma through the application of Hash Timelock Contracts (HTLC). As its signature indicates, HTLC is a time-bound smart contract between individuals that includes the peers of a cryptographic hash function, which can be confirmed between them.
Pros and Cons of Atomic Swaps
With atomic swaps, cross-block token trading can be achieved decentrally. Decentralization gives general benefits. Since every trading party never gives their keys out of hand, the whole thing is pretty safe from hacks. Governments can not stop trading, as with a central exchange such as Atomic Swaps, usually, cost only the transaction fees on the Blockchain. Two transactions are performed per blockchain.
The latencies depend on the block time of the blockchains. For example, an Atomic Swap on Bitcoin can take up to 10 minutes or more. There are different ways to counter this. The blockchains must have some degree of programmability, bitcoin OP codes are sufficient.
Komodo, a project that uses Atomic Swaps
Although the idea was developed in 2013, the first decentralized DEX was only operational in early 2018. The pioneering work has been done by Komodo with its BarterDEX. BarterDEX has an integrated distributed order book. Of course, the process of the atomic swap is taken over completely automatically by the software. Unfortunately, the trading volume is as good as 0. Due to the usual problems, such as the latencies, the traders prefer to move to central crypto exchanges.
Atomic swaps are a promising model for decentralized sales. Unfortunately, development is still in its infancy, yet experts expect that this technology in the future in a networked blockchain world will play a major role. They are the key to interblock communication, the link between technologies, making the last central instance superfluous.
Atomic Swaps are just a portion of the solution for the exchange quandary. We also require Decentralized Exchanges: exchanges not controlled by an individual person but by a system, thereby stopping unique cases of failure.
Disclaimer: This information should not be interpreted as an endorsement of any cryptocurrency. It is not a recommendation to trade. The crypto market is full of surprises and overhyped assets. Do your research before buying anything. Do not invest more than you can afford to lose.
Follow us on Twitter, Facebook, Steemit, and join our Telegram channel for the latest blockchain and cryptocurrency news.
Ripple Price Prediction – How High will XRP reach in 2050?
Lending Cryptos, the Opportunities
John McAfee Announces New Privacy Coin ‘GHOST’
Ripple Price Prediction – How High will XRP Reach in 2025?
ERC-1155: A new token standard aimed to disrupt the video-game industry
Cryptocurrency ABC – The Crypto Dictionary
Best Tezos Wallets For 2022
Lightning Network Capacity Grows Nearly 300% in Ten Days
The Big Ripple Price Prediction for 2023 – How high can the XRP price go in 2023?
Shiba Inu to Reach 1$ soon? This New Upcoming Development Proves it Right
Paying with Crypto: An Introduction To Litecoin
Bitcoin derivatives offered by another US-based Company
Cardano Basho: When is the next big Cardano update coming?
Litecoin Founder Sells All His Litecoins
You might also like
More from Education
The Future of Cryptocurrencies: Unveiling a New Economic Landscape
The future of cryptocurrencies promises to revolutionize the economic landscape. This article delves into potential regulation, the benefits and challenges …
Top 10 BRC-20 Tokens on Bitcoin
These tokens are gaining popularity in the crypto world due to their unique features and benefits. Here are the top …
Understanding Asian Crypto Law and Its Impact on Tokens
As the Asia Crypto Law is set to take effect from June 1st, 2023, Hong Kong prepares to become a …