One of the main aspects that differentiate Centralized vs Decentralized exchange in the way these create or obtain liquidity.
Centralized exchanges like Coinbase use the traditional order book model, where either liquidity is created by buyers and sellers or there are one or multiple maker makers and market takers that are in charge of creating liquidity. Market Makers are entities that facilitates trading because they are always willing to buy or sell a particular asset. By doing that, they provide liquidity so users can always trade, and they don’t have to wait for another counterparty to show up
So why can’t we just reproduce this in DeFI?
We can, but it would be really slow, expensive and always result in poor user experience.
The reason is that the traditional order book model relies heavily on the exchange having Market Makers, or traditional market makers willing to always make the markets. Without Market Makers, an exchange becomes instantly illiquid and in pretty much unusable.
In a Decentralized Exchange like Uniswap, liquidity is provided in the form of liquidity pools
In its basic form, a single liquidity pool holds 2 tokens, and each pool creates a new market for that particular pair of tokens. When a new pool is created, the first liquidity provider is the one that sets the initial price of the assets in the pool. The liquidity Provider is incentivized to provide a supply of equal value of both tokens in the pool. If the initial price of the tokens in the pool, diverges from the current global market price, it creates an instant arbitrage opportunity.
When liquidity is supplied to a pool, the liquidity provider receives special tokens that are caller LP tokens in proportion of how much liquidity they supply to the pool.
When a trade is facilitated by the pool a 0.3% fee is proportionally distributed amongst all the LP (Liquidity Provider) token holders.
Each token swap that a liquidity pool facilitates results in a price adjustment according to a deterministic price algorithm.
This mechanism is also called, an automated market maker.