Amidst the growth of decentralized financial (DeFi) applications, we’d like to take you through a particular class of DeFi applications — specifically decentralized exchanges, also known as DEXs.
DEXs are made possible through programs that run on the blockchain, known as smart contracts, and developing systems that perform trades through these smart contracts resulting in an exchange that is as secure as the blockchain it runs on. However, not all exchanges are built equally, and different trade-offs have been made in the design of the various DEXs in the market today.
Fully On-Chain DEXs
These are DEXs that have all their operations, including the order book, order matching, and trade settlements performed entirely on the blockchain. An example of such an exchange is EtherDelta.
The performance of completely on-chain DEXs is heavily reliant on its native blockchain. On-chain DEXs are only able to execute transactions and update their order book as fast as the blockchain’s block generation time. This means that traders will have to wait for a few seconds, up to several minutes for their next trade to be executed and settled to the blockchain. Since all new orders and modifications go through the blockchain, traders are also required to pay network fees for placing and canceling orders.
DEXs with Off-Chain Relayers
Instead of having the order book and order matching fully on-chain, projects built with the idea of “relayers” allow for a distributed order book not stored on the blockchain.
An example of this is the 0x protocol — where any person, company, or organization can become a relayer to accept orders and build their order book. Any orders within these order books are of a standardized format and can be shared easily between relayers. In this way, without storing orders on the blockchain, the order books are distributed and in a way, decentralized.
The benefit of DEXs built using this model is that it allows for instantaneous order creations since orders are submitted to a single relayer instead of the blockchain.
However, trade settlements still occur on the blockchain, and placing a series of orders will require similar waiting times as a fully on-chain DEX. For example, suppose a user wants to trade 5 ETH for 1000 DAI, and then 1000 DAI for 1000 USDC. A user will have to wait a few minutes for the first order to be completed before the next order can be placed.
Unlike DEXs with a distributed order book, hybrid DEXs such as IDEX and Switcheo have a single off-chain order book. This may seem like a disadvantage when compared to distributed order books since only one company can host the order book. However, it comes with an attractive benefit of allowing instantaneous trading.
Using the previous example, a user can place an order of 5 ETH for 1000 DAI and immediately receive 1000 DAI, which he can then use to trade for 1000 USDC without having to experience any waiting times.
This is possible because a single order book does not suffer from synchronization issues that are present with distributed order books, allowing hybrid DEXs to safely confirm trades ahead of time. The challenging obstacle for these DEXs is ensuring that the trades will eventually settle in the correct sequence on the blockchain. To achieve instantaneous trading with the security of a DEX, such DEXs must develop well-engineered and thoroughly tested scheduling systems.
A Comparison of DEXs
As an overview, the table below summarizes the differences between some of the DEXs in the market today. Essentially, all DEXs feature on-chain settlements — a necessary element to eliminate the need to trust a central entity.
A Note on Interoperability
Building a DEX is technically challenging because of the demands of creating secure smart contracts and systems which interact seamlessly with those contracts. Once all the work is done, a limitation of DEXs is that they are still constrained to the blockchain they are built on, e.g., an Ethereum DEX can only allow trading of Ethereum and ERC-20 tokens. Switcheo has made a breakthrough in this aspect by creating a DEX that operates on the Ethereum, NEO, and EOS blockchains, featuring cross-chain trading through Atomic Swaps.
Switcheo users are our priority. Since the time of inception, we have sought to build upon a niche that hasn’t been entirely addressed — a highly performant DEX with world-class user experience.
For more information on Switcheo: