Users who pay close attention to decentralized finance are familiar with the term AMM or Automated Market Maker. It is a very intriguing concept that facilitates trading without human intervention. Traders always receive a price at which they can buy or sell certain assets. Depending on the order volume, this can affect the overall average price for better or worse.
The main advantage of using AMM is the unreliable environment. Pricing information often comes from multiple APIs to ensure the most accurate cost at all times. In addition, anyone can become a liquidity provider to automated market makers and receive a trading commission for doing so.
In terms of volume, AMMs are the most popular DeFi concept in the market today. They represent billions in liquidity and trading volume. However, a decentralized way of trading cryptocurrency that empowers all users is what this industry needs more of.
What is market making?
Before we explore how AMMs work and what functions they perform, we need to explain what market-making is in the first place.
Simply put, market making is the activity of providing liquidity to the market by simultaneously setting prices for both buying and selling an asset.
When a user wants to buy a financial asset, say a cryptocurrency such as Bitcoin, they must first access a cryptocurrency exchange where buyers and sellers meet.
A typical centralized cryptocurrency exchange would use an order book and order matching system to match buyers with matching sellers. The order book is a dynamic, real-time electronic record that stores and displays all orders to buy or sell cryptocurrencies at different prices at any given time. The order matching system is a specialized software protocol that matches and calculates the orders registered in the order book.
Sometimes, if there is a limited number of counterparties with which to trade, a user may not be able to execute their Bitcoin order on an exchange. When this happens, we say that “the Bitcoin market is illiquid”.
In this respect, liquidity is an indicator or measure of “availability”. That is, it is the speed at which an asset can be bought or sold without noticeably affecting its price stability.
When a market is illiquid, there are not enough assets or traders available. It becomes difficult to execute a trade without significantly affecting the price of an asset on that particular exchange.
To guarantee liquidity, centralized exchanges employ professional traders, represented by banks, brokerage houses, and many other financial groups. They constantly provide the exchange with a “spread/e/d between buyers and sellers”. In other words, these market makers constantly offer to buy and sell an asset at different prices so that users always have someone to trade with. The process of providing liquidity to exchange is called market making and the organizations that provide this service are called market makers.
The role of a market maker is to make financial markets more efficient and reduce volatility in asset prices by providing consistent liquidity for assets.
How does Automated Market Maker (AMM) work?
At first glance, it may seem that a traditional exchange and an automated market maker are one and the same. This is because they both facilitate trading in different markets with an acceptable commission. However, there are a few important differences to keep in mind.
First, AMM does not have an order book. Instead, its liquidity pool is used to buy and sell in real-time at the best possible price. Asset values are valued using mathematical formulas and data derived from decentralized price oracles. Due to the built-in pricing algorithms, transactions are executed immediately and at the current price.
The different AMM protocols support different pricing algorithms and formulas for determining the value of assets. There is nothing for the user to worry about, but there are slight differences.
It could be argued that an automated market maker is not much different from an exchange in terms of trading pairs. However, most AMMs have many more markets, allowing for other trading options. The big difference is that AMMs do not require counterparties to execute orders or traders, as everything depends on the liquidity in the trading-pair pool. All interactions take place through a smart contract, not traders.
Some decentralized exchanges go even further and allow users to trade directly between their wallets. Such peer-to-peer transactions remain a big advantage of the cryptocurrency industry today. AMMs, on the other hand, are peer-to-peer because they eliminate the need for an active second trader while an order is being sent.
Understanding the AMM Liquidity Pools
As decentralized exchanges and automated market makers abandon the idea of an order book, market making requires a different approach. Instead of using a maker and receiver order book, AMMs rely on liquidity pools. For example, ETH-USDT is a pair where users can share their ETH and USDT liquidity to generate trading fees. In most cases, users need to contribute the same value for each asset to ensure pool stability.
The main feature of an automated market maker is how anyone can become a market maker. Adding funds to the liquidity pool is straightforward and takes seconds. Depending on the platform used, trading commissions for liquidity providers may be higher, lower, or equal to 0.3%. Popular pairs will generate more commissions and more liquidity providers will compete for their share of the proverbial pie.
AMMs are gradually reaching a peak in popularity. Developing the perfect system takes time. Organizing AMM exchanges on bitcoin’s underlying blockchain is what OmniBOLT does. Using the Lightning Network opens up exciting new possibilities.
The automatic market maker model on lightning network holds significant advantages compared to the on-chain AMM exchanges:
- There is no gas fee for each swap.
- The token swap is quick so high-frequency trading is feasible.
- Liquidity is for both payment and trading.
Liquidity Pool on the Lightning Network
LN already has funded channels to support multi-hop HTLC payment.
In the AMM model, liquidity providers play a similar role: if a swap succeeds, one who deposits his tokens into the contract will get a commission fee according to the proportion of his contribution to the token pool.
Naturally, funded channels in the lightning network form a global liquidity pool, the difference is that the whole lightning network is a pool, every node maintains a portion of liquidity, while onchain AMM uses a contract address to collect liquidity: all tokens are deposited into one address.
To gain confidence in closing a trade, OmniBOLT uses financed channels to fill spreads between all prices. This creates a continuous loop that encompasses the entire price space. When the price moves, liquidity providers have an incentive to concentrate liquidity around the current price for higher fees. They withdraw old liquidity ranges and feed into new liquidity ranges that cover the current price. This protects against liquidity shortages in the order book model.
Adding and removing liquidity
Adding liquidity to the lightning network is simple: just open a channel with your counterparty and fund it. The lightning network discovers new channels and updates the network graph so that your channels will contribute to the global payment liquidity.
But adding liquidity to an AMM pool is different. Not all the tokens funded in channels can be market maker liquidity reserves. Users need to sign ranged liquidity of pair (x, y) and post it to a tracker they connect to. At least two channels have to be opened and funded.
There are two ways to remove liquidity:
- withdraw signed and submitted orders and ranged liquidity.
- close the channel and withdraw tokens to the mainchain.
Trackers calculate the remaining tokens in the global liquidity reserve, and the extra tokens will be marked payment liquidity reserve, according to the exchange rate at the moment of closing channel:
There is no protocol fee taken during closing a channel. Only gas fee in BTC occurs.
Differences from on-chain AMM Swaps
- Price is from trackers who maintain statistics of global liquidity, but to avoid price manipulation, the OBD node should verify price from external oracles when trading tokens.
- Trackers maintain the global prices for all token pairs, but they have no permission to execute any trade. The lightning network has no global contract that executes transactions. Every OBD node should verify the incoming order to avoid price manipulation. OBD does not have to trust any tracker.
- On-chain swaps use smart contracts to collect and allocate fees for liquidity providers. But the Lightning Network has no contract. Instead, OmniBOLT uses a routing protocol that allows liquidity provider feeds to be used for trading, so those feeds earn commissions directly.
Automated Market Makers (AMMs) are the driving force behind decentralized finance. They allow anyone to create markets and trade cryptocurrency seamlessly in a very secure, decentralized, and non-storage environment.
And while AMMs have already experienced massive growth, they are still in their infancy. Inspiring innovations are just around the corner, and one such innovation OmniBOLT will present to us.