Decentralized exchange protocol
Uniswap and How Automated Market Making Works
Uniswap is a decentralized exchange protocol that lets people trade crypto tokens directly from a self-custody wallet, without an order book, a broker, or an account. Instead of matching buyers with sellers, Uniswap uses pools of tokens supplied by users and a mathematical formula that sets prices automatically. This guide explains the mechanics, the differences between protocol versions, what liquidity providers actually earn and risk, how the UNI governance token fits in, and what a newcomer should know before their first trade.
What Uniswap is
Uniswap is a set of smart contracts deployed on Ethereum and a growing list of compatible blockchains. Those contracts hold token reserves and execute trades according to fixed rules that anyone can read. Because the rules live on a public blockchain, no company approves your trade, holds your funds in between, or can quietly reverse it. When people say they "used Uniswap," they usually mean they sent a transaction to one of these contracts through a website, a wallet, or another application that talks to the protocol.
The protocol was created by Hayden Adams and went live on Ethereum in November 2018. The idea grew out of writing by Ethereum co-founder Vitalik Buterin on automated market makers, and Uniswap turned that concept into a working, general-purpose exchange that any token could join without permission. That last point matters more than it sounds: listing a token on Uniswap does not require an application or a fee paid to a gatekeeper. Anyone can create a market for any pair of tokens.
Two distinct things share the name. The Uniswap Protocol is the on-chain code, governed by holders of the UNI token. Uniswap Labs is the company that built the original protocol and continues to develop front-end software, including a web app, a mobile wallet, and a browser extension. The protocol keeps running whether or not any particular interface exists, which is one of the reasons people describe Uniswap as infrastructure rather than a service.
By trading volume, Uniswap has consistently ranked among the largest decentralized exchanges in the industry, and its cumulative volume across all versions is measured in the trillions of dollars. Its design has been copied, forked, and adapted so widely that "Uniswap-style AMM" has become shorthand for an entire category of exchange.
Key takeaways
- ▸Uniswap replaces the order book with liquidity pools and a pricing formula.
- ▸You keep custody of your assets the entire time; trades settle from your own wallet.
- ▸Anyone can list a token or supply liquidity, which means anyone can also list a worthless or malicious one.
- ▸Four major protocol versions exist, each changing how liquidity is stored and priced.
How the automated market maker works
A traditional exchange keeps an order book: a list of bids and asks waiting to be matched. Uniswap does away with that. Each market is a pool holding reserves of two tokens, and the ratio between those reserves determines the price. Buying token A from the pool removes some A and adds some B, which shifts the ratio and makes the next unit of A slightly more expensive. Selling pushes the price the other way. The pool is always willing to quote, which is why it is called an automated market maker.
The original pricing rule in Uniswap is the constant product formula, written as x × y = k. Here x and y are the reserves of the two tokens and k is a constant that the trade must preserve, ignoring fees. Because the product stays fixed, the reserves trace a curve rather than a straight line: small trades barely move the price, while large trades relative to pool size move it a great deal. That curvature is the entire pricing mechanism, and it is deliberately simple so that the contract stays cheap to run and easy to audit.
Nothing in the formula knows what a token is "really" worth. Uniswap prices reflect only the pool's internal ratio, and they stay aligned with the wider market because arbitrage traders profit from correcting them. If a token trades higher elsewhere, someone buys it cheaply from Uniswap and sells it at the higher venue until the gap closes. This constant arbitrage pressure is what keeps a Uniswap pool tracking global prices without any oracle telling it what to do.
Every swap pays a fee that stays in the pool, increasing the reserves and therefore the value of each liquidity provider's share. In the earliest design the fee was a flat 0.3% on every trade. Later versions of Uniswap introduced multiple fee tiers so that stablecoin pairs, which barely move against each other, can charge far less than volatile or exotic pairs.
Two numbers dominate the trading experience. Price impact is how much your own trade moves the pool's price, and it grows with trade size relative to pool depth. Slippage tolerance is the maximum unfavorable price change you will accept between submitting a transaction and it being included in a block. Uniswap interfaces let you set that tolerance; too tight and your transaction fails, too loose and you may get a worse fill than expected.
One more property is worth understanding. Because Uniswap settles on a public blockchain, pending transactions are visible before they confirm. Sophisticated actors can reorder or insert transactions around yours to capture value, a practice broadly known as MEV. Modern Uniswap routing and third-party private transaction relays exist partly to reduce that exposure.
The protocol versions
Uniswap has shipped four major versions, and older ones keep running because immutable contracts cannot be switched off. Understanding the differences helps explain why liquidity behaves differently from pool to pool and why some tokens are deeper on one version than another.
| Version | Year | Defining change |
|---|---|---|
| v1 | 2018 | Proof of concept; every pool paired a token against ETH |
| v2 | 2020 | Direct token-to-token pools, flash swaps, time-weighted price oracles |
| v3 | 2021 | Concentrated liquidity, multiple fee tiers, positions as NFTs |
| v4 | 2025 | Hooks, singleton contract, flash accounting, native ETH pools |
Uniswap v1
The first release of Uniswap was intentionally minimal. Every pool paired an ERC-20 token with ETH, so trading one token for another meant routing through ETH in two hops. The contracts were written in Vyper and demonstrated that a few hundred lines of code could run a functioning exchange. Uniswap v1 proved the model but was quickly superseded.
Uniswap v2
Released in May 2020, Uniswap v2 allowed pools between any two ERC-20 tokens, removing the forced hop through ETH. It also added flash swaps, which let a caller withdraw tokens from a pool and return them within the same transaction, and on-chain time-weighted average price oracles that other protocols could read. Liquidity providers in v2 receive fungible LP tokens representing a pro-rata share of the whole pool.
Because v2 spreads liquidity evenly across every possible price from zero to infinity, it is simple and forgiving. A v2 position never goes out of range and never needs management. That simplicity is why many long-tail tokens still launch their first Uniswap market on v2 and why v2 remains widely forked.
Uniswap v3
Uniswap v3, launched in May 2021, introduced concentrated liquidity, the most consequential change in the protocol's history. Instead of spreading capital across all prices, a provider chooses a specific price range. Within that range the position behaves like a much larger v2 position, so the same capital supports far deeper markets and earns a larger share of fees. Outside the range it earns nothing and sits entirely in one of the two tokens.
Because every position can have a different range, v3 shares are not interchangeable, so Uniswap represents each one as an NFT rather than a fungible LP token. The version also introduced several fee tiers per pair, letting the market decide whether a given pool deserves a low fee for tight-spread assets or a higher one for volatile pairs.
Concentrated liquidity is powerful but demands attention. A narrow range multiplies fee income while the price cooperates and stops earning the moment it does not. Managing v3 positions on Uniswap is closer to active market making than passive deposit, and an ecosystem of automated managers grew up specifically to rebalance them.
Uniswap v4
Uniswap v4 was announced in 2023 and reached Ethereum mainnet in early 2025. Its headline feature is hooks: optional contracts attached to a pool that run at defined moments, such as before or after a swap or a liquidity change. Hooks let developers build dynamic fees, on-chain limit orders, custom oracles, or automated liquidity strategies directly into a pool rather than wrapping the protocol from outside.
The other major change is architectural. Earlier versions deployed a separate contract for every pool, which made creating pools expensive and multi-hop routes gas-heavy. Uniswap v4 holds all pools inside a single contract and uses flash accounting, settling only the net token balances at the end of a transaction instead of moving tokens at every step. The result is cheaper pool creation and cheaper complex routes, and v4 also supports pools that hold native ETH rather than requiring a wrapped version.
Providing liquidity
Liquidity providers are the reason Uniswap has anything to trade against. A provider deposits both tokens of a pair into a pool and receives a claim on that pool. Every swap routed through it pays a fee that accrues to the position. Withdrawing returns the underlying tokens plus accumulated fees, in whatever ratio the pool happens to hold at that moment.
The uncomfortable part is that the ratio changes. When one token rises against the other, arbitrageurs buy it out of the pool, so a provider ends up holding more of the falling asset and less of the rising one. Compared with simply holding both tokens in a wallet, that rebalancing produces a shortfall usually called impermanent loss, or more precisely, loss versus rebalancing. It is only "impermanent" if prices return to where they started, which they often do not.
So the real question for anyone supplying liquidity on Uniswap is whether fee income exceeds that divergence cost over the holding period. High-volume pairs with modest price divergence, such as two stablecoins or two correlated assets, tend to favor the provider. Volatile pairs can generate large fees and still lose money if one side runs away.
Version choice changes the calculation. A v2 position on Uniswap is passive and always in range but earns fees on only a sliver of its deployed capital near the current price. A v3 or v4 position concentrated tightly around the current price earns dramatically more per dollar while it stays in range, and stops earning entirely when it does not. Wider ranges behave more like v2; narrower ranges behave more like an active trading strategy.
Practical advice for newcomers is unglamorous. Start with a pair you would be comfortable holding anyway, in an amount you can afford to see decline, and track performance against simply holding the two tokens rather than against zero. Check whether the fee tier suits the pair. And remember that gas costs to open, adjust, and close a Uniswap position are real, which is why small positions are often better suited to cheaper networks than Ethereum mainnet.
Fees and costs
Three separate costs can appear in a single Uniswap trade, and confusing them is a common source of frustration. The first is the pool fee, paid to liquidity providers. The second is the blockchain's gas fee, paid to network validators and entirely outside the protocol's control. The third is any interface fee charged by the front end you happen to be using.
Pool fees are set per pool. Uniswap v2 used a single 0.3% rate for every pair. Uniswap v3 introduced a menu of tiers so that pools can price their risk appropriately, and v4 goes further by allowing hooks to adjust fees dynamically based on conditions such as volatility.
| Fee tier | Typically used for |
|---|---|
| 0.01% | Pairs expected to hold a near-constant ratio, such as two stablecoins |
| 0.05% | Stable or tightly correlated pairs |
| 0.30% | Most standard pairs of established tokens |
| 1.00% | Exotic or highly volatile pairs |
Gas is usually the bigger surprise. On Ethereum mainnet a Uniswap swap during congestion can cost more than the trade itself for small amounts. The same swap on a layer-2 network typically costs a small fraction of that, which is a large part of why Uniswap deployments spread across so many chains.
Interface fees are separate from the protocol. Uniswap Labs introduced a fee on swaps made through its own front ends for certain tokens in 2023; the fee is charged by the application, not by the on-chain contracts, and other interfaces that route to the same Uniswap pools may charge differently or not at all. It is worth knowing which layer any quoted fee belongs to.
Routing, aggregation, and UniswapX
Rarely does a trade go through a single pool. If you want to swap an obscure token for a stablecoin, the best price may come from splitting the order across several Uniswap pools and versions, or hopping through an intermediate asset. The routing engine behind a Uniswap interface searches these possibilities and picks a combination that maximizes output after gas.
UniswapX, introduced in 2023, takes a different approach. Rather than specifying an exact route, you sign an order describing the outcome you want. Third-party fillers then compete to fulfill it, sourcing liquidity from Uniswap pools or elsewhere, and the price improves through a Dutch auction. Because fillers submit the transaction, failed swaps do not cost the user gas, and the design reduces some forms of value extraction.
This intent-based model also enables cross-chain swaps, where a user gives up an asset on one network and receives a different asset on another without manually bridging. The trade-off is added complexity and reliance on the filler network rather than a direct call to a pool.
For most users the practical takeaway is simple. The quote you see in a Uniswap interface already accounts for routing across versions and pools, so comparing it against a single pool's spot price will usually be misleading. Compare final output amounts instead.
UNI and protocol governance
UNI is the governance token of the Uniswap Protocol, launched in September 2020 with a total supply of one billion tokens distributed over four years. Its debut included a widely discussed airdrop that granted 400 UNI to every address that had used the protocol before a cutoff date. A majority of the supply was allocated to the community, with the remainder split among the founding team, investors, and advisors on vesting schedules.
Holding UNI is not a claim on trading fees by default. It is a vote. Token holders, or delegates they appoint, decide on proposals such as deploying Uniswap on a new blockchain, funding grants, adjusting parameters the contracts expose, and changing governance rules themselves. Proposals typically move through informal discussion, temperature checks, and then a binding on-chain vote with quorum and delegation requirements.
The most debated governance question has been the so-called fee switch. The Uniswap contracts contain an optional mechanism that would divert a portion of pool fees away from liquidity providers, and turning it on has been proposed repeatedly in various forms, including designs that would reward UNI holders who delegate and stake. The debate touches economics, provider incentives, and legal questions about what such a distribution would imply, which is why it has taken years without a simple resolution.
Two organizations sit alongside the token. Uniswap Labs builds software and does not control the protocol's governance. The Uniswap Foundation, established by a governance vote, funds research, grants, and ecosystem development. Neither can unilaterally change deployed contracts, because core Uniswap pool contracts are immutable once live.
It is worth being precise about what governance can and cannot do. It cannot seize funds from a pool, reverse a trade, or delist a token that someone else created. It can steer treasury spending, authorize new deployments and licenses, and flip parameters that the code exposes. Understanding that boundary makes Uniswap governance headlines much easier to read.
Apps and interfaces
The protocol is code; the way most people reach it is an app. Uniswap Labs maintains a web interface for swapping and managing liquidity positions, a self-custody mobile wallet released for iOS in 2023 and later for Android, and a browser extension that pairs with the same accounts.
Because the contracts are public, the Uniswap interface is not the only door. Wallets, portfolio trackers, and aggregators route orders into the same pools, and independent front ends exist. A trade made through any of them settles identically on-chain, though quoted prices can differ based on routing quality and any interface fee.
Uniswap Labs also publishes developer tooling, including SDKs, subgraphs for indexed pool data, and open-source contracts. This is a significant part of why so many other applications embed Uniswap liquidity rather than building their own exchange: it is generally easier to route through existing pools than to bootstrap new ones.
A recurring safety point deserves emphasis here. Phishing sites imitating Uniswap interfaces are common, and connecting a wallet to a fraudulent clone can result in signing an approval that drains tokens. Bookmark the interface you use, verify the domain before connecting, and treat unsolicited links with suspicion.
Networks and deployments
Uniswap began on Ethereum and, through governance approvals, expanded to many EVM-compatible networks, including major layer-2 rollups and several alternative chains. Each deployment is a separate set of contracts with its own pools and its own liquidity, so a token can be deep on one network and nearly untradeable on another.
The motivation is cost. Layer-2 networks settle to Ethereum while executing transactions far more cheaply, which makes small swaps and active liquidity management practical. For many users, the difference between a Uniswap trade on mainnet and the same trade on a rollup is the difference between viable and not.
Uniswap Labs also introduced Unichain, an Ethereum layer-2 network built with decentralized trading in mind, with its mainnet arriving in 2025. It represents an extension of the same thesis: if the protocol's biggest practical constraint is the cost and latency of the underlying chain, then improving that layer improves the trading experience directly.
Risks to understand
Permissionless listing is the defining feature of Uniswap and also its sharpest edge. Anyone can create a pool for any token, including one designed to be a trap. A token may be unsellable by design, may allow its deployer to mint unlimited supply, or may simply be an impostor using the name and logo of a legitimate project. The protocol will price it exactly the same way it prices anything else, because it has no opinion.
Rug pulls follow a familiar pattern: a team seeds a Uniswap pool, marketing drives buying, and the deployer then withdraws the liquidity, leaving holders with tokens that have no market. Checking the contract address against an official source, looking at liquidity depth and how long it has existed, and treating anonymous tokens with skepticism are the basic defenses.
Smart contract risk is smaller on core Uniswap contracts than on most of DeFi, given years of use, audits, and bug bounties, but it is never zero. It is meaningfully higher for peripheral contracts and, in v4, for third-party hooks. A hook is arbitrary code attached to a pool, so evaluating a v4 pool means evaluating its hook as well as its assets.
Execution risk shows up as slippage, price impact, and front-running. A large order into a thin Uniswap pool can move the price against you significantly, and a sandwich attack can capture part of that movement. Setting a sensible slippage tolerance, breaking up large orders, and using routing that limits exposure all help.
Custody risk sits entirely with the user. There is no support desk that can restore access, reverse a mistaken transaction, or recover funds sent to the wrong address. Losing a seed phrase means losing the assets, and approving a malicious contract can allow it to move tokens later. Reviewing and revoking stale token approvals is good hygiene for anyone who uses Uniswap regularly.
Finally, none of this is investment advice. Liquidity provision on Uniswap is a strategy with a real chance of underperforming simply holding the assets, and token trading carries the risk of total loss. Tax treatment of swaps and liquidity positions varies by jurisdiction and is worth checking locally.
Making a first swap
The mechanics are short. You need a self-custody wallet, some of the network's native token to pay gas, and the asset you intend to trade. Connect the wallet to a Uniswap interface, choose the network, select the two tokens, and enter an amount. The interface returns a quote, an estimated price impact, and a minimum received figure based on your slippage setting.
For an ERC-20 token you will usually sign an approval first, granting the contract permission to move that token, then sign the swap itself. Uniswap interfaces often use signature-based approvals that avoid a second on-chain transaction, but the two-step logic is the same. Approvals are worth understanding because they persist until revoked.
Before confirming, do three quick checks. Verify the token's contract address rather than trusting the ticker, since names on Uniswap are not unique. Look at the price impact and be suspicious of anything unusually large. And confirm you are on the network you intended, because tokens with the same name on different chains are different assets.
A sensible first trade is a small one. The point is to see the entire flow, including gas costs and how long confirmation takes, before committing meaningful funds. Everything about Uniswap becomes easier to reason about once you have watched one transaction go through from start to finish.
History and regulatory context
Uniswap launched in November 2018 into a quiet market and grew slowly for a year. The turning point was 2020, when the release of v2 coincided with a surge of interest in decentralized finance, and again in September of that year when the UNI airdrop distributed governance tokens to past users. That airdrop became a template that dozens of later projects imitated.
The v3 release in 2021 reset expectations for capital efficiency and prompted a wave of competing designs. Uniswap initially published v3 under a business source license that restricted commercial forks, and that license expired in 2023, after which the code became broadly available. The pattern repeated with v4, which arrived with hooks and a redesigned architecture in 2025.
Regulatory attention has followed the growth. In 2024 the U.S. Securities and Exchange Commission issued a Wells notice to Uniswap Labs signaling possible enforcement, and in 2025 the agency closed that investigation without bringing charges. Separately, the Commodity Futures Trading Commission settled with Uniswap Labs in 2024 over leveraged token trading available through its interface. These actions targeted the company and its front end rather than the on-chain protocol, a distinction central to how decentralized exchanges are debated by regulators.
The broader legal question remains open in many jurisdictions: who, if anyone, is responsible for a market that runs as immutable code and is accessed through many independent interfaces. Uniswap sits at the center of that question precisely because it is one of the largest and most-copied examples. For background reading, the Wikipedia entry on Uniswap collects references to primary coverage.
Frequently asked questions
Does Uniswap hold my funds?
No. Trades on Uniswap execute directly between your wallet and a pool contract in a single transaction, so there is no deposit step and no account balance held on your behalf. The trade-off is that you alone are responsible for your keys and for what you sign.
Do I need UNI tokens to use Uniswap?
No. UNI is a governance token, not a requirement for trading. You can swap or provide liquidity on Uniswap without ever holding it. What you do need is the network's native gas token, such as ETH on Ethereum, to pay transaction fees.
Why did my transaction fail and still cost gas?
Usually because the price moved beyond your slippage tolerance before the transaction was mined, so the Uniswap contract reverted to protect you from a worse fill. The network still charges for the computation attempted. Raising slippage slightly or trading a smaller size on a deeper pool typically resolves it.
Is providing liquidity the same as earning interest?
No, and the comparison misleads people. Fees earned on Uniswap are real income, but the composition of your position changes with price, so your total return can be negative even with healthy fee revenue. Always benchmark against holding the two tokens directly.
Which version should I use?
For swapping, you generally do not choose; Uniswap routing selects whichever pools give the best output. For providing liquidity, v2-style pools suit hands-off participants, while concentrated liquidity in v3 and v4 rewards active management and range selection.
Can a token be removed from Uniswap?
The pool itself cannot be deleted, because the contracts are immutable. An interface can hide a token from its own token list or search results, but the underlying Uniswap pool remains reachable by anyone who queries the contracts directly. Filtering happens at the application layer, not the protocol layer.
The short version
Uniswap turned a simple equation into a global, always-open marketplace where prices come from pooled reserves rather than matched orders. Its strengths are openness, transparency, and self-custody; its costs are gas, permissionless listings that include bad actors, and the genuine complexity of liquidity provision. Anyone approaching Uniswap for the first time is best served by starting small, verifying contract addresses, and learning what each fee and setting actually does before scaling up.