{"id":37216,"date":"2018-08-03T05:19:58","date_gmt":"2018-08-03T02:19:58","guid":{"rendered":"https:\/\/forklog.com\/en\/?p=37216"},"modified":"2025-08-29T13:57:20","modified_gmt":"2025-08-29T10:57:20","slug":"what-are-atomic-swaps","status":"publish","type":"post","link":"https:\/\/forklog.com\/en\/what-are-atomic-swaps\/","title":{"rendered":"What are atomic swaps?"},"content":{"rendered":"<div id=\"cards_wrapper\">\n<div class=\"single_card\">\n<p id=\"card_counter_1\" class=\"card_counter\"><span class=\"card_counter_span\">1<\/span><\/p>\n<p><strong>What are atomic swaps?<\/strong><\/p>\n<div class=\"card_description\">\n<p>An atomic swap is an exchange of one cryptocurrency for another that can be executed instantly without relying on a trusted third party such as an exchange or swapping platform. Control over the trade rests solely with the counterparties.<\/p>\n<p>Atomic swaps can occur on-chain, meaning directly between the blockchains of different cryptocurrencies, or off-chain \u2014 outside the <a href=\"https:\/\/forklog.com\/en\/news\/what-is-blockchain-2\">blockchain<\/a>. The first such exchange <a href=\"https:\/\/twitter.com\/decredproject\/status\/910224860625780736\" target=\"_blank\" rel=\"noopener noreferrer\">was carried out<\/a> on 19 September 2017 between Decred and Litecoin.<\/p>\n<\/div>\n<\/div>\n<div class=\"single_card\">\n<p id=\"card_counter_2\" class=\"card_counter\"><span class=\"card_counter_span\">2<\/span><\/p>\n<p><strong>Why are atomic swaps needed?<\/strong><\/p>\n<div class=\"card_description\">\n<p>Exchanging cryptocurrencies on exchanges and other specialised platforms can still be time-consuming and is often associated with hefty fees. Moreover, not all <a href=\"https:\/\/forklog.com\/en\/news\/how-to-choose-a-cryptocurrency-exchange\">exchanges<\/a> support every coin or the required trading pairs, forcing traders who want to swap one asset for another into additional conversions.<\/p>\n<p>Atomic swaps were designed to address these problems, including the risks of relying on a third party. The idea was first described <a href=\"https:\/\/bitcointalk.org\/index.php?topic=193281.msg2003765#msg2003765\" target=\"_blank\" rel=\"noopener noreferrer\">in 2013<\/a>, but only recently began to be implemented in practice.<\/p>\n<\/div>\n<\/div>\n<div class=\"single_card\">\n<p id=\"card_counter_3\" class=\"card_counter\"><span class=\"card_counter_span\">3<\/span><\/p>\n<p><strong>How does it work technically?<\/strong><\/p>\n<div class=\"card_description\">\n<p>Atomic swaps use a hashed timelock contract (<a href=\"https:\/\/en.bitcoin.it\/wiki\/Hashed_Timelock_Contracts\" target=\"_blank\" rel=\"noopener noreferrer\">HTLC<\/a>). As the name suggests, an HTLC is a time-bound <a href=\"https:\/\/forklog.com\/en\/news\/what-is-a-smart-contract\">smart contract<\/a> that involves generating a cryptographic hash that can be verified by the parties to the exchange.<\/p>\n<p>In other words, an HTLC requires the recipient to confirm receipt of funds before a set deadline by producing cryptographic proof of payment. Otherwise, the transaction is void and the funds return to the sender.<\/p>\n<\/div>\n<\/div>\n<div class=\"single_card\">\n<p id=\"card_counter_4\" class=\"card_counter\"><span class=\"card_counter_span\">4<\/span><\/p>\n<p><strong>How does it work in practice?<\/strong><\/p>\n<div class=\"card_description\">\n<p>Alice has 100 LTC she wants to exchange for the equivalent amount of BTC. Traditionally, Alice would go to an exchange, fund her account and place a sell order for her LTC. With an atomic swap, Alice can exchange her LTC directly for Bob\u2019s BTC.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-54099\" src=\"https:\/\/forklog.com\/wp-content\/uploads\/atomicswap-diagram.jpg\" alt=\"\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0435 \u0441\u0432\u043e\u043f\u044b?\" width=\"820\" height=\"460\" srcset=\"https:\/\/forklog.com\/wp-content\/uploads\/atomicswap-diagram.jpg 1200w, https:\/\/forklog.com\/wp-content\/uploads\/atomicswap-diagram-300x168.jpg 300w, https:\/\/forklog.com\/wp-content\/uploads\/atomicswap-diagram-768x431.jpg 768w, https:\/\/forklog.com\/wp-content\/uploads\/atomicswap-diagram-1024x574.jpg 1024w, https:\/\/forklog.com\/wp-content\/uploads\/atomicswap-diagram-470x264.jpg 470w\" sizes=\"auto, (max-width: 820px) 100vw, 820px\" \/><\/p>\n<p>As the initiator, Alice creates a contract address akin to a safe-deposit box. It holds Alice\u2019s LTC during the swap. Opening it requires Bob\u2019s signature and a number generated by Alice. It is crucial that Alice not share this number at this stage, as Bob could otherwise open the box and take the funds before the swap completes.<\/p>\n<p>Next, Alice chooses a secret number and creates its hash. The hash acts as a lock, while the secret number is the key. Bob reviews the contract address from Alice, ensures everything is in order, then creates his own box with the same key. To do this, Alice sends Bob the previously created hash; to open the box, he needs Alice\u2019s signature.<\/p>\n<p>From that moment, Alice holds the key and can sign Bob\u2019s box and thus redeem the funds tied to the address. Bob then receives the secret number, which he did not know until that point. He can use it to open Alice\u2019s box and take the funds due to him.<\/p>\n<p>As is clear, HTLCs structure the transaction so that each side depends on the other for successful completion. The transactions are crafted so that, if for any reason the deal is halted, all funds are returned to their owners after a period specified by each party.<\/p>\n<\/div>\n<\/div>\n<div class=\"single_card\">\n<p id=\"card_counter_5\" class=\"card_counter\"><span class=\"card_counter_span\">5<\/span><\/p>\n<p><strong>Is the Lightning Network required for atomic swaps? <\/strong><\/p>\n<div class=\"card_description\">\n<p>Contrary to a common misconception, the Lightning Network is not a prerequisite for atomic swaps, though it can make the process simpler, faster and more efficient.<\/p>\n<p>Like atomic swaps, the Lightning Network uses hashed timelock contracts; the difference is that atomic swaps connect blockchains, whereas Lightning connects payment channels. In this method, Alice and Bob open payment channels with Carol and carry out the exchange through Carol without needing to trust her.<\/p>\n<p>The shared underlying mechanism means integrating the Lightning Network with atomic swaps is straightforward, allowing different Lightning networks on separate blockchains to interconnect. A participant who opens payment channels on both blockchains can act as a payment processor or, for example, a decentralised altcoin exchange.<\/p>\n<\/div>\n<\/div>\n<div class=\"single_card\">\n<p id=\"card_counter_6\" class=\"card_counter\"><span class=\"card_counter_span\">6<\/span><\/p>\n<p><strong>What is the difference between on-chain and off-chain swaps?<\/strong><\/p>\n<div class=\"card_description\">\n<p>On-chain atomic swaps occur directly on the blockchains of the cryptocurrencies being exchanged; for a successful swap, besides supporting HTLCs, they must also use the same hashing algorithm.<\/p>\n<p>Off-chain atomic swaps allow coins to be exchanged outside the blockchain and are an extension of the Lightning Network.<\/p>\n<\/div>\n<\/div>\n<div class=\"single_card\">\n<p id=\"card_counter_7\" class=\"card_counter\"><span class=\"card_counter_span\">7<\/span><\/p>\n<p><strong>Which cryptocurrencies support atomic swaps?<\/strong><\/p>\n<div class=\"card_description\">\n<p>The first successful exchanges using atomic swaps were conducted between Litecoin and Decred, and between Vertcoin and Bitcoin. These drew attention, but the approach is not limited to those assets.<\/p>\n<p>Note that, in the initial implementation, users had to download the blockchains of both currencies to perform atomic swaps. For the average user, this is impractical from both a practical and technical standpoint.<\/p>\n<p>However, a solution has been found and may soon be available to a broader audience. The Komodo project is developing its decentralised exchange, BarterDEX. Its developers have successfully executed an atomic swap via an Electrum server, which enables interaction with a cryptocurrency without downloading the entire blockchain.<\/p>\n<p>Moreover, the Komodo team <a href=\"https:\/\/komodoplatform.com\/komodo-now-covers-atomic-swaps-between-95-of-all-coins-in-existence\/\" target=\"_blank\" rel=\"noopener noreferrer\">claims<\/a> that, after linking the Bitcoin and Ethereum blockchains and implementing support for ERC-20 tokens, BarterDEX now supports p2p swaps between 95% of all existing coins and tokens.<\/p>\n<p>Other notable projects actively working on practical implementations include Blocknet, which aims to create an internet of blockchains based on the Xbridge technology; Altcoin.io, which is developing a decentralised exchange using Plasma and a wallet with built-in atomic swap functions; and <a href=\"https:\/\/atomicwallet.io\/\" target=\"_blank\" rel=\"noopener noreferrer\">Atomic Wallet<\/a>.<\/p>\n<p>To track how close a given cryptocurrency is to supporting atomic swaps with another asset, a resource such as <a href=\"https:\/\/swapready.net\/\" target=\"_blank\" rel=\"noopener noreferrer\">swapready.net.<\/a> can help.<\/p>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>An explainer on atomic swaps \u2014 direct, trustless exchanges between cryptocurrencies using HTLCs, available on-chain or off-chain. It covers the technical mechanics, a step-by-step example, the Lightning Network\u2019s role, the on-chain versus off-chain distinction, early demonstrations, and projects working on implementations such as Komodo\u2019s BarterDEX.<\/p>\n","protected":false},"author":1,"featured_media":37217,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"select":"1","news_style_id":"1","cryptorium_level":"","_short_excerpt_text":"A concise guide to atomic swaps: how they work, Lightning\u2019s role, and which projects support them.","creation_source":"human_written","_metatest_mainpost_news_update":false,"footnotes":""},"categories":[2113],"tags":[2119,2118,1677,787],"class_list":["post-37216","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cryptorium","tag-101-defi","tag-101-trading-and-investing","tag-atomic-swaps","tag-dex"],"aioseo_notices":[],"amp_enabled":true,"views":"56","promo_type":"1","layout_type":"1","short_excerpt":"A concise guide to atomic swaps: how they work, Lightning\u2019s role, and which projects support them.","is_update":"","_links":{"self":[{"href":"https:\/\/forklog.com\/en\/wp-json\/wp\/v2\/posts\/37216","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/forklog.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/forklog.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/forklog.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/forklog.com\/en\/wp-json\/wp\/v2\/comments?post=37216"}],"version-history":[{"count":1,"href":"https:\/\/forklog.com\/en\/wp-json\/wp\/v2\/posts\/37216\/revisions"}],"predecessor-version":[{"id":37218,"href":"https:\/\/forklog.com\/en\/wp-json\/wp\/v2\/posts\/37216\/revisions\/37218"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/forklog.com\/en\/wp-json\/wp\/v2\/media\/37217"}],"wp:attachment":[{"href":"https:\/\/forklog.com\/en\/wp-json\/wp\/v2\/media?parent=37216"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/forklog.com\/en\/wp-json\/wp\/v2\/categories?post=37216"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/forklog.com\/en\/wp-json\/wp\/v2\/tags?post=37216"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}