Trade-Offs: Decentralized Exchange (Part 2)

Justine Humenansky, CFA
Coinmonks
16 min readJul 9, 2019

--

Photo by Aditya Vyas on Unsplash

I interviewed industry professionals at top law firms, investment funds, exchanges, and various decentralized finance (DeFi) projects, in addition to attending panels and conducting independent research at UC Berkeley, to better understand the emerging DeFi industry. Trade-Offs: Decentralized Exchange is the second article in a three part series that draws upon the insights derived from this research (find the first part here.)

The article that follows will outline the exchange of blockchain-based assets along a spectrum of centralization/decentralization, highlighting different approaches to liquidity as implemented by 0x, Injective Protocol, Kyber Network, Bancor, Uniswap, and Arwen. The final article in this series will analyze decentralized lending and derivatives. These articles assume a knowledge of both financial markets and blockchain technology.

The most widely used application of blockchain technology is in the creation of digital currencies, which has required the development of financial markets to support their exchange. However, these financial markets, in their current state, prevent open access. The infrastructure that supports the exchange of blockchain-based assets is also vulnerable to counterparty risk, censorship, a lack of transparency, and manipulation as it remains surprisingly centralized. The recent Binance hack is a timely illustration of these weaknesses, infrastructure flaws that erode trust and inhibit adoption. However, decentralized alternatives are not a panacea. This post will focus on liquidity and outline the trade-offs that several approaches to decentralized exchange still require.

The Exchange of Blockchain-based Assets is Still Centralized

On centralized crypto exchanges, custody of funds and /or order books are maintained by a third-party. According to ConsenSys, as of late January 2018, an estimated 99% of crypto trading volume flowed through centralized exchanges. These centralized crypto exchanges span a wide spectrum, from loosely regulated to those backed or launched by the established financial institutions that operate traditional exchanges.

These exchanges include Bitfinex, which was launched in 2012 and is now infamous for allegations that Tether was used to prop up the price of bitcoin on the exchange, among other controversies; Binance, which was founded in 2017 and quickly became the top crypto exchange by volume; Kraken, which was launched in 2011 and has taken a prominent stance against what it views as overly restrictive regulation; Coinbase, which was founded in 2012 and prides itself on its reputation as the “most trusted” exchange; and Gemini, which was launched in 2014, publicly embracing and promoting regulation of the industry. Poloniex, Bitstamp, and Bittrex are other prominent centralized crypto exchanges.

Source: BlockCrypto

ErisX (crypto spot and futures contract market backed by TD Ameritrade), Bakkt (ICE’s bitcoin futures contract platform), and Robinhood are examples of crypto trading markets operated by more traditional financial institutions or those coming from more traditional finance backgrounds. Note: Robinhood is not actually an exchange but rather a broker that passes trade flows through to centralized crypto exchanges.

Centralized Exchange Vs. Decentralized Exchange

While the benefits of centralized exchanges include efficiency, price discovery, liquidity, and depth/breadth of markets, there are also important drawbacks. Centralized exchanges are more vulnerable to hacks, have limited transparency (allowing for manipulation), and prevent certain market participants from accessing them.

Security Vulnerabilities: Custody

The biggest vulnerability of centralized exchanges is that they take custody of a user’s assets. About 73% of crypto exchanges are custodial, meaning the exchange manages their customers’ crypto wallets and keys.¹ When keys are held by exchanges it creates a single point of failure that is very attractive to hackers. This is anathema to blockchain networks, which are designed to eliminate such points of failure. Prominent examples of this vulnerability include the Mt. Gox hack, in which ~$460M (based on valuations at the time of the hack) was lost as a result of a hot storage vulnerability² and the recent QuadrigaCX exchange, in which $190M worth of user funds became unusable upon the supposed death of the CEO, who had sole access to the exchange’s cold storage.³ According to Gnosis, last year, “a string of hacks led to $1.5 billion in losses on centralized exchanges, devastating users and eroding public trust in crypto.”

The primary value proposition of most DeFi projects is that they don’t require users to give up custody of their assets.

Top Five Exchange Hacks as of December 2018. Source: Circle Research

