Cross-chain atomic swaps, more commonly known as ‘atomic swaps’, are cryptographically-powered smart contracts that enable the trading of two cryptocurrencies on a peer-to-peer basis without the need of a trusted third party and without the risk of one party defaulting on their side of the trade.
If two individuals want to exchange, for example, bitcoin for ether without the use of a centralized exchange, an exchange rate would be agreed and person A would send BTC directly to person B, while person B would send ETH to person A.
However, as cryptocurrency transaction as irreversible, person A is at a disadvantage if they send their coins first as there is no certainty that person B will also send their coins. Hence, for the decentralized peer-to-peer trading to work across blockchains, there needs to be a mechanism that enables this that ensures neither person A nor B could renege on their side of the transaction. In cross-chain atomic swaps, hash-time locked contracts fulfill this function.
A hash-time locked contract (HTLC) is a smart contract that ensures that an atomic swap can be conducted in a trustless manner through the use of cryptography. The HTLC requires the recipient of the payment to acknowledge having received the payment ahead of a deadline by generating a cryptographic proof of the payment. If the recipient does not do that they will lose the rights to the claim to the payment and, thus, return the payment to the sender.
This ensures that if one side of the transaction does not stick to their end of the bargain, the other side receives their coins back and the exchange does not occur.
Person A and B need to submit their transactions on their two respective blockchains. For person A to claim their coins, they will need to produce a number that only they know, which is used to generate a cryptographic hash, that provides proof of payment. Similarly, person B must provide the same number that was used to generate the hash in order to claim the payment for their side of the transaction.
It is important to note that atomic swaps cannot be conducted across all cryptocurrencies. To perform cross-chain atomic swaps, the two cryptocurrencies need the Lightning Network and are required to have compatible cryptographic hash functions. This is necessary for the hash-time locked contract (HTLC) to function correctly.
The first ever cross-chain atomic swap was processed between Decred and Litecoin in September 2017. Two months later, in November 2017, Lightning Labs announced that it had managed to complete the first atomic swap between Bitcoin and Litecoin.
Are exchanges under threat from atomic swaps innovation?
Bitcoin developer Jameson Lopp tweeted at the beginning of the year: “Nearly instant atomic swaps via Lightning Network are coming sooner than everyone thinks. Definitely not a year away, but mere months,” which suggests that exchanges may come under threat from this new form of trading sooner rather than later.
Experienced cryptocurrency users, who for the most part prefer to avoid the use of centralized exchanges, are expected to jump onto the opportunity to avoid centralized third parties to conduct their trading. This trend can already be witnessed by the increase in trading volumes of decentralized exchanges that use smart contracts to power trade execution.
Should atomic swaps become a widely accepted way to convert cryptocurrencies as Lightning Network implementation grows among blockchain projects, it would not be a surprise to see trading activities move away from centralized exchanges — that are under constant threat of hacks — and move towards cross-chain atomic swaps.
The importance of the ‘user experience’
While cross-chain atomic swaps do pose a potential threat to digital asset exchanges it is unlikely that we will witness the disappearance of exchanges any time soon, as they do provide several value-add services that should help them retain customers.
Exchanges are generally very user-friendly and make it as easy as possible for beginners to buy and sell digital assets. Investors require little technical knowledge to sign up to an exchange, fill out the KYC forms and start trading cryptographic assets. For investors who are used to trading on online retail brokerages, crypto exchanges are the logical avenue for making crypto investments. Conducting cross-chain atomic swaps, on the other hand, requires substantially more technical knowledge.
Furthermore, digital asset exchanges offer extra features such as charting tools, a visible orderbook, chat boxes, trade reporting tools and support desks. Investors appreciate these features as they can help them to make their trading decisions and better manage their investments and post-trade reporting for tax purposes. For these extra services, most investors are happy to pay the exchange’s fees.
Additionally, cross-chain atomic swaps are not possible for fiat currency so for investors who want to purchase digital assets using fiat currency, exchanges will still be necessary.
Finally, as it requires widespread Lightning Network adoption to function, atomic swap technology still has a long way to go before it could present a genuine threat to the status quo. Exchange operators should not be complacent, however, as although they do have first-mover advantage, the atomic swap sector is still only months old — and continues to innovate rapidly.