Efficient Execution: Surveying the DEX Landscape

All decentralized exchanges share the same fundamental function: to enable wallet-to-wallet trading in a trustless way. Also known as an atomic swap, this model pushes two-party transactions through a smart contract to the blockchain to settle. Decentralized trading protocols, like the 0x Project, AirSwap protocol and Kyber Network, all use atomic swaps to facilitate trading — but it’s how traders find each other and how exchanges manage orders that vary considerably. This is a crucial point left up to DEXs, and we would argue that current design decisions limit the ecosystem’s ability to serve potential customers of all backgrounds, from retail and algorithmic traders to institutions and dApps.

We want to build a decentralized trading platform for a decentralized world. As a part of this mission, we need a best-in-class execution experience for all types of users. But what exactly does ‘best’ mean in this scope? Some questions to consider include:

The answers to these questions drive how efficient execution is on any exchange. And we’ve seen a number of different solutions in the DEX world, which we discuss in detail below. For the purposes of this article, we’ll be focusing on decentralized exchanges that use the Ethereum blockchain as the settlement layer and allow trading of ERC20 tokens.

Getting the best deal

Peer-to-peer exchanges like AirSwap are interesting in the sense that they resemble a traditional marketplace or bazaar. Orders are collected off-chain, counterparties are found, and trades are negotiated in real-time in private. Once a price is locked in, a smart contract handles the atomic swap and the traders go on their merry way. But while P2P is potentially simpler and more familiar than other DEX infrastructures, it’s important to note the costs of this trading model.

Just like any other bartering system, both traders must be present on the platform at the same time to negotiate. This poses a few problems for many different types of users, ranging from casual traders with not much time to seasoned professionals with an arsenal of automated trading bots. Furthermore, price negotiation doesn’t always mean you get the best deal. Without a ledger of prices to cross-reference, buying and selling gets a little bit stickier and more time-consuming. Two trades of the same token can occur at wildly different prices even at the same time. This is a model that simply doesn’t exist in traditional financial markets today. Trading floors instead operate on auction mechanisms which are efficient at identifying prices for liquid and illiquid products. How a peer-to-peer model might operate at scale remains uncertain.

More users, more problems

Unlike a pure peer-to-peer negotiated system, DEXs that use the 0x protocol manage an order book according to either an ‘open’ model or a ‘matching’ strategy. On an open order book platform like Radar Relay, users place orders as usual, but the smart contracts that facilitate trading are ‘open’ to be signed by anyone. In other words, anyone can reach for an order and take it to the chain to be settled. In an ideal world, this model would work efficiently and elegantly, and there would be no need for an organizing force. But these systems don’t always work out in the wild.

In the real world, especially one where the underlying blockchain settlement layers are still evolving, an open order book system can be prone to errors and mishaps. Accidental collisions — when many traders reach for the same order simultaneously, and orders are filled or canceled at the same time — are named innocuously but quickly result in double-gas spending and unhappy users. For deliberate market manipulation, like front-running, it can be as easy as dialing your gas prices up to prioritize your transaction and censor other trades. As these issues relate to time and activity, scalability problems only stack up as more and more users join the platform. Without a solid infrastructure, it’s difficult to envision millions of traders on open order book DEXs making consistent, successful trades.

Speed wins

At the other end of the spectrum, 0x relayers like Paradex (and us) employ a matching strategy that marries a traditional order book look and feel to the DEX experience. DEXs with an off-chain order book, in theory, can replicate the speed, performance, and transparency of order books on traditional asset exchanges. We think mirroring is critical to adoption — the more unusual mechanisms added to the trading experience, the less likely DEXs are to be widely adopted. And unlike open order books, front-running is eliminated as the relayer only pushes orders to the blockchain once the two parties have signed off on the smart contract.

But even with matching systems, there are key design decisions and engineering challenges that need to be solved to ensure that blockchain-based settlement occurs with minimal cost and maximum reliability. For example, most relayers do not allow what we would call ‘true’ market orders: the ability to immediately buy all the tokens you need at the best possible price and with minimal gas costs. When you’re running algorithmic or high-frequency strategies, knowing all your costs upfront is critically important — which is why we are not huge fans of price rebates of other ‘adjustments’ post-settlement. If the goal of the DEX world is to replicate the performance of traditional asset exchanges in a trustless way, that should mean embodying the looks, feel, and function of the fastest professional trading systems in the world.

Simpler solutions to complex problems

A bottleneck to the DEX experience is the speed of settlement of the underlying chain. In times of a CryptoKitties surge, it might be hard for DEX systems to settle trades. To solve that problem, IDEX (now one of the more popular DEXs) introduces an ‘arbiter’ to sit between their execution engine and settlement layer. The arbiter lists approved but not yet settled trades, almost like a parallel chain yet to be mined by the Ethereum network. This can be helpful to keep a tally of your balances or alleviate network congestion, but it also poses a greater likelihood of unexpected issues. Rather than build parallel systems from scratch, we think building an execution engine that’s maximally efficient and flexible — both in the costs people pay to trade in times of congestion and the underlying settlement chain — is a better way to evolve with the ecosystem. We want to make sure we build smarter, not harder.

Playing by the rules

There’s another design decision made by IDEX and other DEXs currently on the marketplace: anonymous trading. We think there is and will always be demand for people to trade anonymously. The question is, what’s right for the majority of people in the majority of cases? Do people want to trade in a Wild West manner, or do they want assurance that the platform, people, and protocols available for sale are operating in a fair and safe marketplace? Do they want to work with an exchange that prevents front-running, pump-and-dumps, and other malicious activity? Should exchanges be committed to protecting investors; maintaining fair, orderly, and efficient markets; and facilitating capital formation?

We think the answer to all these questions is yes. We’re strong believers that crypto exchanges need to follow best practices and be thought leaders in terms of self-policing and regulation. Going for quantity over quality, whether it be tokens or users, leaves the system open to exploitation and regulatory liability. Without user accounts, malicious actors can’t be punished for unethical behavior. And by listing any token without proper due diligence, retail and institutional traders can’t be sure that what they are buying meets the standards that any investor in any marketplace would expect. We think The Ocean X can provide a fair, safe, and efficient market for traders of all types, and make user accounts, onboarding, and other parts of the experience as seamless and painless as possible, without sacrificing speed or performance of our marketplace.