Understanding How Crypto Liquidity Pools Work.

Understanding How Crypto Liquidity Pools Work.

General Information Research Tutorials
April 26, 2021 by DanCurranJr
What are Liquidity Pools? How do they work? And why do we even need them in decentralized finance? Also, what are the differences between liquidity pools across different protocols such as Uniswap, Balancer, or Curve? We’ll be going through all of this in this article. Before we start, if you’re new to DeFi you may

What are Liquidity Pools? How do they work? And why do we even need them in decentralized finance? Also, what are the differences between liquidity pools across different protocols such as Uniswap, Balancer, or Curve? We’ll be going through all of this in this article.

Before we start, if you’re new to DeFi you may want to read my introduction to decentralized finance article first.

Liquidity Pools

Liquidity pools, in essence, are pools of tokens that are locked in a smart contract. They are used to facilitate trading by providing liquidity and are extensively used by some of the decentralized exchanges a.k.a DEXes.

One of the first projects that introduced liquidity pools was Bancor, but they became widely popularised by Uniswap.

Before we explain how liquidity pools work under the hood and what automated market making is, let’s try to understand why we even need them in the first place.

Why Do We Need Liquidity Pools?

If you’re familiar with any standard crypto exchanges like Coinbase or Binance you may have seen that their trading is based on the order book model. This is also the way traditional stock exchanges such as NYSE or Nasdaq work.

In this order book model buyers and sellers come together and place their orders. Buyers a.k.a. “bidders” try to buy a certain asset for the lowest price possible whereas sellers try to sell the same asset for as high as possible.

For trades to happen, both buyers and sellers have to converge on the price. This can happen by either a buyer bidding higher or a seller lowering their price.

But what if there is no one willing to place their orders at a fair price level? What if there are not enough coins that you want to buy? This is where market makers come to play.

In essence, market makers are entities that facilitate trading by always willing to buy or sell a particular asset. By doing that they provide liquidity, so the users can always trade and they don’t have to wait for another counterparty to show up.

Okay, so why can’t we just reproduce something like this in decentralized finance?

The answer is – we can! It would just be really slow, expensive, and pretty much always result in poor user experience.

The main reason for this is the fact that the order book model relies heavily on having a market maker or multiple market makers willing to always “make the market” in a certain asset. Without market makers, an exchange becomes instantly illiquid and it’s pretty much unusable for normal users. On top of that, market makers usually track the current price of an asset by constantly changing their prices which results in a huge number of orders and order cancellations that are being sent to an exchange.

Ethereum with a current throughput of around 12-15 transactions per second and a block time between 10-19 seconds is not really a viable option for an order book exchange. On top of that, every interaction with a smart contract cost a gas fee, so market makers would go bankrupt by just updating their orders.

How about the 2nd layer scaling then? Some of the 2nd layer scaling projects like Loopring look promising, but even they are still dependant on market makers and they can face liquidity issues. On top of that, if a user wants to make only a single trade they would have to move their funds in and out of the 2nd layer which adds 2 extra steps to their process.

This is exactly why there was a need to invent something new that can work well in the decentralized world and this is where liquidity pools come to play.

How Do Liquidity Pools Work?

Ok, so now that we understand why we need liquidity pools in decentralized finance, let’s see how they actually work.

In its basic form, a single liquidity pool holds 2 tokens and each pool creates a new market for that particular pair of tokens. DAI/ETH can be a good example of a popular liquidity pool on Uniswap.

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 incentivised to supply an equal value of both tokens to 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 that can result in lost capital for the liquidity provider. This concept of supplying tokens in a correct ratio remains the same for all the other liquidity providers that are willing to add more funds to the pool later.

When liquidity is supplied to a pool, the liquidity provider (LP) receives special tokens called LP tokens in proportion to how much liquidity they supplied to the pool. When a trade is facilitated by the pool a 0.3% fee is proportionally distributed amongst all the LP token holders. If the liquidity provider wants to get their underlying liquidity back, plus any accrued fees, they must burn their LP tokens.

Each token swap that a liquidity pool facilitates results in a price adjustment according to a deterministic pricing algorithm. This mechanism is also called an automated market maker (AMM) and liquidity pools across different protocols may use a slightly different algorithm.

Basic liquidity pools such as those used by Uniswap use a constant product market maker algorithm that makes sure that the product of the quantities of the 2 supplied tokens always remains the same. On top of that, because of the algorithm, a pool can always provide liquidity, no matter how large a trade is. The main reason for this is that the algorithm asymptotically increases the price of the token as the desired quantity increases. The math behind the constant product market maker is pretty interesting, but to make sure this article is not too long, I’ll save it for another time.

The main takeaway here is that the ratio of the tokens in the pool dictates the price, so if someone, let’s say, buys ETH from a DAI/ETH pool they reduce the supply of ETH and add the supply of DAI which results in an increase in the price of ETH and a decrease in the price of DAI. How much the price moves depends on the size of the trade, in proportion to the size of the pool. The bigger the pool is in comparison to trade, the lesser the price impact a.k.a slippage occurs, so large pools can accommodate bigger trades without moving the price too much.

Because larger liquidity pools create less slippage and result in a better trading experience, some protocols like Balancer started incentivizing liquidity providers with extra tokens for supplying liquidity to certain pools.

The concepts behind liquidity pools and automated market-making are quite simple yet extremely powerful as we don’t have to have a centralized order book anymore and we don’t have to rely on external market makers to constantly keep providing liquidity to an exchange.

Different Types of Liquidity Pools

The liquidity pools that we just described are used by Uniswap and they are the most basic forms of liquidity pools. Other projects iterated on this concept and came up with a few interesting ideas.

Curve, for example, realized that the automated market-making mechanism behind Uniswap doesn’t work very well for assets that should have a very similar price, such as stable coins or different flavors of the same coin, like wETH and sETH. Curve pools, by implementing a slightly different algorithm, are able to offer lower fees and lower slippage when exchanging these tokens.

The other idea for different liquidity pools came from Balancer that realized that we don’t have to limit ourselves to having only 2 assets in a pool and in fact Balancer allows for as many as 8 tokens in a single liquidity pool.


And of course, like with everything in DeFi we have to remember about potential risks. Besides our standard DeFi risks like smart contract bugs, admin keys, and systemic risks, we have to add 2 new ones – impermanent loss and liquidity pool hacks – more on these in later articles.

Helpful? Useful? Enlightening?

Please consider making a small donation to CoinTutor.org. Any little bit helps the articles keep coming and the forums running. Pick a coin below, donate, and Thank You!

Please Add coin wallet address in plugin settings panel

Add a comment