Decentralized exchange protocol
Uniswap and How Its Automated Market Maker Works
Uniswap is a decentralized exchange protocol that lets people trade crypto tokens directly from their own wallets, without an order book, a broker, or a company holding their funds. Instead of matching buyers with sellers, Uniswap uses pools of tokens supplied by ordinary users and a pricing formula written into smart contracts. Anyone can swap against those pools, and anyone can become a liquidity provider and earn a share of the trading fees.
The design matters because it changed what a market can look like. A traditional exchange needs market makers, custody, listing committees, and a matching engine. Uniswap replaced most of that with a few hundred lines of code deployed to Ethereum, where the rules are public, permissionless, and identical for everyone. Any ERC-20 token can get a market on Uniswap the moment someone funds a pool for it, which is both the protocol's greatest strength and the source of most of its risks.
Today Uniswap is one of the most widely used applications in decentralized finance, running across Ethereum and many of its layer-2 networks, with cumulative trading volume measured in the trillions of dollars. The protocol itself is a set of immutable contracts; the interfaces, wallet, and supporting infrastructure most people touch are built by Uniswap Labs, and the UNI token governs the protocol's remaining adjustable parameters and treasury.
2018
First version of Uniswap deployed to Ethereum mainnet
x · y = k
The constant product rule behind classic Uniswap pools
1 billion
Total supply of UNI, the Uniswap governance token
Origins and timeline
Uniswap was created by Hayden Adams, a mechanical engineer who began teaching himself Solidity in 2017 after being laid off. He built on ideas circulating in the Ethereum community at the time, including posts by Vitalik Buterin describing how an on-chain market maker could price assets with a simple invariant rather than an order book. An Ethereum Foundation grant supported the work, and the first version of Uniswap went live in November 2018.
That first release was deliberately minimal. Every market on Uniswap v1 paired a token with ether, so trading one ERC-20 for another meant routing through ETH in two hops. It was small, elegant, and cheap to reason about, and it proved the core claim: a formula plus a pool of deposits could produce continuous, reasonably efficient prices for illiquid assets that no centralized venue would list.
The 2020 "DeFi summer" made Uniswap mainstream. Version 2, released in May 2020, allowed direct pairs between any two ERC-20 tokens and added price oracles and flash swaps. Volume climbed sharply as lending protocols, yield farms, and new tokens all leaned on Uniswap pools for pricing and exit liquidity. In September 2020 the project distributed the UNI token to past users, an airdrop that became one of the defining events in crypto's retroactive-rewards era.
Since then the story has been one of refinement rather than reinvention. Uniswap v3 introduced concentrated liquidity in 2021, sharply improving capital efficiency. Uniswap Labs expanded beyond the web interface into a mobile wallet and browser extension, launched the intent-based UniswapX system, and later shipped Uniswap v4 with a plugin architecture. Reference material on the protocol's development is maintained on Wikipedia for readers who want an encyclopedic summary.
How the Uniswap automated market maker works
A Uniswap pool is a smart contract holding reserves of two tokens. In the classic constant product design, the contract enforces that the product of the two reserves stays the same across a trade, written as x · y = k. When you buy token X out of the pool, its reserve falls and the reserve of token Y rises, so the next buyer pays more. Price is therefore a function of the pool's composition, not of anyone's quote.
This produces a smooth curve rather than a ladder of orders. Small trades move the price slightly; large trades move it a lot. That relationship is called price impact, and it is the honest cost of trading against a finite pool. Uniswap does not hide it: the interface shows the expected impact before you confirm, and you set a slippage tolerance that causes the transaction to revert if the executed price drifts beyond your limit before the block is mined.
Liquidity providers are the counterparties. Depositing both tokens in the correct ratio mints a position representing a claim on the pool, and every swap pays a fee that accrues to those positions. In Uniswap v2 that fee was a flat 0.30% on every trade; later versions let each pool choose from several tiers so that stablecoin pairs and volatile pairs can price risk differently. Providers can withdraw at any time, taking their share of reserves plus accumulated fees.
Arbitrage keeps Uniswap honest. If the pool price drifts from the broader market, traders profit by correcting it, and that profit is paid by the pool. The mirror image of that dynamic is impermanent loss, sometimes called divergence loss: when the relative price of the two pooled assets changes, a liquidity provider ends up holding more of the weaker asset and less of the stronger one, so the position is worth less than simply holding the two tokens would have been. Fees may or may not compensate for it.
Everything happens in one atomic transaction. There is no deposit step, no withdrawal queue, and no account at Uniswap; tokens leave your wallet and the swapped tokens arrive in the same block, or nothing happens at all. The trade-off is that you are responsible for approvals, gas, and verifying which token contract you are actually trading.
Key takeaway
Uniswap turns market making into a passive, formula-driven activity. Traders get a guaranteed quote from on-chain reserves, liquidity providers get fees in exchange for taking inventory risk, and arbitrageurs tie Uniswap prices back to the rest of the market.
The Uniswap protocol versions
Each major release of Uniswap is a separate set of contracts that continues to run after its successor ships. Older pools are not migrated or shut off, because the contracts are immutable and nobody, including Uniswap Labs, can turn them off. In practice, liquidity migrates when it makes economic sense to move.
Uniswap v3, launched in May 2021, was the biggest conceptual leap. Rather than spreading liquidity evenly across all possible prices, providers choose a price range to concentrate their capital in. Within that band, a position behaves like a much deeper pool, so the same amount of money supports far more volume. The cost is active management: if the price leaves the chosen range, the position stops earning fees and sits entirely in one asset. Because each range is unique, Uniswap v3 positions are represented as NFTs rather than fungible pool tokens.
Uniswap v4 keeps concentrated liquidity but rebuilds the plumbing. All pools live in a single contract, which makes deploying a pool and routing across several of them dramatically cheaper, and an accounting system settles only net balances at the end of a transaction. The headline feature is hooks: optional contracts attached to a pool that can run custom logic at defined points, such as before or after a swap or when liquidity changes. Hooks let developers build dynamic fees, on-chain limit orders, and other behaviors on top of Uniswap without forking it.
Licensing has followed a similar arc. Uniswap v2 was released under a permissive open-source license and was copied widely, so Uniswap v3 shipped under a time-limited Business Source License that expired in 2023 and converted to GPL. The result is that the core ideas of Uniswap now underpin a very large share of decentralized exchange code across many blockchains.
| Version | Released | Defining change |
|---|---|---|
| Uniswap v1 | 2018 | ETH-to-token pools using the constant product formula |
| Uniswap v2 | 2020 | Any ERC-20 pair, time-weighted price oracles, flash swaps |
| Uniswap v3 | 2021 | Concentrated liquidity, multiple fee tiers, NFT positions |
| Uniswap v4 | 2025 | Singleton architecture, netted accounting, customizable hooks |
Routing, aggregation, and UniswapX
Most pairs do not have a single deep pool. Trading an obscure token for a stablecoin might mean hopping through ETH, splitting across two fee tiers, and touching several versions of Uniswap along the way. Routing software solves that search problem off-chain, simulates the candidate paths, and submits the cheapest one, which is why the quote you see in an interface often differs from a naive single-pool price.
UniswapX takes a different approach to the same problem. Instead of signing a specific route, a trader signs an order describing the outcome they want, and a competitive network of fillers bids to fulfill it, sourcing liquidity from Uniswap pools or elsewhere. Because the filler submits the transaction, gas can be embedded in the price, failed trades cost the user nothing, and orders can be filled across chains. It layers an intent-based auction on top of the pools rather than replacing them.
These systems also address maximal extractable value. Public pending transactions can be sandwiched by bots that trade ahead of a swap and behind it, pocketing the difference. Signed orders that settle through a filler network are harder to attack in that way, and Uniswap interfaces offer private transaction relays for direct swaps, though no approach removes the risk entirely.
Apps, interfaces, and the role of Uniswap Labs
It helps to separate two things that share a name. The Uniswap protocol is public infrastructure: contracts on a blockchain that anyone can call directly, through a competing front end, or through a bot. Uniswap Labs, a company based in New York, builds products that make the protocol usable, including the best-known web interface, a self-custodial mobile wallet, and a browser extension.
That distinction has real consequences. Uniswap Labs can and does curate which tokens appear by default in its interface, filter obvious scams, restrict access from certain jurisdictions, and charge an interface fee on some swaps. None of that changes the protocol, and a token hidden from one front end can still be traded on Uniswap by anyone who supplies the contract address. Users who rely on the interface get guardrails; users who bypass it get none.
Alongside the consumer apps, Uniswap Labs maintains developer tooling: SDKs, routing libraries, subgraphs, and documentation that let other teams integrate Uniswap liquidity into wallets, aggregators, treasury systems, and games. A large part of the protocol's volume arrives through these integrations rather than through any single website.
The UNI token and Uniswap governance
UNI launched in September 2020 with a fixed initial supply of one billion tokens, the majority earmarked for the community and the remainder allocated to team members, investors, and advisors on multi-year vesting schedules. The launch included a retroactive airdrop of 400 UNI to every address that had used Uniswap before a cutoff date, turning past users into governance participants overnight.
UNI is a governance token rather than a claim on revenue. Holders and their delegates vote on proposals that control the protocol's adjustable parameters, the community treasury, deployments of Uniswap contracts to new chains, and grant programs. Proposals typically start as forum discussion, move to an off-chain sentiment poll, and only then reach a binding on-chain vote with quorum and delegation thresholds. Because voting power can be delegated, a small number of delegates often carry substantial weight in Uniswap governance.
The most debated question in Uniswap governance is the fee switch. The contracts allow a portion of swap fees to be diverted from liquidity providers to the protocol, but activating it involves hard trade-offs: liquidity might migrate to venues that pay providers more, and turning a governance token into something resembling a revenue-sharing instrument raises legal questions in several jurisdictions. Proposals have been drafted, amended, and delayed repeatedly for exactly these reasons.
The Uniswap Foundation, established in 2022 after a governance vote funded it from the treasury, exists to support the ecosystem without controlling it. Its work centers on grants to researchers and builders, developer education, and improving the governance process itself. It is a steward of the community around Uniswap rather than an owner of the protocol.
Networks, layer 2s, and Unichain
Uniswap began on Ethereum mainnet, where security is strongest and fees are highest. As rollups matured, governance approved deployments to networks including Arbitrum, Optimism, Polygon, and Base, among others. The same contract logic runs on each chain, but liquidity is not shared: a pool on one network is entirely separate from the pool for the same pair elsewhere, so prices and depth differ by chain.
Cheaper blocks changed behavior more than most upgrades did. On mainnet, a small swap can cost more in gas than it saves in price improvement, which pushed casual trading toward layer 2s where a Uniswap swap costs a fraction of a dollar. It also made active management of concentrated liquidity positions practical, since rebalancing a range no longer carries prohibitive fees.
In 2024 Uniswap Labs announced Unichain, an Ethereum layer-2 network built with the OP Stack and designed around the needs of decentralized trading, with mainnet launch following in early 2025. The stated aim is faster blocks, lower costs, and better cross-chain liquidity for applications like Uniswap, while remaining a general-purpose network that any developer can build on.
Risks and trade-offs to understand
Permissionless listing is the biggest one. Anyone can create a pool for any token on Uniswap, including a token whose name and symbol copy a legitimate project. Nothing in the protocol verifies that a contract is what it claims to be, so verifying the token address from an independent source before trading is essential. Some tokens also contain code that blocks selling, taxes transfers, or lets a deployer mint freely.
Smart contract risk applies even to audited, long-running code. The core Uniswap contracts have been heavily reviewed and have operated for years at scale, which is meaningful evidence, but immutability cuts both ways: a flaw could not be patched in place. Risk rises further with hooks and third-party integrations built around Uniswap v4, since a pool is only as safe as the custom logic attached to it.
For liquidity providers, the central risk is that fees fail to cover impermanent loss. A concentrated position in a volatile pair can be profitable in calm markets and painful during a sharp move, and a range that goes out of bounds earns nothing while remaining fully exposed to the losing asset. Providing liquidity on Uniswap is an active trading strategy with a real risk profile, not a savings account.
Finally there is user-side risk that no protocol can eliminate: phishing sites imitating Uniswap front ends, malicious token approvals that drain wallets later, lost seed phrases, and irreversible transactions sent to the wrong address. Self-custody means there is no support desk that can reverse a mistake.
Practical guidance for using Uniswap
A swap follows a consistent pattern. Connect a self-custodial wallet, pick the network, select the input and output tokens, and review the quote, which shows the expected output, the price impact, the fee, and the route. ERC-20 tokens require a one-time approval before the first swap, and it is good practice to approve only the amount you intend to trade rather than an unlimited allowance. Keep enough of the network's native token to pay gas.
Slippage tolerance deserves attention. Setting it too tight causes transactions to fail in fast markets and wastes gas; setting it too loose invites a worse fill or a sandwich attack. Default settings in Uniswap interfaces are reasonable for liquid pairs, while thin or newly launched tokens may need more headroom and much smaller trade sizes to keep price impact manageable.
Providing liquidity requires an extra decision. Choose the pair and the fee tier, then pick a price range: wide ranges behave more like the older Uniswap model with lower fee density and less maintenance, while narrow ranges earn more per dollar but need attention and go idle when price moves away. Track fees earned against how much a simple hold would have returned, and remember that both position management and withdrawal cost gas.
A useful rule of thumb: if you cannot explain where the price on a Uniswap pool comes from and what happens to your position when it moves, you are not ready to size the trade up.
Legal and regulatory context
Because the protocol runs autonomously while a company builds the front end, Uniswap sits at the center of a genuine legal question: who, if anyone, is the operator of a decentralized exchange? In 2023 a US federal court dismissed a proposed class action that sought to hold Uniswap Labs responsible for losses on scam tokens traded through the protocol, reasoning in part that the claims were better directed at the token issuers than at the developers of the underlying code.
Regulatory attention followed the same theme. Uniswap Labs disclosed in 2024 that it had received a Wells notice from the US Securities and Exchange Commission signaling possible enforcement, and the company said publicly in early 2025 that the agency had closed the investigation without action. Rules for decentralized trading remain unsettled in most markets, and readers should treat coverage of Uniswap in outlets such as Reuters as a starting point rather than legal advice.
Frequently asked questions
Does Uniswap hold my funds?
No. Uniswap is non-custodial. Tokens stay in your wallet until the moment a swap executes, and the swapped tokens arrive in the same transaction. There is no account balance held on your behalf, which also means recovering funds sent by mistake is not possible.
What does it cost to trade on Uniswap?
Three components: the pool's swap fee paid to liquidity providers, the network gas fee, and price impact from moving the pool's reserves. Some Uniswap interfaces also add a separate front-end fee on certain swaps, which is disclosed in the quote before you confirm.
Do I need UNI to use Uniswap?
No. UNI is purely for governance. Trading and providing liquidity on Uniswap require only the tokens you are trading plus the network's native asset for gas. Holding UNI grants voting rights on proposals, not fee discounts or special access.
Why did my Uniswap transaction fail?
Usually because the price moved beyond your slippage tolerance before the transaction was mined, because the gas limit was too low for a multi-hop route, or because the token itself restricts transfers. Failed transactions still consume gas, since the network processed the attempt.
Can anyone list a token on Uniswap?
Yes, and that is the point of a permissionless protocol. Creating a pool and funding it is all it takes for a token to trade on Uniswap, with no review process. Front ends may filter or warn about unverified tokens, but the underlying market exists regardless, so independent verification of any token contract is on the user.
In short
Uniswap is a public pricing engine for tokens: pools instead of order books, formulas instead of quotes, and open access instead of listings. Understanding the fee structure, price impact, and impermanent loss explains nearly everything about how Uniswap behaves for both traders and liquidity providers.