The advancement in crypto trading platforms has seen a surge in cryptocurrency trading. Some time back, the crypto market was made up of only centralized exchanges (CEX). CEXs are susceptible to security breaches, which saw users lose their funds via hacking attacks. Decentralized exchanges (DEX) were then launched, providing a better trading environment that allows users to retain control, custody, and security over their funds.
But even with the launch of DEX platforms, crypto trading is still cumbersome thanks to the lack of interoperability between blockchains networks. Different blockchain networks’ existence makes it difficult for traders to trade, especially when using different blockchain platforms. They often have to create different accounts on multiple exchanges so they can trade across different blockchain networks. Alternatively, traders may need to use a centralized exchange to swap two tokens issued on different blockchains, exposing them to security exchanges.
Cross-chain trading, also referred to as atomic cross-chain trading, promises to solve the lack of blockchain interoperability. We can seamlessly exchange value with atomic swaps between different blockchains like Bitcoin and Ethereum directly from a decentralized exchange. Here, we look at the benefits of cross-chain trading, looking at Block DX’s atomic swaps.
Atomic Cross-Chain Trading Explained
The atomic swap was first introduced in 2013 on the BitcoinTalk forums by Noel Tiernan. Tiernan outlined the fundamentals of cross-chain trading using simple cryptocurrency trades across different chains. In April 2017, Blocknet co-founder Arlyn Culwick announced a successful atomic swap between Litecoin and Bitcoin, bringing to life the concept of atomic swaps. Later that year, Litecoin founder, Charlie Lee announced a second atomic swap.
Ever since then, numerous DEXes have adopted the concept of the atomic swap. The invention offers a seamless way of exchanging cryptos regardless of the blockchain network. An essential aspect of this technology is that it facilitates peer to peer exchanges of cryptocurrencies and greatly enhances the decentralization and trustlessness of crypto exchanges.
There are two different types of atomic swaps, i.e., on-chain and off-chain. On-chain atomic exchange is processed on the blockchain while off-chain is processed via a second network layer, e.g., Lightning in Bitcoin network. For an on-chain swap to occur, both cryptocurrencies must use the same hashing algorithm and support hash time-locked contracts.
How Does Cross-Chain Trading Work?
As mentioned earlier, cross-chain protocols (atomic swaps) allow users to exchange cryptocurrencies between two different blockchains without the need for a third party. To facilitate two trustless parties to exchange coins or tokens, atomic swaps leverage hash timelock contract (HTLC). HTLC is essentially a kind of smart contract technology, which binds two trustless parties to exchange tokens without a central authority.
An HTLC contract functions like a temporary escrow which locks up funds of both parties – except that no third party escrow service is required. As they swap their coins, both parties create and broadcast transactions in a specific order. As such, they either end up with each others’ coins, or no swap takes place at all (this is what “atomic” means – no outcome can result in one party ending up keeping their coins while also receiving the counterparty’s coins).
If, for instance, one party fails to perform a certain action within the given period, the swap is canceled. The swap only occurs when the protocol is followed correctly – and if followed correctly, it guarantees a fair outcome “trustlessly,” that is, regardless of the intentions of the participants.
HTLC requires two special cryptographic locks to open, i.e., a hash lock and a timelock. The hash lock is proof that participants must present to complete tokens’ swap. The timelock key is a safety mechanism that ensures traders receive their cryptos back if a transaction is not complete within the stipulated time.
To conduct a cross-chain transaction, the following steps are involved:
- The first party creates a secret code, i.e. a preimage, and uses it to create an HTLC contract containing his/her coins.
- The contract is forwarded to a second party, who then verifies that the trade capital has been deposited. A hash of the preimage is also supplied to the second party.
- The second party then deposits their tokens into a new HTLC contract created with the same hash.
- The first party unlocks the tokens deposited by the second party using the preimage since it hashes to the hash used in the second party’s contract. This reveals the preimage publicly.
- The second part sees the preimage and then unlocks the token in the first party’s HTLC to complete the atomic swap.
Advantages of Cross-Chain Trading
As you can expect, cross-chain trading comes with several benefits. Atomic swaps offer a solution to the shortcomings of centralized exchanges that control the private keys of users. Some of the benefits of cross-chain trading include:
Facilitates Truly Decentralized Crypto Trading
Cross-chain trading offers a seamless way of exchanging digital assets without the need for third-party governance. Thanks to atomic swaps, traders can effectively exchange tokens between several blockchains without encountering interoperability issues.
Lowers Trading Risk
Atomic swaps give token holders complete control of their cryptocurrencies at all times. Holders are the sole holders of their private keys thus have full control over their digital assets. This eliminates the risk that comes with centralized exchanges, including security breaches.
Simplifies Crypto Trading
Cross-chain trading eliminates the bottlenecks experienced in crypto trading. It makes it possible for crypto traders to store all their digital assets in a common wallet instead of different wallets for each blockchain network. Also, cross-chain trading enhances crypto exchange time and reduces liquidity risk. Faster transaction time, coupled with interoperability is crucial for mainstream crypto adoption.