Landscape Web (10).jpg

DEX Machina: An Introduction to Decentralized Exchanges

Zhao B&W
Michael Zhao
Last Updated 10/17/2023
  • Uniswap Labs' new 0.15% fee has reignited debates on the sustainability of decentralized platforms like Decentralized Exchanges (DEXes), which are key to the DeFi ecosystem.
  • Our analysis shows that DEXes offer deeper liquidity at price levels farther from the midpoint compared to Centralized Exchanges (CEXes).
  • Liquidity Providers (LPs) capture the majority of trading fees, but also face the risk of Impermanent Loss.
  • Most DEX volume is driven by automated, sophisticated players rather than individual retail users.
  • We anticipate that DEXes will further solidify their importance, attracting more trading volume and an expanding user base as the overall DeFi ecosystem continues to grow.

 

For years, the traditional order book model has been synonymous with trading. It’s more than just a tool; it’s the heartbeat of exchanges, dictating price and liquidity for markets across the world. By matching orders between buyers and sellers based on certain rules, price discovery happens through the continuous interaction between buyers and sellers in the markets.

Order books have historically worked well, although not without faults. First, order books require a buyer and a seller to trade at a certain price; if there’s an illiquid asset, an order might take a while to get filled. Second, order books introduce centralization risk, since they require middleware infrastructure to host the order book and match orders, and also depend on market makers for liquidity. This often can lead to wide spreads and slippage for more illiquid markets. 

Enter the world of Decentralized Exchanges (DEXes) — an innovative solution that addresses some of these challenges while reshaping our understanding of liquidity, pricing, and market participation. DEXes have also been central to some of crypto's most noteworthy events in recent years such as the Curve USDT depeg. If you've ever sought to purchase a token unavailable on centralized exchanges (CEXes), it's likely you've turned to a DEX like Uniswap. But how exactly do these platforms operate?

 

Zero to Hero

Imagine a schoolyard bustling with kids, where action figures and comic books are the currency of the realm. But trading these treasures is a chaotic mess—a jungle gym of missed opportunities and unfair swaps. You, the entrepreneurial genius of 5th grade, decide to set up the ultimate trading post: "The Liquidity Pool."

Establishing the Pool

You slap down 100 action figures and 100 comic books on the table (the “liquidity pool”). You are considered the “Liquidity Provider” (LP). Kids can now trade action figures for comic books and vice versa. The trading rate depends on a formula that you’ve conjured up:

 

Supply of Action Figures * Supply of Comic Books = Constant Number1

 

Initially, this constant number is 100 x 100 = 10,000. The trade rate is a straightforward 1:1. One action figure gets you one comic book, and vice versa.

Alice’s Trade

First up is Alice, a small-time trader known for her cautious yet clever swaps. She trades her two action figures for comic books via the liquidity pool. After her trade, you now have 102 action figures in the pool. Time to calculate how many comic books she receives: 

 

102 Action Figures * X Comic Books = 10,000

 

X = 10,000 / 102 Action Figures = 98.04 remaining Comic Books

 

100 initial Comic Books - 98.04 remaining Comic Books = 1.96 Comic Books to Alice



Alice skips away with 1.96 comic books, nearly a one-for-one trade. For a small-time trader like her, it's like hitting the jackpot—a great haul for minimal risk! She’s just a few pages short from 2 comic books.

Bob’s Trade

Next, the ground shakes as Bob, the "Whale Trader," saunters over. Known for his massive trades that can tip the balance, he wants to swap a whopping 10 action figures for comic books. Your table now holds 102 action figures and 98.04 comic books. Time for some math:

 

112 Action Figures * X Comic Books = 10,000

 

X = 10,000 / 112 Action Figures = 89.28 remaining Comic Books

 

98.04 initial Comic Books - 89.28 remaining Comic Books = 8.76 Comic Books to Bob

 

Bob lumbers away with 8.76 comic books for his 10 action figures. He's unfazed—after all, making waves is what whales do. However, his large trade has shifted the magic number, impacting the rate for everyone.

 

Your Incentive

So, what's in it for you, the mastermind behind this trading hub? Every time a trade is made—whether it's Alice's cautious swap or Bob's whale of a deal—a small trading fee is collected. This fee is your reward for providing the liquidity that makes all these trades possible. In the world of decentralized exchanges, these fees serve as the primary incentive for liquidity providers, making the ecosystem sustainable.

As you can see, while originally the pool was balanced, swaps were trading at a near 1:1 ratio. As the pools became more imbalanced, and as the trades became a larger amount of the pools, one asset gradually became more expensive, and trades became more imbalanced. 

If we want to graph the price of Comic Books to Action Figures using the quantities of each in the pool, it would look something like this:

 