Lack of Transparency: Manipulation

Many centralized exchanges operate off-chain systems, meaning most transactions aren’t actually recorded on the blockchain, and instead the exchange acts like an escrow fund for clients, limiting transparency. This can allow for wash trading, the simultaneous buying and selling of a stock with the aim to create artificial activity in markets. After analyzing 81 exchanges, Bitwise found that 71 exhibited patterns reflecting artificial trading and estimates that ~ 95% of all bitcoin trading is faked by exchanges. Motivations for wash trading vary but oftentimes it is done to indicate a higher level of liquidity since exchanges are evaluated on such metrics.

The Bitfinex / Tether investigation highlights the opportunity for outright manipulation on centralized exchanges. Data analysis from Mt. Gox indicates that market manipulation was prevalent on that exchange as well.⁴ Centralized exchanges also exert centralized power when deciding which coins to list or which chains to support following a hard fork. The impact of these decisions is significant.

Restricted Access

Finally, projects sometimes have to pay $10 to $15 million in listing fees on centralized exchanges,⁵ which clearly creates barriers to market participation. Moreover, the stringent KYC (know your customer) requirements of many centralized exchanges perpetuate their inaccessibility to many of the world’s unbanked since this population frequently lacks a legal form of identification.

The Alternative: Decentralized Exchanges (DEXs)

In response to these concerns, there has been a movement to create exchanges that are as decentralized and permissionless as cryptocurrency itself: comprised of open-source code, with automatic execution of transactions without ongoing control by a centralized entity. More specifically, a decentralized exchange is a platform that doesn’t require central custody of funds or the trust of a third party to facilitate or settle trades.

According to Delphi Digital, the largest DEX (by transaction volume) is IDEX , followed by Eth2Dai / Oasis DEX, Uniswap, and Bancor, as of June 2019.

Source: Delphi Digital

In reality, most “DEXs” are actually non-custodial exchanges. On a non-custodial exchange, users remain in control of their own keys, and therefore maintain ownership of their blockchain-based assets. However, non-custodial exchanges still host an off-chain order book on a centralized server, which requires no less trust than using a centralized exchange.

Generally, speed and cost serve as a constraint to on-chain trade execution, but off-chain functionality leads to more centralization.

Somewhat ironically, regulation may spur these exchanges to innovate more quickly towards greater decentralization. Following the EtherDelta ruling, in which the SEC charged creator Zach Coburn with a violation of federal securities law (operating an unregistered securities exchange) and fined him $388,000⁶, DEXs chose to preemptively pivot their strategies away from involvement by a third party as much as possible.

DEXs are beginning to design their networks in a way that ensures they are considered sufficiently decentralized by regulators, placing themselves in a position of relative advantage versus centralized exchanges, which must comply with increasingly restrictive regulations. As expressed by Vitalik Buterin, “control over users’ data and digital possessions and activity is rapidly moving from an asset to a liability.”¹⁴

However, the more decentralized an exchange, the more complicated it is to generate liquidity. Liquidity isn’t just a vanity metric, without it, markets don’t function properly and assets will trade at a discount. Lower user adoption relative to centralized alternatives combined with the fragmentation of the entire exchange ecosystem divides liquidity and inhibits efficient arbitrage across these many exchanges. To get a sense of the level of fragmentation among crypto exchanges, centralized and decentralized, CoinMarketCap lists 253 exchanges. The top exchange by adjusted daily volume only has~ 3.5% market share (as of 6/28/19.)

Creating liquidity in decentralized markets is a complex issue, and often in the process of solving one problem, another arises.

The remainder of this post will provide a detailed overview of prominent projects in the DeFi industry and their approach to generating liquidity.

Networked Liquidity Vs. Front Running: 0x

