Mục lục

What is an atomic swap?

Share on facebook
Share on twitter
Share on linkedin
Share on telegram
Share on email
Share on reddit

Atomic Swap

The transfer of cryptocurrency from one party to another, without the use of an exchange or other intermediary.

What is an atomic swap?

Traditionally, in order to buy or sell a cryptocurrency, a user is required to use a centralized exchange. This arrangement has several drawbacks: both parties must find an exchange they trust, exchanges often suffer downtime during periods of high demand, and exchanges are subject to state oversight.

By contrast, an atomic swap enables direct wallet-to-wallet trading between two peers, using a specially designed smart contract in place of an exchange.

Atomic swaps are based on hash timelock contracts (HTCLs). Every HTCL includes a HashLock, which can be used to lock and unlock the deposited currency with a key available only to the depositor, and a TimeLock, which automatically returns funds to the depositor if the transaction is not completed within a set timeframe.

In an example scenario, Party A creates an HTCL address and deposits their cryptocurrency. A passcode is then created, along with a hash of that code. Party A sends the hash to Party B, who uses it to generate an address. Party B deposits their cryptocurrency with that address. Because Party A has the passcode used to generate the hash, they can access the coins deposited by Party B.

At this point, the contract sends the passcode to Party B, who uses it to access the coins deposited by Party A. If the contracts are not signed within the specified timeframe, both deposits are automatically returned to the relevant depositor.

Atomic swaps can be used to trade on-chain between different blockchains with different native coins, or off-chain using offshoots of the main blockchains in question. Off-chain atomic swaps offer significantly improved transaction speeds, but they have not yet been fully developed.

Share on facebook
Share on twitter
Share on linkedin
Share on telegram
Share on email
Share on reddit

– Quảng cáo –
Mua ngay Kindle  – máy đọc sách thông minh cho bạn và con bạn nhé!