Figure 1: Price Depends on Asset Quantity in Liquidity Pool



As you can see from the chart, the larger the trade, the more the scales tip. In other words, the bigger the swap, the more you disturb the pool's balance, affecting the price for everyone. It's like a seesaw: the heavier the weight on one end, the faster the other end rises.

Before we conclude, let's revisit some key terms:

  • Liquidity Provider: An individual or entity that supplies assets to a liquidity pool. In our schoolyard example, that's you with your action figures and comic books. You receive a fee based on the percentage of the volume traded.
  • Liquidity Pool: A collection of assets that traders can tap into. This pool is what makes trading possible in a decentralized exchange. Again, think of your table of action figures and comic books.

These are the fundamental mechanics of liquidity pools, distilled into a schoolyard trade of action figures and comic books. Just like in our example, decentralized exchanges rely on liquidity providers to keep the trading ecosystem balanced. Whether you're an Alice, cautiously stepping into the market, or a Bob, making waves with significant trades, your actions affect the liquidity pool and, by extension, the trading conditions for everyone else.

Just like setting up the liquidity pool, anyone can create a market for any tokenized asset without a centralized kingpin to oversee the trade. This flexibility is particularly advantageous for digital assets. For example, if you wish to introduce a new token or even a complex financial instrument like a synthetic asset2, you could establish a market for it on a decentralized exchange without the restrictions commonly associated with traditional platforms. 

 

Liquidity Comparison to Centralized Exchanges

Now that you understand how liquidity pools operate in decentralized exchanges, you might be wondering how they measure up against the traditional, centralized platforms. So, how do decentralized exchanges, with their innovative liquidity mechanisms, stack up in terms of liquidity and market depth?

Let’s briefly discuss what liquidity means. One of the cornerstones of a robust trading environment is high liquidity: the ability to buy or sell assets without causing significant price fluctuations. Closely related to liquidity is the concept of market depth, which refers to the volume of orders at different price levels in an order book. For instance, if a market has $1 million of depth within a 2% price range around the current Bitcoin price, it means you could buy or sell up to $1 million worth of Bitcoin without affecting the price by more than 2%. However, if the market depth was only $500,000 within the same 2% price range, a $1 million purchase would likely cause a larger price swing. In general, deeper liquidity and market depth are advantageous as they tend to offer traders better prices, lower slippage, and increased order fulfillment speed.

 

Figure 2: An Order Book Shows the Cumulative Bids and Asks at Various Prices



While centralized exchanges have traditionally been the go-to platforms for traders seeking depth and liquidity, DEXes are quickly changing the landscape. A case in point is Uniswap v3, a popular DEX3 which allows liquidity providers to deposit assets within specific price ranges, allowing for comparison to traditional order books.

To evaluate the efficacy of DEX liquidity, it's useful to turn to empirical data. A study by Kaiko in August 2023, a blockchain analytics firm, examined Uniswap's liquidity profile in various pools and compared them to the same trading pairs on centralized exchanges. The data reveals an interesting pattern: although Uniswap may offer lower market depth at price points close to the current trading price, it boasts greater depth at prices further from the midpoint. This suggests a more balanced distribution of liquidity. This could present a unique advantage over centralized exchanges, where liquidity often diminishes at extreme price points.

 

Figure 3: Liquidity Distribution More Balanced in WETH-USDT Uniswap v3 Pool vs. Binance



Kaiko also conducted a broader analysis comparing Uniswap to several top centralized exchanges. Remarkably, their findings indicate that Uniswap v3 outpaces all of the top 10 centralized exchanges in terms of liquidity within a +/- 6% price depth. This highlights the increasing competitiveness of DEXes in providing substantial liquidity.

 

Figure 4: Uniswap ETH-USDC Pool has Deeper Liquidity Compared to CEXes Within a +/- 6% Price Range 



The share of trading volume on DEXes compared to CEXes has increased from 8% in October 2022 to 12% as of October 2023. This growth suggests a rising preference for DEXes likely driven by their liquidity benefits.

 

Figure 5: DEX to CEX Volume Ratio Has Been Growing Gradually



Despite their novelty, DEX platforms like Uniswap are carving out a distinctive and increasingly competitive position in the trading landscape. While they may not entirely supplant centralized exchanges, we believe their innovative approaches to liquidity and market depth make them an increasingly viable alternative for various trading scenarios.

 

A Look into Liquidity Provider Returns

While decentralized exchanges may offer compelling alternatives to their centralized counterparts, what are the implications for individual participants, particularly liquidity providers? After all, these are the actors who fuel the liquidity pools that make decentralized trading possible. 

Every liquidity pool charges a fee for trades conducted on its platform. For instance, a “0.03% fee USDC-WETH pool” means that the protocol takes 0.03% of each trade's value and distributes it to the Liquidity Providers (LPs) that are providing those assets (USDC and WETH). It's worth noting that historically the lion's share of these trading fees—typically between 80% to 90%—goes to the LPs, leaving only around 10% for the protocol itself.

The Uniswap Anomaly

One reason for this skewed distribution is the unique fee structure of Uniswap, the largest DEX by historical volume. Prior to October 16, 2023, Uniswap did not levy a fee, which meant that 100% of trading fees were distributed to LPs. When Uniswap is excluded from the analysis, protocol fees claim a significantly larger portion, averaging around 35% of the total trading fees generated (Figure 6).

 

Figure 6: Weekly Average of Protocol Revenue Share Excluding Uniswap Hovers Around 35-40%




This fee structure had implications for governance tokens like UNI - the Uniswap governance token. Recently, Uniswap Labs, the company which developed the Uniswap protocol and the web interface, implemented a 0.15% fee for using its front-end interface for select assets. However, the absence of a protocol fee switch specifically for UNI token holders means that the token could still represent a source of potential value accrual. While Uniswap Labs has taken steps to monetize the platform's usage, governance token holders still do not have the option to vote for a protocol fee. In theory, they could choose to implement such a fee someday, thereby channeling a portion of the high trading volumes into the token's value.

 

Impermanent Loss

In addition to trading fees, another crucial aspect an LP has to consider is “impermanent loss”. This phenomenon occurs when the price of assets within a liquidity pool diverges from the prices in external markets4. Liquidity providers may experience a reduction in the value of their holdings due to these price changes. The term "impermanent" denotes that the loss could be reversed if asset prices in the pool revert to their original levels when liquidity was first provided. 

Let’s consider an example.

Imagine you become an LP on a decentralized exchange. You deposit an equal value of two cryptocurrencies into a liquidity pool: 1 ETH and 1,700 USDC, assuming 1 ETH is worth 1,700 USDC at that time. Let's also assume that the total liquidity in the pool is 10 ETH and 17,000 USDC, making your contribution 1/10th of the total pool.

Now, let's say the price of ETH rises to 2,000 DAI in external markets. In the AMM, the asset prices adjust according to the ratio of ETH to DAI in the pool. As people buy the cheaper ETH from the pool, the amount of ETH decreases, and the amount of DAI increases, causing the price to adjust.

Let's say after several trades, and XY = K math, the pool now has 9.22 ETH and 18,439 USDC. Given that you are 1/10 of the pool, your holding value currently is 3,687.82. If you decide to withdraw your share from the pool now, you will have made 3,687.82 - 3,400 = $287.82.

But what if you held the two amounts? You would have had 1,700 USDC and 1 ETH, or  1,700 + 2,000 = 3,700. The difference between this amount and your liquidity position –  3,700 - 3,687.82 = 12.18  —  is your impermanent loss. We can graph impermanent losses as so: 

 

Figure 7: Impermanent Loss Increases With Larger % Change in Price



It's important to note that the graph does not account for fees generated from trading activity, which may impact the analysis. As an LP, you're essentially making two key assumptions:

  • Price Stability: You hope that the prices of the assets in the pool will remain relatively stable, minimizing any impermanent loss.
  • Fee Compensation: You expect that trading fees and any additional incentives provided by the protocol will offset any impermanent loss you might incur.

A commonly cited study in November 2021 suggests that, for most liquidity pools on Uniswap v3, impermanent losses often outweigh fees earned by LPs. This implies that the average LP might fare better by simply holding their assets. However, it's important to note that this study did not consider stablecoin pairs and was conducted during a period of high price volatility.

Despite the challenges, there are ways for LPs to try to remain profitable:

  • Sideways Markets: LPs generally profit from fee generation, especially in stable or "sideways" markets where asset prices don't fluctuate wildly.
  • Stablecoin Pairs: Platforms like Curve Finance offer stablecoin pairs with high trading volumes and low price divergence, making them potentially profitable for LPs.
  • Dollar-Cost Averaging: The constant rebalancing inherent in LP positions can also serve as a form of dollar-cost averaging, allowing LPs to build positions in assets over time.

By understanding these factors, you can better gauge the risks and rewards of becoming an LP. Let’s take a look at who the major DEX users are currently. 

 

Current Cohort Analysis

Cohort analysis reveals that the majority of trading volume comes from sophisticated users and automated trading systems, rather than casual or individual traders. This trend is particularly pronounced in the largest liquidity pools, as measured by Total Value Locked (TVL). Automated trading participants account for over 60% of the total trading volume in these pools.

 

Figure 8: Automated Participants Tend to Dominate Volume on DEXes

Source: Glassnode, as of July 31, 2023

 

Why do automated traders dominate decentralized exchanges like Uniswap? One reason lies in Ethereum's mempool, a waiting area for unconfirmed transactions. By design, anyone can view the pending transactions in the mempool. This visibility enables automated traders to engage in "Maximal Extractable Value"5 by placing transactions with higher gas fees to ensure quicker processing. It also allows them to execute arbitrage strategies effectively, as they can react swiftly to price discrepancies across different exchanges.

The prevalence of automated traders on DEXes, facilitated by Ethereum's mempool, brings both opportunities and challenges. While they contribute to market efficiency, they also pose risks to passive LPs. Understanding this landscape is essential for anyone looking to participate effectively in decentralized markets.

 

Conclusion

Decentralized exchanges have begun carving out a vital role in modern trading, offering unique advantages over their centralized counterparts. Through various mechanisms, they have democratized liquidity and presented novel opportunities for asset exchange.

However, this innovation comes with its own complexities, including the risks associated with impermanent loss and the competitive dynamics introduced by automated traders. As the sector continues to mature, both casual traders and sophisticated liquidity providers may wish to equip themselves with a comprehensive understanding of these nuances to navigate this evolving trading landscape effectively.

 

Footnotes:

  1. Example provided for educational purposes only and based on a common type of DEX pricing calculation called a Constant Function Market Maker.
  2. Synthetic asset refers to a tokenized version of other assets. For example, USDC is a crypto asset that is a synthetic asset that tokenizes the US dollar.
  3. Based on total volume, Uniswap has the highest amount of cumulative volume - around $1.7T as of October 17, 2023. Uniswap v3 is Uniswap’s most utilized DEX as of October 17, 2023.
  4. This assumes price discovery happens in external markets. If all of the trading happens within the liquidity pool then there technically would be no impermanent loss, since the liquidity pool prices reflect the actual prices.
  5. Maximal extractable value (MEV) refers to the maximum value that can be extracted from block production in excess of the standard block reward and gas fees by including, excluding, and changing the order of transactions in a block.

Important Information

Investments in digital assets are speculative investments that involve high degrees of risk, including a partial or total loss of invested funds. Investments in digital assets are not suitable for any investor that cannot afford loss of the entire investment.
 
All content is original and has been researched and produced by Grayscale Investments, LLC (“Grayscale”) unless otherwise stated herein. No part of this content may be reproduced in any form, or referred to in any other publication, without the express consent of Grayscale. 

This information should not be relied upon as research, investment advice, or a recommendation regarding any products, strategies, or any investment in particular. This material is strictly for illustrative, educational, or informational purposes and is subject to change. This content does not constitute an offer to sell or the solicitation of an offer to sell or buy any security in any jurisdiction where such an offer or solicitation would be illegal. There is not enough information contained in this content to make an investment decision and any information contained herein should not be used as a basis for this purpose. 

This content does not constitute a recommendation or take into account the particular investment objectives, financial situations, or needs of investors. 

Investors are not to construe this content as legal, tax or investment advice, and should consult their own advisors concerning an investment in digital assets. The price and value of assets referred to in this content and the income from them may fluctuate. Past performance is not indicative of the future performance of any assets referred to herein. Fluctuations in exchange rates could have adverse effects on the value or price of, or income derived from, certain investments. 

Certain of the statements contained herein may be statements of future expectations and other forward-looking statements that are based on Grayscale’s views and assumptions and involve known and unknown risks and uncertainties that could cause actual results, performance, or events to differ materially from those expressed or implied in such statements. In addition to statements that are forward-looking by reason of context, the words “may, will, should, could, can, expects, plans, intends, anticipates, believes, estimates, predicts, potential, projected, or continue” and similar expressions identify forward-looking statements. Grayscale assumes no obligation to update any forward-looking statements contained herein and you should not place undue reliance on such statements, which speak only as of the date hereof. Although Grayscale has taken reasonable care to ensure that the information contained herein is accurate, no representation or warranty (including liability towards third parties), expressed or implied, is made by Grayscale as to its accuracy, reliability, or completeness. You should not make any investment decisions based on these estimates and forward-looking statements. 

There is no guarantee that the market conditions during the past period will be present in the future. Rather, it is most likely that the future market conditions will differ significantly from those of this past period, which could have a materially adverse impact on future returns. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFITS OR LOSSES SIMILAR TO THOSE SHOWN. PAST PERFORMANCE IS NOT INDICATIVE OF FUTURE RESULTS. We selected the timeframe for our analysis because we believe it broadly constitutes the most complete historical dataset for the digital assets that we have chosen to analyze.

Related content