The Math of Liquidity: Automated Market Makers (AMMs)
How the formula x * y = k replaced the Wall Street order book.
In a traditional stock market, if you want to buy 10 shares of Apple, there must be someone else willing to sell 10 shares of Apple at that exact moment. This is an Order Book. On a blockchain, order books are too slow and expensive.
The solution was the Automated Market Maker (AMM)—the engine behind Uniswap.
The Liquidity Pool
Instead of matching buyers and sellers, an AMM uses a Liquidity Pool. Users (Liquidity Providers) deposit a pair of tokens (e.g., ETH and USDC) into a smart contract. Traders then trade against the contract, not another person.
The Golden Formula: x * y = k
The most common AMM uses the Constant Product Formula:
- x is the amount of Token A.
- y is the amount of Token B.
- k is a constant that must never change during a trade.
If you want to buy ETH with USDC, you are adding y (USDC) to the pool and removing x (ETH). To keep k the same, the price of ETH must increase. This creates an automatic "Price Discovery" mechanism. The more you buy, the more the price shifts (Slippage).
Why AMMs Won
AMMs are "Always On." You can trade a tiny, obscure token at 3 AM even if no one else in the world is online. They democratized market making—anyone with some spare capital can become a "market maker" and earn a share of the trading fees. It’s the ultimate "Permissionless" financial tool.