0x was launched in August 2017 and is not itself a DEX but is instead a protocol that allows “Relayers” to create DEXs on a public system of smart contracts. In a way, Relayers (for-profit companies that use 0x for their back-end infrastructure while operating proprietary user interfaces) are to 0x what D’Apps are to Ethereum. Importantly, Relayers do not take custody of a user’s funds or execute trades, they merely broadcast an order book which permits peer-to-peer trading. Relayers can make different design choices (order book strategy, fee structure, etc.) when building a DEX atop of the 0x protocol, while the protocol creates an underlying pool of networked liquidity for all Relayers to draw upon and outlines how orders should be structured. It leverages an off-chain order book combined with on-chain settlement, similar to other non-custodial exchanges. As of December 2018, there were 16 Relayers built on the protocol and 19 projects using the protocol, including District0x, MakerDAO, and Dharma.⁷

In the 0x model, Relayers can choose to implement either of two general order book strategies: an open order book or an order matching order book. The open order book method facilitates networked liquidity across 0x but is susceptible to frontrunning and trade collisions. In an open order book, “makers” post orders to be broadcast to the network without indicating a specific “taker.” Relayers aggregate these orders, display them on their order books, and allow any participant to fill the order. This allows for trade collisions, which occur when two market “takers” simultaneously attempt to fill the same order. Collisions can also occur if a taker fills an order while a maker tries to cancel it. This system also allows for front-running, which occurs when a party gains the ability to see order flow before it is processed, which is what occurs in an open order book system. Frontrunners profit by placing intermittent trades with a higher transaction fee, incentivizing miners to include their transaction in the block ahead of the trade they were able to view in the order book.

The second method is order matching, which prevents frontrunning and trade collision, but does so at the expense of networked liquidity. With order matching, the “maker” indicates a specific “taker” address. This can either be the Relayer, which then batch fills orders with overlapping prices, or a pre-specified “taker” address. In the first case, users must trust that the Relayer will honestly fill the order according to their specifications and won’t front run. If there are no slashing measures to explicitly punish Relayers that are untrustworthy when matching orders, reputational risk is the only incentive for Relayers to behave honestly. In the second case, the taker is pre-specified, so network liquidity isn’t utilized.

Front-running is a problem on almost all of the networks outlined in this post, but it is an area of ongoing research and innovation. There is research being done into the separation of liquidity aggregation into two contracts (a trade execution contract and a trade execution coordinator), commit-reveal schemes, and using zero-knowledge proofs to aggregate orders. 0x is partnering with StarkDEX (a Starkware project) on the latter. StarkDEX aims to utilize zero-knowledge proofs to aggregate thousands of orders into one proof, which would then be posted on-chain, making front running more difficult and dramatically improving scalability. Injective takes another approach with an on-chain settlement logic scheme that establishes a fair sequence of incoming orders. It does so via a publicly verifiable proof-of-elapsed-time, leveraging verified delay functions (VDF) to allow for seamless liquidity between Relayers.⁸ The idea is that VDF can establish a sense of time without introducing a central party, allowing orders to be time stamped and rendering frontrunning almost impossible. Injective is launching its testnet in July on Ethereum, and will integrate with 0x (which is also launching the beta of 0x Mesh around the same time.)

The Business Model of Networked Liquidity

In theory, the 0x system should result in competition among Relayers to create better disparate UXs, while the 0x protocol provides access to better liquidity. This model of creating a foundational protocol upon which other projects can create user facing applications has become the de-facto model in DeFi, with projects such as Dharma, Set, and dYdX implementing similar models.

While logically the benefits of networked liquidity are clear, it has yet to be proven effective in practice.

The concept demands that exchanges share liquidity, requiring a mindset shift from the traditional view that exchanges with the most liquidity are the “best exchanges.” If the 2–3 Relayers with the best UX become dominant, they may not have much incentive to share liquidity. If a majority of trades are executed on these dominant platforms, there would be little value derived from “networked liquidity” anyway.

However, the DEX and DeFi industry are still early in their development. As the DEX industry matures, it should fragment. As it does, it is more likely that different DEXs will emerge to facilitate the trade of specialized products.

If DEXs become increasingly specialized, networked liquidity might provide more value.

Pooled Liquidity Vs. Price Discovery: Kyber, Bancor, and Uniswap

Whereas networked liquidity aggregates liquidity across disparate DEXs built atop a common protocol, other networks approach liquidity from a different angel. Pooled liquidity aggregates liquidity from market makers into one common “pool” which can be facilitated via a reserve manager or incentivized at the protocol level. These approaches are highlighted in more detail below.

