On October 16 this year, OKEx, one of the largest crypto exchanges in the world, suspended all cryptocurrency withdrawals after one of its keyholders Star Xu was being investigated by the public security bureau in China. It exposes one of the key weaknesses of centralized exchanges — that users are not in control of their private keys and cryptocurrency holdings.
It is an irony for the crypto industry, which prides itself on its decentralization ethos, to be dominated by centralized exchanges. The custodian of funds and processing of transactions on behalf of users has led to many problems, including costly fees, delays, security, and regulatory risks. It is easy to find many more examples of risky scenarios such as that of disabling withdrawals at OKEx, fraud at QuadrigaCX, and the hack at Kucoin.
These disasters prompted the accelerated interest in decentralized exchanges (DEXs). While there are many aspects of decentralization, the most important ones are that users control their cryptocurrencies, and transactions are conducted in a peer-to-peer manner without the need for a central authority or trusted third party.
One of the ways a DEX achieves this is through a mechanism called an atomic swap. Imagine for a minute how two people, we’ll call them John and Jane, can exchange BTC/ETH, in a typical custodial swap using an escrow service called “ACME”. John and Jane would each deposit BTC and ETH, respectively with ACME. ACME then checks that both parties have deposited the correct amount and then releases the funds to the respective recipients. This service is subject to a fee from the escrow service. Not only that, but there are also custodial and fraud risks when using such an escrow service.
Atomic swaps remove these problems by deploying a dual escrow contract mechanism across two chains. In our example, John will send BTC to its automated escrow contract on the BTC chain, while Jane will send ETH to a similar mechanism on the ETH chain. After both escrow contracts check the receipt of funds, they will confirm with one another and then send the funds to the intended recipients.
If either one or both parties fail to deploy funds to their respective escrow contracts within a predetermined amount of time, any fund that is deployed into any escrow will be returned. This is achieved through programmatic escrows called Hash Time-Locked Contracts (HTLC). We don’t need to go into the technical details of HTLC. It is sufficient to know that John and Jane can utilize this dual escrow contract mechanism to swap cryptocurrencies between them without going through an intermediary or a trusted third party. In this way, they can avoid paying extra fees or being exposed to custodial risks.
For more information, please visit our website.
Join our Telegram and community conversations or say hi to us at any of the channels below: