A Preliminary Visual Look at Decentralized Exchanges

Rodrigo Villar
4 min readMar 3, 2022

--

Throughout my transition from the Bitcoin ecosystem to the world of DeFi, I’ve always questioned how large Decentralized Exchanges such as Uniswap and Sushiswap are (large as in the number of liquidity pools each exchange offers).

Such a question lingered in the back of my mind until I, alongside others from Cornell Blockchain, began working on an arbitrage project. While planning, my fellow team members and I had to decide which Decentralized Exchanges (DEXs)we want to search for arbitrage opportunities on. DEXs such as Uniswap V2 immediately came up, but any candidate DEX need to have the following properties:

  1. An adequate number of liquidity pools (the DEX just needs to have enough liquidity pools so our algorithm can locate at least one arbitrage opportunity)
  2. The possibility to divide up a graph of the DEX into subgraphs

This second point is especially important because being able to do this would allow for our algorithm to run more efficiently. However, we didn’t know whether the requirement was even possible. Thus, I decided to test this out by creating the following two visual graphs:

Uniswap V2 Graph

Undirected Graph of Uniswap V2 Trading Pools @ Ethereum Block 14301876

Uniswap V2 was first released in May 2020; even though this version of Uniswap is older than Sushiswap by around 2 months, the graph above shows that Uniswap V2 is a much larger DEX. Highlighted in grey are WETH, USDT, USDC, and DAI. I choose to highlight these tokens because of their high volume (WETH is an ERC-20 representation of ETH, while USDT, USDC, and DAI are stablecoins) but also because of how much they connect the graph above.

In the context of arbitrage, this makes sense considering the following:

Source: The Coinbase Blog

The tokens highlighted in grey appear in the list of top 5 gain tokens in triangular arbitrage transactions. This makes sense since arbitrageurs will look for areas with the most opportunity and as a result, WETH/stablecoins come into play due to their high number of connections to other tokens (even if WETH/stablecoins are the endpoints of a triangular arbitrage transaction). There indeed exists other tokens (UNI, SUSHI, SHIB, etc.) that have an above-average number of connections, but I would argue that if these tokens were to be removed from the DEX, this would not have much of an impact on the market compared to if we removed just one of either WETH/USDT/USDC/DAI.

Sushiswap Graph

Undirected Graph of Sushiswap Trading Pools @ Ethereum Block 14301875

Sushiswap, a fork of Uniswap, is another DEX that I decided to graph due to its availability of data (i.e. TheGraph). Although this DEX has been around for almost 2 years now, I was first surprised at how few liquidity pools Sushiswap offers (relative to Uniswap V2). Regardless, I again highlighted WETH/USDT/USDC/DAI because these coins play an important role in connecting the DEX as a whole.

However, one thing that I noticed about the Sushiswap graph is that there exist significantly fewer nodes that are not connected to the main graph. By this, I mean the following (abstractly): let S represent the set of tokens that are reachable with either WETH/USDT/USDC/DAI as the starting node of an arbitrary path (S includes WETH/USDT/USDC/DAI). Let S’ represent the complement of this set (i.e. all tokens not reachable from WETH/USDT/USDC/DAI). Apply the idea above for Uniswap V2 as well, creating U and U’. Therefore:

size(S’) < size(U’)

While there exist many explanations for this phenomenon, the idea I had was that Sushiswap contains fewer liquidity pools where each token involved is in effect worthless. Ignoring gas, it is easier to create a liquidity pool for some tokens A and B if A and B have no store of value backing them (i.e. they are free tokens). Meanwhile, it is much harder for one to create a liquidity pool containing token A and USDC because USDC is a backed token that requires an exchange in equivalent value to receive (in other words, USDC is not free).

Invaluable liquidity pools are not a grave danger to arbitrageurs because either (i) their algorithms skip over these pools or (ii) their algorithms compute paths containing these pools quick enough to not make a significant difference to the overall computation time of finding an arbitrage opportunity. However, this does pose a risk to blockchains such as Ethereum since each one of these liquidity pools is handled by a smart contract; even though smart contracts, in general, are very small in size(in the kilobytes), full nodes have the responsibility of storing these smart contracts in storage. The more of these worthless liquidity pools that are deployed to the blockchain, the more valuable storage that nodes will need to set aside to store the smart contracts of these liquidity pools. In addition, the fact that these smart contracts cannot be deleted means that their effects are to stay for the long term (a glance at UniswapV2Pair.sol verifies that there does not exist a selfdestruct() method).

The graphs above, although they represent a small subset of all DEXs, demonstrate the beauty of DeFi: like-minded individuals can deposit their assets into liquidity pools that when connected can result in the emergence of a market with volume. While CEXs (centralized exchanges) provide the advantage of having cleaner markets (i.e. no invaluable trading pairs), this inherently lowers the amount of economic opportunity possible as users are not able to create liquidity pools that can provide benefits to the market.

-rjv

--

--

Rodrigo Villar

Computer Science and Mathematics Student at Cornell University.