The Kyber Network, launched in 2017, is a decentralized interface that connects to different exchanges (including centralized), allowing for on-chain exchange without facilitating an order book. Instead, Kyber pools together liquidity for different ERC-20 tokens managed by so-called “reserve managers.” These managers make reserves available on Kyber at a spread. Rather than an exchange, Kyber could be viewed as a type of reserve bank which holds reserves of different cryptocurrencies, allowing for instant trading between ERC-20 tokens.

Other pooled liquidity networks approach the problem at the protocol level (via smart contracts.) These networks also do away with the concept of an order book, but instead of a reserve manager, they rely on automated market maker (AMM) models. AMMs pool liquidity together and allow a deterministic algorithm to make markets by quoting prices to traders based on a pre-defined formula, setting a defined relationship between tokens. Price slippage on large trades is an issue in AMM networks, as is front running.

The amount that is bought or sold in transactions on networks that use AMMs is determined by formulas, which determine price algorithmically, disconnecting liquidity from trade volume, but also disconnecting price from market forces.

This is not necessarily a problem; again, it’s a matter of trade-offs. When using an AMM, the user compromises efficient price discovery in return for guaranteed access to liquidity.

Being able to trade, even if at a worse price, might be preferable to not being able to trade at all in certain instances.

AMM proponents argue that AMMs eliminate the margin that market makers extract from the market and prevent market participants from acting irrationally. In practice, it doesn’t make the market more efficient. That is because these markets are dependent upon arbitrageurs to step in and maintain a rough equilibrium between the open market (which determines its pricing via informed, albeit often irrational, buyers and sellers) and automated markets. Therefore, these markets will always lag the open market, yet still reflect the irrationality of their participants.

This dynamic is exacerbated on the Bancor Network, which was launched in 2016. The Bancor Protocol sets price based on a fixed-reserve-rate-ratio called the Bancor Formula. This formula sets the ratio at which “Smart Tokens” are tethered to BNT (Bancor Network Token), which connects all tokens together through “transitive connectedness.” If this sounds like centralization, that’s because it is.

As a result of its native token structure, Bancor is relatively expensive. Furthermore, The Bancor Formula relegates price discovery to a series of linear, incremental buy and sell bids that ignore the step-function paths of most market reactions,¹¹ rendering it inefficient by design.

Uniswap was launched in late 2018, taking a contrasting approach. Uniswap consists of a set of smart contracts deployed on Ethereum to facilitate the trading of ERC-20 tokens via a version of AMM called Constant Product Market Maker. In simple terms, Uniswap creates one smart contract per token, creating a constant (x*y=k) ratio between an ETH liquidity pool and the “connected” token liquidity pool. Unlike Bancor, this formula allows the ETH to ERC-20 exchange ratio to fluctuate, and market makers are incentivized in a way that promotes trading. Specifically, 0.3% of all trade volume is distributed proportionally to all liquidity providers. These fees are added back to the liquidity pool, until a market maker chooses to cash out, which increases the profitability of the next trade.¹² The entire process occurs on-chain, with Ethereum serving as the common medium of exchange, eliminating the need for a native token and dramatically reducing gas fees (fees paid to execute transactions on a network) relative to Bancor.

Robert Leshner of DeFi protocol Compound aptly describes the advantages of Uniswap relative to Bancor, “Uniswap ripped out the token and simplified the algorithm. It costs a fraction of the gas to trade, and incentivizes the community to add to the liquidity over time.⁹” Uniswap also lets anyone provide liquidity, foregoing listing fees and/or applications.

The Uniswap model is not immune to challenges. However, it is moving the industry in the right direction: towards permissionless access, on-chain transparency, simpler UI/UX, and clearer incentive structures.

The Business Model of Pooled Liquidity

