Uniswap: Behind the Automated Market Maker

 ๐Ÿ”น Uniswap: Behind the Automated Market Maker


Uniswap is a decentralized exchange (DEX) that allows users to trade cryptocurrencies directly from their wallets — no centralized intermediaries needed.


At the heart of Uniswap is the Automated Market Maker (AMM) model.


1. What Is an AMM?


Traditional exchanges use order books (buyers and sellers place orders).


AMMs replace this with liquidity pools.


Trades are executed against a pool of tokens, not directly between two people.


๐Ÿ’ก Example: Instead of finding someone to trade ETH for USDC, you trade against the ETH/USDC liquidity pool.


2. Liquidity Pools


A pool is created with two tokens (e.g., ETH and USDC).


Liquidity providers (LPs) deposit an equal value of both tokens.


In return, LPs get LP tokens, which represent their share of the pool and entitle them to fees.


3. The Pricing Formula (Constant Product Rule)


Uniswap uses the formula:


๐‘ฅ

×

๐‘ฆ

=

๐‘˜

x×y=k


x = amount of Token A in the pool.


y = amount of Token B in the pool.


k = constant value (must remain unchanged).


✅ This means:


Prices adjust automatically based on supply and demand.


If someone buys ETH, the ETH in the pool decreases, and its price rises relative to USDC.


4. Swaps (How Trades Happen)


A user sends Token A to the pool.


The pool calculates how much Token B can be sent back (based on the formula).


A 0.3% fee (Uniswap v2) is taken from each trade and distributed to liquidity providers.


5. Liquidity Provider Incentives


LPs earn trading fees proportional to their share of the pool.


But they face a risk called impermanent loss:


If token prices move significantly, LPs may end up with fewer valuable tokens than if they just held them.


6. Uniswap Governance (UNI Token)


Governance is decentralized through the UNI token.


UNI holders vote on upgrades, fee models, and protocol changes.


✅ In short:


Uniswap’s AMM replaces order books with liquidity pools.


Formula x × y = k keeps the pool balanced.


Traders swap tokens, LPs earn fees, and UNI holders govern the system.

Learn Blockchain Course in Hyderabad

Read More

How Compound Protocol Works

Common Smart Contract Design Patterns

๐Ÿ”น Smart Contracts & Protocols

How to Set Up Your First AI Project


Comments

Popular posts from this blog

Handling Frames and Iframes Using Playwright

Cybersecurity Internship Opportunities in Hyderabad for Freshers

Tosca for API Testing: A Step-by-Step Tutorial