The transfer of cryptocurrency from one party to another, without the use of an exchange or other intermediary.
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 for decentralized exchanges.
Atomic swaps offer a more decentralized alternative to trading on Automated Market Maker (AMM) DEXs like Uniswap, which rely upon centralized liquidity pools. AtomicDEX, one of the most popular atomic swap-powered DEXs, provides a true peer-to-peer order book system for crypto trading.
Atomic swaps are based on hash timelock contracts (HTLC). Every HTLC 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.
Atomic swaps are designed in such a manner that when a swap takes place, either 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”). Atomic swaps make digital asset trading as secure as it can possibly be..
In an example scenario, Party A creates an HTLC address and deposits their cryptocurrency. This creates a passcode, 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 across different blockchains with different native coins. Atomic swap technology is protocol agnostic, meaning it’s possible to swap assets like Bitcoin for Ethereum without having to trust the security of a wrapped token or centralized exchange. Off-chain atomic swaps offer significantly improved transaction speeds, but they have not yet been fully developed.
Author: Kadan Stadelmann, CTO of Komodo
Kadan Stadelmann is a blockchain developer, operations security expert, and Chief Technology Officer of Komodo, an open-source technology provider that offers all-in-one blockchain solutions for developers and businesses. Komodo works closely with organizations that want to launch their own custom decentralized exchanges, DeFi platforms, and independent blockchains. Its flagship technology and end-user application is AtomicDEX - a mobile and web-compatible non-custodial multi-coin wallet and atomic swap-powered DEX rolled into one dApp. Kadan strongly identifies with Komodo’s open-source vision and ideology. His dedication to the Komodo project is founded on an unwavering desire to make the world a better place. In addition to cryptography, blockchain technology, and development, Kadan is interested in literature, mathematics, astrophysics, and traveling.
© 2021 COINCU Financial Group Inc. Address: Road Town, Tortola, British Virgin Islands (BVI).
Email us: [email protected]