While Bancor and Uniswap compete directly, the relationship between Kyber and Uniswap has been mutually beneficial thus far. While Uniswap provides ample liquidity for certain tokens, it also has relatively few user facing integrations. Kyber on the other hand, has had difficulties generating enough liquidity, but boasts a large number of D’App, wallet and vendor integrations (~60.)¹⁵ Recognizing the complementary strengths of each platform, in February 2019, Kyber added Uniswap as one of its liquidity reserves, sourcing 34% of Uniswap’s total trade volume from February through May.¹⁵

The monetization models of these pooled liquidity networks stand in stark contrast to each other. While the business models of Kyber and Bancor networks are designed to be rent seeking, the only parties that make money on Uniswap are the liquidity providers.¹⁵

Working With Vs. Against the Centralized Exchanges: Arwen

While decentralized exchanges primarily address the custody issue, they are far from a perfect solution. Arjun Balaji explains, “While non- custodial trading feels like a boon, the trade-offs presented (e.g. in matching/execution speed, the potential for front-running, decreased privacy, the difficulty of accounting, etc.) make it an unappealing product for institutional investors, not even considering the UX curve.”

With these aspects in mind, Arwen has taken a different approach to the issue of non-custodial trading, questioning the entire premise that DEXs are the way to go.

Arwen aims to create a solution that allows people to use centralized exchanges without placing their trust (custody of funds) in them. When users trade on a centralized exchange, they first deposit their coins at the exchange via an on-blockchain transfer of tokens from the user’s wallet to the exchange’s. Trading occurs within the databases of the centralized exchange, and is not recorded on the blockchain. Users only regain custody of their tokens when they withdraw their tokens from the exchange, a transaction which is recorded on-chain.¹³ Instead, Arwen’s Layer 2 protocol requires each side of a trade to open an on-chain “escrow” account and then facilitates the execution of off-chain atomic swaps. This allows Arwen to avoid operating an order book altogether. Instead, it plugs into the order book of a centralized exchange so users benefit from the existing liquidity of the exchange, without giving up custody of their assets at any point in the trade. This is significant since custody is the main reason people trade on DEXs. The protocol is also designed in such a way that it does not require non-custodial users to manage their own private keys, a major point of user friction.¹⁰

To compensate the exchange for locking its coins in escrow (both sides of the trade must open escrows), the trader pays an escrow fee each time the exchange opens an escrow for them. The exchange could fund these escrows with its own tokens or by using deposits provided by its custodial users and then sharing the escrow fees proportionally.¹³ Even if the exchange gets hacked or goes offline, a user should still be able to close out their escrows and claim all of their coins since these on-chain escrows are created with an expiry time, after which point the opener can unilaterally close it out.¹⁰ Arwen differs from other layer 2 protocols, such as the Lightning Network, in that it was designed specifically for cryptocurrency trading (versus payments) and therefore does not rely on a path of intermediate nodes and doesn’t require SegWit support (given importance of cross-chain trading.)¹³

While Arwen could avoid many of the challenges of traditional DEXs, including lack of liquidity and limited speed, it’s still extremely early. Arwen is currently in private beta testing and only supports BTC, BCH, and LTC, with a $100 trade size limit.¹⁰

Dream Vs. Reality

Source: Totle

The exchange of blockchain-based assets is still mostly centralized. Even within the DeFi industry, centralized fiat on-ramps are still the first step in accessing most markets (although there is innovation happening here) and most non-custodial exchanges are still centralized in many ways. While regulation may push design towards truer decentralization, given the complexity, it will likely still require a multi-step, multi-year transition for many exchanges to become more decentralized.

In the meantime, we are likely to see a hybrid market architecture prevail. At some point in the future, there may be an inflection point where traditional traders need to access assets through Ethereum based contracts frequently enough that it causes a marrying of the two worlds to occur. Until then, the DeFi industry will have to continue working to create real liquidity, to prevent front-running and other manipulation, and to facilitate efficient cross-chain trading and cross-market arbitrage so that users don’t have to make as many trade-offs.

*** Thank you to Christine Parlour and Kate Tomlinson for feedback.***

Stay tuned for the final part of this series, Risk Off or On?: Decentralized Lending and Derivatives.

--

--

Justine Humenansky, CFA
Coinmonks

if it’s not a dao, why do it? former ballerina. currently @ rabbithole