
Produced | Odaily (ID: o-daily)
Produced | Odaily (ID: o-daily)
From destroying platform tokens to following the trend of IEO, in the past few years, "long tail" exchanges have been replicating the business development routes of leading exchanges.
In the past two months, the wind direction has changed. DeFi is hot, DEX is attracting money, capital hot money is betting on the decentralized exchange track, and CEX including the "big three" are also investing in DeFi, setting up special funds, looking for the next hot opportunity.
The previous vision of "being the next Binance" is unlikely to be realized, and "being a DEX beyond Uniswap" seems more feasible. After all, Uniswap itself has many criticized problems. If the DeFi boom continues, the rise of new DEXs can be expected.
On July 27, the centralized derivatives trading platform FTX announced the launch of Serum, a DEX based on the Solana public chain.
On August 4, Hakka Finance released the white paper of BlackHoleSwap, a decentralized stablecoin flash exchange tool. BlackHoleSwap is benchmarked against Curve, a decentralized stablecoin exchange platform that is currently popular.
On August 8, Dai Shichao, the founder of DeFi Labs, announced at the 2020 Ethereum Technology and Application Conference that the decentralized exchange DODO will launch the ETH/USDC trading pair.
On August 11, the on-chain aggregation trading platform 1inch launched the automatic market maker (AMM) Mooniswap, which supports users to switch between tokens in a decentralized and non-custodial manner.
The head cross-chain protocol Cosmos has also entered the game. On August 14, Jeffrey Hu, research director of IRISnet, said on Twitter that Cosmos will soon launch a platform similar to Uniswap, Coinswap.
Other established DEXs that have never been able to capture the public in the past have also made efforts. On August 1, Bancor V2 was launched, adding a number of eye-catching features. Its practice of providing liquidity for a single token is obviously also solving the pain points of Uniswap. On August 7, the decentralized exchange IDEX announced the completion of a $2.5 million seed round of financing, led by G1 Ventures and Borderless Capital, and plans to release version 2.0 next month.
The above examples are all positive explorations and have opened up new business directions for practitioners in the currency circle.
The Dongfeng of liquidity mining has broken the traffic dilemma of DEX for many years, and AMM (automatic market maker) improves liquidity by depositing tokens in the decentralized fund pool. According to The Block, the trading volume of DEX in July exceeded 4 billion US dollars, a record high; at the same time, the proportion of trading volume between DEX and centralized exchanges increased to nearly 3.95%, while this figure was still 0.1% at the beginning of the year.
From model evolution to data performance, the prospect of DEX is gradually clear.
However, DEX is still in a period of melee, the competitive landscape is uncertain, and new players with different characteristics emerge in an endless stream, and each of them may break out.
secondary title
Paradigm revolution from order book to AMM
DEX can be divided into three types according to the matching method: Order Book, Automated Market Maker (AMM, Automated Market Maker) and Aggregator (Aggregator). In this article we focus on the most common order books and AMMs.
Before the formal introduction, we must first understand what a market maker is.
According to Pan Chao, head of MakerDAO China, market makers are different from ordinary traders. They are risk-neutral, holding stocks in one hand and cash in the other. In order book mode, both buy and sell orders are placed, with the spread in between. Similarly, over-the-counter market makers will make profitable quotations when customers make inquiries.
Market makers are the source of liquidity. A highly liquid market needs market makers, and at the same time attracts large-scale market makers to participate.
order book
order book
The matching of centralized exchanges such as Binance, Huobi, and OKEx is based on the order book model. The order book contains a list of buy orders (bids) and sell orders (asks), and lists the quantity to bid or ask at each price point.
In order book exchanges, market makers are required to provide liquidity through pending orders. If the order book exchange has no liquidity, there will be situations where you can’t buy if you want to buy or sell if you want to sell. Therefore, liquidity is an important indicator to measure an exchange. The better the liquidity, the more convenient the transaction.
In DEX, the order book can be divided into on-chain order book and off-chain order book.
On-chain order book
The on-chain order book mode means that all pending orders are stored on the blockchain, and the orders in the order book will be matched and settled according to the set order conditions.
The model adopted by the early Ethereum-based decentralized exchange EtherDelta, the user's recharge, pending order, transaction settlement, cash withdrawal, etc. are all completed by smart contracts. Since there is no mechanism for automatic order matching, each transaction on it needs to be confirmed on the chain. Its order mode is shown in the figure below:
The Maker fills in the order request and signs it with the private key and submits it to the blockchain for locking. The Taker selects the order he wants to trade from the order book on the chain and initiates a transaction, and then the smart contract matches the transaction needs of the Maker and Taker , after the transaction is successful, it will be settled on the chain.
The advantage of the on-chain order mode is that the transaction is directly through the wallet, which has high transparency and security. However, the transaction process is all on the chain, the transaction speed is slow, and the confirmation time is long, which affects the user experience. At the same time, the depth of order transactions is poor, and transaction fees are high, and transactions may fail due to some congestion on the chain, Gas and other reasons.
Off-chain order book
Compared with the on-chain order book, the biggest feature of the off-chain order book model is: off-chain order matching + on-chain settlement. 0x, IDEX1.0, etc. belong to this mode.
0x is an open protocol for peer-to-peer trading of ERC20 tokens on the Ethereum blockchain. The protocol technically introduces the concept of Relayer (order relay). Relayer is responsible for collecting user (Maker/Taker) orders off-chain, submitting them to the chain for settlement after initial matching. The order process of 0x is as follows:
Relayer provides order book service to host and maintain an off-chain order. Maker and Relayer negotiate transaction fees and orders in a trustless manner, and then Relayer submits the order to the order book, Taker fills the selected order and broadcasts it to the Ethereum blockchain, and the smart contract completes the final liquidation process .
The hybrid design mode of "off-chain order relayer matching + on-chain settlement" represented by 0x combines the efficiency of the state channel with the on-chain order of instant settlement, which greatly reduces the friction cost of both parties in the market transaction and speeds up the settlement. Consumption costs are reduced.
The Augur 2.0 version of the prediction market, which was officially launched in July this year, also uses the off-chain order book supported by the 0x protocol. However, users' response to the new version of Augur does not seem to be enthusiastic.
Relayer-based order book technology can be either centralized or non-centralized, sacrificing some of the decentralized features to a certain extent, but compared with centralized exchanges, the user experience and transaction speed are still weak.
In general, the DEX in the order book mode is parasitic on the liquidity of CEX: it cannot share liquidity, and it is re-operated, and the cost of obtaining traffic is high.
In June of this year, the decentralized lending platform Compound’s innovative liquidity mining model (also known as Yield Farming) made AMM popular. Currently, almost all popular DEXs (Uniswap, Bancor, Kyber) on the market use AMM .
The AMM exchange does not need to provide an order book to show the price that buyers and sellers want to trade, but brings together liquidity and realizes market making according to a specific mathematical algorithm.
Taking Uniswap as an example, the number of pricing curves is the classic X*Y=K, constant constant product. X is the amount of new coins, Y is the amount of ETH, and K is a constant. The issuer of the new currency creates a transaction pool at a certain ratio, and also determines the listing price of the new currency, that is, the ratio of X to Y. Since X and Y constitute a constant product relationship, and X and Y are in a trade-off relationship, if someone buys new currency X in this contract, the amount of Y will increase.
Let's give an example to let everyone understand the relationship between x and y.
Investor Xiaoming wants to provide liquidity for the ETH/DAI trading pair in Uniswap. Assuming 1ETH=400DAI, the formula of Uniswap is 1(ETH)*400(DAI)=400 (fixed constant). If Xiao Ming wants to buy ETH worth 50DAI, inject 50DAI inflow into the ETH/DAI pool, and reduce ETH at the same time, then in order to ensure that the product is still a constant 400, the amount of ETH left in the pool=400/(400+50 )=0.89, the amount of ETH Xiao Ming can get in the end=1-0.89=0.11.
Through the example of Xiao Ming providing liquidity for the ETH/DAI trading pair in Uniswap, we can see that in order to maintain the fixed product of X*Y, as the injected DAI continues to increase, the remaining ETH in the pool decreases.
DODO CMO Dai Shichao told Odaily that the X*Y=K pricing mechanism determines which side buys the most, and the price of the corresponding currency will rise. Therefore, in this pool, as long as someone buys new currency X, its price will keep rising.
If Xiao Ming wants to buy another 50DAI of ETH, he needs to continue to inject 50DAI into the pool. Note that there are 0.89ETH and 450DAI left in the ETH/DAI pool at this time. After Xiaoming injects 50DAI into the pool again, in order to ensure that the K value remains at 400, the amount of ETH left in the pool at this time = 400/(450+50 )=0.8, the amount of ETH Xiao Ming can get this time=0.89-0.8=0.09.
We can clearly see that, for the same purchase of 50DAI of ETH, the amount of ETH that Xiao Ming got for the second time was significantly less, which means that the unit price of DAI has become more expensive. This is a feature of pricing with functions: X is bought The more traveled, the more expensive X is; the more X is sold, the cheaper X is.
Such slippage can also attract the attention of arbitrageurs. Xiao Ming sold 50DAI for the second time at a price of 0.09ETH. According to the relationship of X*Y=K, if an arbitrageur buys 50DAI at this time, he only needs to spend 0.09ETH, which is the same as the price of buying 50DAI for the first time. (0.11ETH) forming a price difference.
Pan Chao compared Uniswap to a special vending machine. As long as someone buys a product, the price of the product will increase, and the more you take, the faster the price will soar until market makers and arbitrageurs replenish the goods.
In the order book mode, market makers earn money from transaction fees and price differences; in AMM, market makers, or liquidity providers, only earn money from transaction fees, while arbitrageurs Earn money from the price difference, that is, under the AMM model, arbitrageurs earn the price difference, and market makers share dividends.
secondary title
Where is the defect of AMM mode?
Cannot be priced independently
Cannot be priced independently
According to the analysis of Okey Cloud Chain Research Institute, AMM cannot independently price new coins due to the lack of price discovery function.
The income of market makers mainly comes from the bid-ask spread. When making a market in the market, the goal is to maximize the income. This requires market makers to make full use of market information and make quotations. At the same time, investors make investment decisions based on market makers' quotations, and feed back their transaction information to market makers in a timely manner, and then market makers adjust their quotations according to their asset positions and price differences. Therefore, under the joint promotion of market makers and investors, the market can discover the real transaction price.
However, there is no price discovery function in the AMM mode.
For example, in the transaction of a certain asset, user A (market maker A) places a buy order of $5/lot, and user B (market maker B) places a buy order of $10/lot. Or under the market maker system, B will realize the transaction first, but the Uniswap platform cannot guarantee that B will complete the transaction first. Because the price of AMM is driven by liquidity, the transaction price is determined by the asset status of the reserve pool, not the order price, that is, AMM can only generate transaction prices, but cannot discover market prices. For this reason, AMM has to introduce the important role of arbitrageur: once the price on the AMM platform is different from the fair market price, there will be room for arbitrage and the price will be brought back on track.
Okey Cloud Chain Research Institute believes that the core of the financial market trading system is the price discovery function, and AMM, a trading system that cannot discover prices, is doomed to fail to become the mainstream.
Dai Shichao also believes that under the AMM model, the issuance price of new coins is overly constrained by the project party itself.
"Under the new issuance scenario, unlike the existing encrypted asset transactions, its dispersion is very low, and the chips of the new currency are concentrated in the hands of the project issuer. This makes the liquidity pool of DEX almost only by The project party injects itself, and there is a lack of universally participating liquidity providers. At the same time, the multi-market arbitrage mechanism may fail, and the quantity and timing of injecting tokens into the liquidity pool of the project direction will directly affect the price.” Dai Shichao told Odaily .
First of all, let’s talk about the amount of injection. Due to the characteristics of the DEX pricing curve, the more tokens injected, the lower the transaction slippage. The total amount and proportion directly determine the price.
Therefore, when there are very few coins injected into the pool, it is often necessary to pay attention.
At the same time, since Uniswap's pricing curve theoretically hopes to provide unlimited liquidity, when a certain coin is bought in the pool with very little left, its marginal price will change greatly.
The second is the issue of injection timing. If multiple injections are required, each injection of tokens will have a very large impact on the overall price.
Impermanent Loss: Mining income did not outperform currency holding income
The impermanent loss is currently the most unfavorable aspect of the AMM pool for liquidity providers, and it is also one of the biggest obstacles to the development of DEX.
First of all, we need to understand what impermanent loss is: Compared with simply holding tokens, users who provide liquidity to AMM may see their pledged tokens lose value. This risk is called "impermanent loss" .
To put it simply, suppose you provide liquidity for the ETH/DAI token pool, but if ETH rises rapidly, in order to maintain a fixed value of the K product, then the amount of DAI you hold will increase and the amount of ETH will decrease. The ETH you originally bought at a low price was quietly exchanged by arbitrageurs with DAI, so the income you get from providing liquidity for the token pool may not be as good as the income from directly holding ETH.
We once experienced the loss of impermanence in a liquidity mining, because the price of the pledged tokens tripled during the liquidity mining period, resulting in the mining income not outperforming the currency holding income, and finally we simply quit the pledge mining , holding tokens directly.
In essence, impermanent losses actually come from arbitrage. The transaction price of AMM is derailed from the fair market price. For this reason, arbitrageurs need to come in to buy undervalued assets or sell overvalued assets until the price provided by AMM matches the external market. Therefore, the profits of the arbitrageurs actually come from the liquidity providers.
If the impermanence loss exceeds the liquidity gain, then the liquidity provider will no longer provide liquidity. Therefore, the size of the impermanent loss is the key to determine whether the AMM DEX can operate normally.
image description
Image source: mechanical clock
Take three points as an example: the intersection of the yellow line and the blue line is when the external price does not change, the impermanence loss is zero; the intersection of the green line and the blue line is when the price falls by 50%, and the price rises After increasing 100%, the impermanent loss is -5.7%. It is not difficult to find that the impermanent loss is related to the magnitude of the price change, and has nothing to do with the direction of the rise or fall of the token.
The slippage is too high, AMM DEX is only suitable for daily small amount exchange
Users often complain that the transaction slippage in Uniswap is too high, which is not cost-effective. Indeed, except for a few liquidity pools with considerable liquidity, the liquidity pools of most tokens are not suitable for large-scale transactions.
The problem of excessive slippage is also a major reason that hinders institutional investors and new users from entering AMM DEX.
In the first part of the article, we have explained the logic behind the emergence of slippage with examples. Slippage is a major shortcoming of DEX’s pricing with functions, which also attracts arbitrageurs to enter the market, and arbitrage behavior brings impermanent losses. .
Interestingly, there is some mutually exclusive relationship between slippage and impermanent loss. To reduce slippage is to pursue a kind of price stability, and to reduce impermanent loss is to pursue a kind of price change. One side of optimization may lose the other.
secondary title
Who will be the next Uniswap?
Although slippage and impermanence losses cannot be eliminated, they can be adjusted in advance within a controllable range.
We mentioned earlier that slippage is related to the pricing function selected by DEX. Taking AMM represented by Uniswap as an example, from the model point of view, because it adopts a constant product model (x*y=k), its slippage is too high.
So what kind of model can reduce slippage? - Constant sum model (X+Y = K).
Still take Xiao Ming’s injection of liquidity into the ETH/DAI pool as an example. Assuming that there are 50ETH and 50DAI in the pool initially, then K is constant at 100. Xiao Ming can exchange 5ETH for 5DAI for the first time, and can still exchange 5ETH for the second time. Get 5DAI, K is always maintained at 100.
But this function has a fatal shortcoming, that is, it is easy to exhaust the assets in the reserve pool. If 1ETH cannot buy 1DAI outside this market, (and the ETH/DAI pool is always 1ETH=1DAI), another arbitrageur will come to the market to buy all the DAI, leaving only 100ETH in the trading pool .
Therefore, an ideal way is to construct a hybrid function. If the prices of the two assets are relatively stable, the slippage value in the function can be reduced; when the asset liquidity in the reserve pool is insufficient, the price can be quickly increased to achieve Theoretical wireless mobility. Curve has built a complex function for this purpose, the constant function model StableSwap:
x is the reserve amount of each asset, n is the type of asset, D is an invariant, representing the value in the reserve, A is the "magnification factor", that is, an adjustable constant, providing a leverage-like effect, affecting The range of asset prices and affects the profit margin of liquidity providers (ie, the higher the volatility of assets, the greater A is).
This function works as a constant sum function when the portfolio is balanced, and transforms into a constant product function when the portfolio becomes more unbalanced, thus achieving both slippage and liquidity.
Bancor V2 introduces the price of the external world by using the oracle machine, thereby reducing the risk of inconsistency between the transaction pool and the external world price, and reducing impermanent losses.
Bancor V2 uses the oracle machine to feed the price to adjust the weights on both sides of the token, that is, the number of X tokens * X price does not have to be equal to the number of Y tokens * Y price, smoothing out arbitrage opportunities with the oracle.
As for how to reduce slippage, BancorV2 reduces slippage by amplifying liquidity. Bancor V2 borrows from Curve and introduces a stable curve mechanism. The curve of BancorV2 is between Curve and Uniswap, and the algebraic formula is between X*Y=K and X+Y=K. Take advantage of smoother curves to reduce slippage. A simple understanding is that it is 20 times larger than Uniswap with the same liquidity.
An AMM with a $100,000 reserve will incur 10% slippage on a $10,000 trade. However, if BancorV is introduced, the liquidity is magnified by 20 times, and the slippage of the same transaction will be reduced to 1%.
In addition to these established DEXs constantly exploring ways to reduce slippage and impermanence risks, emerging DEXs have also proposed some solutions.
For example, BlackHoleSwap, a stablecoin exchange platform that benchmarks against Curve. Although Curve's mixed function model provides a good depth of stablecoin transactions in most cases, once the unilateral reserves are nearly exhausted, there will still be huge slippages.
In this regard, BlackHoleSwap has designed a new system that allows the system to have a negative inventory. By integrating the lending agreement, the currency with a large amount of mortgage and the currency with insufficient lending can handle the transaction volume far exceeding the reserve.
BlackHoleSwap deposits the reserve currency on the lending platform. When the inventory of one currency in the transaction pair is exhausted and the market still has demand, BlackHoleSwap will use another currency as collateral to lend the required currency from the lending platform to complete the transaction . Therefore, BlackHoleSwap will not be limited by the amount of inventory, and can maintain low slippage without worrying about running out of inventory.
Mooniswap launched by 1inch.Exchange is an automatic market maker with a virtual balance, and liquidity providers can obtain the profits that arbitrageurs could have obtained. With Mooniswap, 1inch plans to reduce the short-term losses of liquidity providers by introducing a 5-minute delay to reduce the profit margin of arbitrageurs. By delaying price updates, market makers will create a highly competitive environment for arbitrageurs, forcing them to trade at less profitable prices, which in turn will increase the value of liquidity providers. 1inch expects Mooniswap to generate 50-200% more income for liquidity providers than Uniswap V2.
There is also DODO, a decentralized exchange based on the active market maker algorithm that we mentioned at the beginning of the article. DODO draws lessons from BancorV2, introduces the middle price of the market through Oracle, and gathers most of the funds around the middle price of the market. DODO can achieve ten times more liquidity than Uniswap when the size of the fund pool is similar to Uniswap (slippage is 1/10 of Uniswap), or achieve liquidity similar to Uniswap when the fund pool is 1/10 of Uniswap.
References:
References:
TokenClub Research Institute: "In-Depth | Overview of Decentralized Exchanges"
Okey Cloud Chain Research Institute: "Okey Cloud Chain Research Institute: A Paradigm Revolution in Financial Market Transactions --- Automatic Market Maker System (AMM)"
Li Hua: "Use logic as a tool to easily understand DeFi: DEX articles"
Blue Fox Notes: "Why Automatic Market Makers May Lose Money? "
Lin Ming: "In-depth Explanation of Bancor V2 Technology - Lin Ming FirstPool"