Learn Center
Crypto Liquidity Pools in DeFi: How They Work

Crypto Liquidity Pools in DeFi: How They Work

A primer on crypto liquidity pools, token swaps and how they impact DeFi through decentralized exchanges.

Breaking Down Crypto Liquidity Pools

What exactly is a liquidity pool, and what role do liquidity pools play in DeFi protocols? Anyone looking to learn more about decentralized exchanges has probably come across this term, but it’s not always clear what it means for practical use.

In the crypto market, liquidity is basically a measurement of how easily a token can be bought or sold without majorly impacting the price. In essence, it’s referring to how many buyers and sellers there are, as well as how easy it is to execute a trade between them. A market is considered liquid when there are enough buyers and sellers willing to trade an asset at any given time without causing drastic price changes.

A liquidity pool basically provides enough liquidity for easier transactions of crypto assets to take place. In this LNSwap Learn Center post, you’ll learn more about what a liquidity pool is, what liquidity pools provide and, as a result, why DeFi protocols, both on the Bitcoin blockchain and otherwise, use liquidity pools for their operations.

History of Crypto Liquidity Pools: Why Are Liquidity Pools Important?

The first thing to understand about liquidity pools is why they're so important. In short, it’s because an asset’s liquidity is a key factor in how easy it is to buy, sell or exchange the asset in question.

When decentralized exchanges (DEXs) first came on the scene, they were less advanced. The earliest DEXs, like EtherDelta or IDEX, relied on order books to conduct trades. This meant that they needed to match buying and selling numbers and required involving third parties in the exchange before assets could be released.

In a 2016 blog post, Vitalik Buterin proposed the concept of an Automated Market Maker (AMM), which algorithmically determines asset prices and automates trades. This was a huge moment for DEXs, as it ultimately spurred the transition from order books into liquidity pools. Because AMMs don’t involve any extra players, it speeds up the process for users. Another big player in this space was Uniswap, a DEX that helped to popularize liquidity pools and establish their importance in the DeFi ecosystem.

How Liquidity Pools Work

Source: LNSwap

Liquidity pools are made up of various components. The first step to understanding liquidity pools is understanding how token deposits work.

In order to create a liquidity pool, one party (known as a liquidity provider) would deposit an equal value of two different assets to establish a trading pair. For example, if you deposit $5,000 BTC and $5,000 worth of ETH, that would make a liquidity pool. These pools automatically function through AMMs that connect a user to the smart contract that holds their requested assets. The AMMs also set the price of the cryptocurrency you want to trade through their algorithms.

This is a perk for buyers and sellers. Someone looking to conduct a trade or token swap will be able to do so without a centralized intermediary – such as a trader – getting involved in the action. This allows for instant, seamless trades.

Providers are incentivized to increase liquidity because they receive rewards, which are accrued from transaction fees on the platform where the trades are conducted. These rewards typically include a percentage of trading fees or platform-specific crypto tokens that can appreciate in value.

In addition to incentivizing providers, these rewards can also help buffer the risk of what’s known as impermanent loss. This is when volatility in the crypto market causes the value of the deposited tokens in a pool to be lower than the initial deposit. Basically, if someone were to trade their tokens out of the pool at that point, it would be at a loss. That’s why liquidity providers earn rewards. If there were no incentive and only risk, no one would want to do it.

Different Types of Liquidity Pools in DeFi

Liquidity pools aren’t a monolith. There are different types that serve different general aims. Some of the most common include:

  • Constant Product: This is pretty much the classic liquidity pool and the most common type. This pool keeps the prices of your tokens fixed. For example, if you deposited an equal amount of BTC and ETH, but one of those valuations changed, the pool would maintain equal values. The total value of your BTC would always equal the total value of your BTC.
  • Constant Sum: These are also known as Balancer pools. These types of pools use an algorithm to maintain a constant sum between the two tokens. So as one token is purchased and its price increases, so does the price of the other one.
  • Hybrid Pools: Hybrid pools combine the characteristics of constant product and constant sum pools to provide more flexibility. They can be customized to meet specific requirements. An example of this type of pool is SushiSwap, which allows providers to earn tokens in addition to the typical fees.
  • Stablecoin Pools: These pools, also known as Curve pools, are designed to minimize losses. The lower volatility of the coins means there tends to be less impermanent loss for providers.
  • Liquidity Bootstrapping Pools: This type of pool allows new token creators to launch with only a small amount of initial capital. This way, each project has time to bootstrap their token’s value as they attract liquidity. An example of one of these pools is Balancer LBP.
  • Dynamic Fee Pools: This type of pool operates by adjusting transaction fees based on congestion and demand. Think of it like a surge price. When the network is experiencing higher congestion, transaction fees go up. This incentivizes miners to prioritize processing transactions more quickly. Conversely, when demand is low, the fees decrease to make transactions more affordable.

The Pros & Cons Of Liquidity Pools

Like anything else, there are both pros and cons to using a liquidity pool.

Liquidity pools work to simplify DEX trading. They allow users to complete transactions seamlessly at real-time prices, and they utilize smart contracts that allow users to verify security information in a transparent manner. They incentivize people to provide liquidity by allowing them to receive rewards or a yield on their crypto. This increases overall liquidity and helps avoid low liquidity situations.

On the other hand, they aren’t risk-free for providers or users. The price of tokens can drop, which can impact liquidity providers’ returns or expose them to impermanent loss. The use of smart contracts can also open up security risks due to hacking. Depending on the liquidity pool setup, users will have limited control of their assets until they have withdrawn their funds. Additionally, there is always a risk of exit scams that users should be on the lookout for.

Breaking Down LNSwap's Liquidity Pool for Liquidity Providers

LNSwap, a Trust Machines product, relies on atomic swaps and a network of users, liquidity providers and aggregators to facilitate token swaps between Bitcoin and digital assets on the Stacks layer. LNSwap protocol’s liquidity providers – who provide funds with assets they own – are rewarded with fees generated by swaps on the platform. Aggregators are those who gather and consolidate data on the swaps happening on the protocol. LNSwap's current aggregator is a router that forwards swap information between users and LPs, but the intention is to eventually move the aggregator to be an on-chain contract.

The users looking to swap their assets have their funds locked into a basic hash time-locked contract (HTLC) for only the length of time the swap lasts. Most other pools let the smart contract just run its course, but with LNSwap, these HTLCs are only there to help people lock or release their funds. This method gives users control over their assets for pretty much the entire time, in contrast to other protocols.

Given that the smart contract is only locking and releasing funds during the swap process, it is important to note that LNSwap users will need to run their own Bitcoin and Lightning nodes.

Decentralized Exchanges Rely On Liquidity Pools

DEXs rely on liquidity pools in order to enable seamless token swaps and more. In many ways, they are the bread and butter for DeFi protocols and enable many of their functions.

The more that users understand about the various components that make up a pool and how different types of pools operate, the better positioned they’ll be to explore DeFi and its possibilities.

For more on liquidity pools and how they operate with LNSwap, you can take a look at how swaps are conducted on the LNSwap platform.

Posted on: Sep 14, 2023

Updated on: Sep 11, 2023

This is some text inside of a div block.

Start swapping Bitcoin for Stacks

LNSwap is a non custodian crypto currency swap protocol that provides a fast, private way of swapping Bitcoin for Stacks and vice versa.