If you want to understand what Uniswap is and how it works, the first step is to forget everything you know about traditional exchanges like Coinbase.
Strictly speaking, Uniswap isn't even an exchange — it's a protocol. So let's cut to the chase and dive straight into this beginner's guide to Uniswap.
What Is Uniswap?
Decentralized exchanges are a long-time fixation of the cryptocurrency industry. Many attempts at creating a widely adopted DEX have come and gone, but Uniswap is the first to truly stick.
Despite its reputation, Uniswap isn't an exchange in the strict sense of the word. Instead, Uniswap is a decentralized liquidity protocol.
In a nutshell, Uniswap is a network of smart contracts connecting liquidity providers with traders.
Liquidity providers: People and institutions providing tokens to the protocol
Traders: Anyone trading tokens with Uniswap liquidity pools
When liquidity providers deposit tokens to Uniswap, they go into a liquidity pool. But when traders deposit or withdraw tokens during a swap, they trade with the liquidity pool, not other traders.
Significantly, traders swap against a smart contract-controlled liquidity pool rather than an order book like Coinbase uses. An order book is centralized, requires assets owned and dispensed by the exchange, and uses the play between buyers and sellers to determine asset prices.
In contrast, Uniswap:
Prices assets using a deterministic algorithm
Doesn't own the assets in liquidity pools
Is entirely operated by automated smart contracts
Each of these points is important for truly understanding how Uniswap works, so let's look at them more closely.
Uniswap liquidity pools and providers
Any exchange needs liquidity if it's going to succeed. Deep exchange liquidity benefits traders with better price discovery, less slippage, and increased stability relative to illiquid markets.
The challenge for decentralized liquidity protocols like Uniswap has always been about crowdsourcing enough liquidity to compete against centralized exchanges. The latter are established, trusted, and provide insurance guarantees for institutional liquidity providers.
However, traditional exchanges have a built-in shortcoming — they're centralized, which means they operate on trust. Any number of failures are possible when trusted third parties hold the reins to large sums of assets.
Uniswap replaces the centralized paradigm with liquidity pools secured on the Ethereum blockchain and operated by decentralized smart contracts. Remember, smart contracts are autonomous programs with specific input/output functions. Since they can only accept particular inputs to execute given outputs, they don't require mediators to operate — just like vending machines.
Instead of handing assets over to an exchange operator, Uniswap liquidity providers deposit a set of two tokens in equal amounts to a smart contract (i.e., a liquidity pool). The smart contract then issues a liquidity pool token back to the depositor representing the underlying tokens and entitles their owner to profits from the pool.
In fact, it's liquidity pool profits that incentivize people to provide liquidity to Uniswap. Imagine how many crypto wallets contain tokens collecting dust. Because of Uniswap, those same idle assets can turn profits by earning a share of trading fees.
As you can see, the big difference between Uniswap and centralized exchanges like Coinbase is that liquidity providers own the liquidity and, hence, they own the exchange. The paradigm shift here is anyone can provide liquidity to Uniswap; therefore, anyone can own a piece of the protocol.
The Uniswap liquidity pool model has proven so successful that liquidity providers have locked in over $8 billion worth of cryptocurrency tokens.
Pricing assets with the constant product formula
Billions of dollars worth of cryptocurrency tokens are deposited into Uniswap to provide liquidity for crypto traders. That's all well and good — but how does Uniswap price those assets?
Uniswap doesn't use intermediaries, so pricing assets happens in a disintermediated way via good old-fashioned maths! The constant product formula is how Uniswap prices assets and is expressed as x * y = k. The x and y are the liquidity pool's assets, and k is the constant or invariable amount of pool liquidity.
To buy ETH (x) on Uniswap, you add UNI (y) tokens to the pool. Remember that k demands the pool's total liquidity to remain at a defined constant. So, by adding UNI tokens, you're increasing one side of the pool and decreasing the other (i.e., removing ETH).
The algorithm divides the pool's total liquidity by the new amount of UNI in the pool, then divides that by the new amount of ETH in the pool so that (k / y) / x = price. This is how the constant product formula figures out the price of any token on Uniswap. But whales beware; larger buys have a more significant impact on pool liquidity and drive up token prices.
Why Uniswap needs arbitrage traders
You learned how the constant product formula prices assets in the Uniswap pools in the section just above. The thing is, Uniswap doesn't exist in a vacuum. There are other exchanges out there, both centralized and decentralized, and they're all trading tokens.
So the big question is how does Uniswap price assets relative to other exchanges? When ETH is trading at $1986 on Binance, it's going for about the same rate on Uniswap. The way this magic happens is via arbitrage traders.
The easy way to understand arbitrage trading is to imagine ETH trading on Binance for $2139 while simultaneously trading at $2110 on Coinbase. An arbitrage trader will spot this price discrepancy, buy $2110 ETH on Coinbase, then sell it on Binance, profiting from the difference.
Every time these discrepancies arise in the crypto market, arbitrage traders pounce on the opportunity. This constant vigilance on the part of arbitrageurs creates price equilibrium across exchanges — including Uniswap.
Putting it all together
Under the hood, Uniswap pools together crowdsourced liquidity, prices assets with the constant product formula, then uses smart contracts to dispenses tokens to traders.
The frontend user experience of Uniswap is quite minimal. As a trader, you see nothing more than the now-iconic Uniswap swap interface. Its success is evident based on the countless other decentralized exchange protocols shamelessly cloning it.
It's tempting to say the Uniswap interface's user-friendliness belies the protocol's underlying complexity. But, Uniswap's genius truly lies in its simplicity.
All of Uniswap's utility is achieved automatically by code — no intermediaries, no identity verification, and 24/7 uptime.
The value of Uniswap's 24/7 up time was made especially obvious during the May 2020 crypto crash. Centralized exchanges like Coinbase and Binance were swamped by trading activity during the crash and went down across the board. Uniswap, on the other hand, experienced record-breaking volume but had zero downtime.
Uniswap V3, V2, Optimism explained — what's the difference?
As the 2021 crypto bull market was heating up, Uniswap teased a video for Uni V3. For reference, Uniswap V2 is the version that popularized the exchange, so the new version understandably generated intense excitement.
Functionally, Uniswap V3 is the same as V2, but there are new features in V3 worth laying out.
4000x more capital efficient versus V2
In theory, V3 trades are hit with less slippage
LPs can decide sell price ranges for their assets
Different fee-tiers for LPs depending on risk
Cheaper gas costs using V3 instead of V2
To be clear, when using Uniswap, you can still toggle between Uniswap V3 and V2. Why would you use one over the other? Well, it depends.
If you’re a current LP and don’t want to migrate liquidity, Uniswap V2 still wins the day. But if you're a new or returning liquidity provider and want better modular support for your tokens, V3 is the way to go.
Here is where things get interesting. After rolling out Uniswap V3, the Uni team dropped an even bigger announcement — the mainnet rollout of Uniswap V3 on Optimism Network.
For the uninitiated, Optimism is an Ethereum scaling solution similar to Polygon Network. Like Polygon, Optimism takes transactions away from the Ethereum mainchain and onto the Optimism sidechain. The result is insanely cheap Uniswap transaction fees and almost instant processing time.
Liquidity providers are clearly in love with Uniswap on Optimism because the total value locked on the network has exploded to nearly $6 billion, surpassing both V2 + V3 versions on Ethereum combined.
Uniswap token (UNI) explained
Uniswap token, or UNI, is the native governance token for the Uniswap protocol. A governance token entitles the holder to rights in the Uniswap governance process like proposing issues and voting on them.
At face value, a governance token like UNI might not seem worth owning. After all, other tokens, like SUSHI, directly accrue value derived from transaction fee profit sharing.
But owning a governance token for the largest decentralized exchange in the world is valuable. The ways in which Uniswap treasury funds are spent, future use cases for the UNI token, changes to fee revenue sharing — all of these issues are decided by UNI token holders.
The point is this: even if UNI is nothing more than a governance token now, UNI token holders might add extra utility to the token later. Being a part of that process is crucial for anyone who believes in the Uniswap mission of keeping liquidity decentralized.