Uniswap Isn’t Your Ordinary DEX

Danger Zhang
Oct 31 · 5 min read

Uniswap seems like just another Decentralized Exchange — another Forkdelta, Radar Relay, or IDEX, but it’s not. It solves many of the problems facing Decentralized Exchanges today — bad usability, huge spreads, poor liquidity, counterparty risk(Yes there is still risk when using a DEX).

It does this by using a unique market-making mechanism which lets it be extremely decentralized while also providing good prices, low fees, and good liquidity.

The Problem with Decentralized Exchanges Today

If you’ve ever used EtherDelta, ForkDelta, or any of the other common DEX’s on the market today, you’ve discovered a simple, frustrating problem: Decentralization comes at the cost of usability.

Whereas trades on a centralized exchange like Binance happen off-chain on a server, many exchange operations on DEXes such as deposits(sometimes called locking funds), placing orders, and finalizing trades either require Ethereum transactions on DEX’s, making for an annoying situation where almost every action you take on a DEX pops up a Metamask window asking for approval, often also requiring paying a gas fee and waiting for the transaction to confirm before you can proceed.

The poor user interface of these exchanges also means that liquidity is often poor. Order books are thin, and spreads are high, meaning prices are often significantly worse than a centralized exchange. You are paying a premium for the privacy, security, and decentralization benefits of most DEXes today.

Uniswap — A Better DEX

Unlike traditional DEXes, Uniswap does away with orderbooks, instead, it uses an algorithmic pricing mechanism that guarantees liquidity and provides low spreads. This pricing mechanism works beautifully yet is also programmatically simple, allowing Uniswap’s smart contract operations to be relatively simple. This provides the added benefits of improved security/auditability, and low gas fees.

Simple Market Making Mechanism

Unlike a regular exchange, Uniswap doesn’t use an order book. Instead, it uses an automated market-making mechanism that guarantees liquidity.

Each ERC-20 Token traded on Uniswap has a pool of Ether and a pool of the token. The price of the token at any time is the ratio of the size of the ETH pool to the size of the token pool.

Whenever someone sells the token for ETH on Uniswap, the amount of the token increases and the amount of ETH decreases. This decreases the price of the token incrementally. Whenever someone buys the token for ETH, the amount of the token on Uniswap decreases and the amount of ETH increases, pushing the price up. The price of the token is dictated by the automated market-making algorithm to make sure that the amount of ETH times the pool of tokens remains the same constant product.

This market-making mechanism is automatic — no manual traders are needed to create order books. Instead, the price is adjusted through arbitrage. Every time the price on Uniswap lags the market, it becomes profitable to make a trade that brings the price closer to the market.

The constant product market-making mechanism also guarantees liquidity. As an order gets larger, the price of the trade rises asymptotically so liquidity will always be there. It provides small to medium trades with relatively low spreads (However it does mean large orders may experience high slippage)

This market-making mechanism also makes for a relatively simple exchange design. When it comes to smart contracts, simpler is better in many ways. Simpler code generates lower gas fees and also is good from a security standpoint. Simpler code is easier to audit, easier to test, and has a smaller attack surface.

Incentivized Liquidity
The automatic market-making mechanism of Uniswap provides liquidity on its own, but it still requires the pools of ETH and tokens to be sizable to provide good spreads.

Uniswap incentivizes this liquidity by rewarding those who provide ETH and token pools with trading fees. By providing liquidity on Uniswap, you get a portion of the trading fees on that token pair which is proportional to the amount of the pool’s liquidity you have contributed.

Extreme Decentralization

Uniswap’s unique market making mechanism allows it to be extremely decentralized — perhaps the most decentralized exchange design so far.

Trades don’t happen against a centralized party. Instead, they happen against a smart contract on the Ethereum network, with liquidity pooled from other users (liquidity providers).

Funds only “leave” your wallet for single block — the transaction. Unlike a traditional DEX with an order book where you often have to deposit funds, transactions happen directly from your wallet. This minimizes counterparty risk as you only have to trust Uniswap for that single block.

Uniswap also doesn’t have a centralized token, and has open-sourced code and an open API. Anyone can build on the Uniswap exchange as a source of liquidity, or even create their own interface to the exchange. There is no centralized control, and the creator(Hayden Adams) — cannot censor transactions or shut down the exchange.

Extremely Low Fees and Spreads

Decentralized exchanges often have poor liquidity, and the complex smart contracts they use often lead to high gas fees. Uniswap’s simple market-making mechanism, on the other hand, guarantees liquidity. Along with its incentivized liquidity, it provides low spreads for moderate-sized orders.

The fees and spreads are low enough that Uniswap often has the best prices for token trades across all decentralized exchanges. Nowadays, several decentralized exchange price comparison sites exist, however when fees are considered, Uniswap’s low fees mean token trades are often cheaper than even exchanges with seemingly better rates.

For one-time or small trades between ETH and ERC20 Tokens or token to token trades, Uniswap often also provides better prices than centralized exchanges when deposit/withdrawal fees are taken into account.

ETH to ERC-20 Token trades

Most DEXes dont allow direct trades between ETH and ERC-20 Tokens, since ETH doesn’t confirm to the ERC-20 standard. Instead, you must wrap your Ethereum into WETH to trade it. If you want to use it as ETH again(say to pay gas), you have to unwrap it again. Each wrapping/unwrapping takes time and gas.

Uniswap’s dual ETH and ERC20 Token pool design allows you to directly sell ETH for tokens or tokens for ETH without any wrapping or unwrapping. This is both way cheaper and nicer to use than having to wrap and unwrap ETH.

Not Your Ordinary DEX

Uniswap is a DEX, but lumping it together with all the other decentralized exchanges(many of which are actually not that decentralized) misses its unique benefits.

Its unique market-making mechanism leads to an extremely decentralized design which also provides very low gas fees and low spreads. Along with an extremely well designed, minimalistic UI, Uniswap is simply the best-decentralized exchange the world has ever seen.

The Startup

Medium's largest active publication, followed by +525K people. Follow to join our community.

Danger Zhang

Written by

Engineer turned Writer | Comms@Quantstamp

The Startup

Medium's largest active publication, followed by +525K people. Follow to join our community.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade