HashKey: Analyzing the Development Trend and Bottlenecks of Decentralized Exchanges from Uniswap
Winkrypto
2020-09-19 02:54
本文约7346字,阅读全文需要约29分钟
The explosion of the DeFi concept in 2020 has led to rapid growth of algorithmic decentralized exchanges such as Uniswap, but security and liquidity issues will be the key to their continued growth.

Editor's Note: This article comes fromChain News ChainNews (ID: chainnewscom), published with permission.

Editor's Note: This article comes from

Chain News ChainNews (ID: chainnewscom)

Chain News ChainNews (ID: chainnewscom)

, published with permission.

Reviewer: Zou Chuanwei, Chief Economist of Wanxiang Blockchain and PlatON

Thanks to the recent explosion of DeFi, the monthly trading volume of decentralized exchanges reached US$11 billion in August 2020, nearly five times more than the total trading volume of US$2.4 billion in 2019. Decentralized exchanges have the advantages of no permission and no custody, and most of them do not require registration, login and KYC review. In the past, decentralized exchanges were far inferior to centralized exchanges in terms of user experience and capital depth, but the recent upsurge in liquidity mining and DeFi has led to a massive influx of funds, making the amount of funds locked in decentralized exchanges never less than 1% of the funds on the centralized exchange has grown to 2% today, and the future growth is expected.

This article is divided into three parts: The first part analyzes the current situation and mechanism of decentralized exchanges. The second part studies the Uniswap mechanism and iteration. The third part discusses the future growth and bottleneck of decentralized exchanges.

first level title

Status and Mechanism of Decentralized Exchanges

secondary title

The Mechanism of a Decentralized Exchange

The difference between decentralized exchanges and centralized exchanges is mainly reflected in two dimensions: technology and governance. From a technical perspective, a decentralized exchange is a DApp built on top of the blockchain. Through smart contracts, two modules of asset management and trading are realized. From the perspective of governance, a decentralized exchange is an open, community-driven decentralized organization with highly decentralized rights and obligations.

There are currently two types of decentralized exchanges: The first is an order-based exchange, which uses a bidding model to complete transactions. The second is an algorithmic exchange, an exchange based on a liquidity pool, which completes transactions through an automatic market maker (AMM).

Order-based decentralized exchange

In order-based decentralized exchanges, it is necessary to match a trader's buy order with another trader's sell order to complete a transaction. All pending orders are stored in the order book in the blockchain (Order Book). The core concept of order trading is similar to centralized exchanges, the difference is that centralized exchanges adopt a centralized matching mechanism, which has strong liquidity and investors do not need to bear too much slippage. Order-based exchanges allow traders to submit two types of orders, limit orders and market orders. Users submit market orders to buy cryptocurrencies at the best possible price. Transactions are completed by matching buy and sell orders from buyers and sellers. A limit order, on the other hand, is where a trader sets a specified price to buy a certain amount of tokens.

Order-based exchanges include exchanges such as EthFinex, IDEX, and EtherDelta. The most representative one is IDEX. The user experience of an order-based decentralized exchange is similar to that of a centralized exchange. The way to log in to the exchange is to log in to the wallet, and the transaction is completed when the limit order is issued. The advantage of the order-based decentralized exchange is that it trades directly through the wallet, which has high transparency and security. However, since the entire transaction process is on the chain, the transaction speed is slow and the confirmation time is long. The user experience is difficult to compare with the centralized exchange. . The depth of order transaction funds is not enough, the transaction fee is high, and the transaction may fail due to some congestion on the chain, Gas fee and other reasons. The benefit of order-based DEXes is that market makers on order-based exchanges can precisely control the price points at which they want to buy and sell tokens. This means high capital efficiency, but at the same time requires exchanges to actively participate and monitor the supply of liquidity.

Algorithmic Decentralized Exchange

Market makers in the order matching mode are responsible for providing quotations on the exchange. If there is no trading activity, the exchange will lose liquidity. Market makers buy and sell assets from their own accounts in order to earn a profit. Their trading activity creates liquidity for other parties, reducing slippage on large trades.

Algorithmic decentralized exchanges use Automated Market Makers to imitate the quotation behavior of market makers. The common market maker algorithm is the constant product market maker and the algorithm derived from its function. The constant product market maker is adopted by Bancor and Uniswap, and its mechanism is as follows:

Assume that a constant product market maker has funded this liquidity pool with 100 A tokens and 1,000 B tokens. Uniswap multiplies these two quantities (100 x 1,000 = 100,000) and sets a transaction target: no matter the volume, the transaction pair will always maintain a transaction pair product quantity of 100,000. Constant product market makers are built based on the function x*y=z. where x and y are the number of tokens in the liquidity pool and z is the product. To keep z constant, x and y can only vary inversely to each other. This function determines the price range of two tokens based on the liquidity of each token. If the trader's supply of A tokens increases, then the supply of B tokens must decrease, and vice versa, to keep the product z constant. If you plot the function, you see that it is a hyperbola, where liquidity is always there, but prices get higher and higher, approaching infinity at both ends.

image description

The price of the trading pair under the constant product function

With the development of liquidity based on the AMM model, a mixed constant function market maker also appears, which combines a variety of functions and parameters to achieve specific purposes. Such as adjusting the risk exposure of liquidity providers, or reducing the price slippage of transactions. For example, Curve's AMM combines constant product and constant average market-making algorithms to provide liquidity in the pool of funds, thereby reducing slippage.

image description

The impermanent loss caused by the ETH/DAI liquidity pool fluctuating with the currency price

Third, the capital utilization rate is low. In order to achieve low slippage, the liquidity pool of the algorithmic decentralized exchange needs to reserve a large amount of liquidity. And because liquidity providers cannot determine the price point of liquidity, the price is passively balanced by arbitrageurs, so the liquidity utilization rate of most algorithmic decentralized exchanges is maintained at a very low level.

secondary title

Current status of decentralized exchanges

Since July, the daily trading volume of decentralized exchanges has increased by 510%. The trading volume of Uniswap V2 accounts for 43.9% of the total number of decentralized exchanges. In July, the daily trading volume of Uniswap V2 increased by 116 million US dollars, an increase of 835%. As of September 8, the average daily trading volume of decentralized exchanges exceeded 400 million US dollars, while Uniswap V2 accounted for 66.9% of the total daily trading volume of decentralized exchanges, and the top five decentralized exchanges accounted for 90% of the entire market share. 92%.

image description

What we can find is that the substantial growth of decentralized exchanges in the past two months is mainly concentrated in algorithmic decentralized exchanges, and the market share of decentralized exchanges is gradually occupied by algorithmic decentralized exchanges. The main reason is that DeFi is not compatible with order-based decentralized exchanges. The DeFi field is still in its early stages, and there are not enough users to guarantee more traders to participate in the market. Due to the lack of liquidity and high transaction volume of DeFi platforms, their prices are more prone to volatility. This kind of price fluctuation will be magnified in order-based decentralized exchanges, resulting in high transaction slippage and low transaction efficiency. Therefore, tokens with large price fluctuations are not easily accepted by order-based decentralized exchanges.

In addition, we can find from the figure below that user stickiness is not strong. In 2018, the decentralized exchange market was just emerging, and the average number of daily active users of IDEX was much higher than that of other platforms, monopolizing the entire market. In 2019, the number of daily active users of each platform decreased compared with 2018. 0x, Kyber and Uniswap entered the market to compete, and the number of daily active users of IDEX dropped most obviously.

image description

The average number of daily active users on each platform of the decentralized exchange

first level title

The mechanism and iteration of Uniswap

  1. secondary title

  2. Uniswap V1 Mechanism and Features

  3. Uniswap is a liquidity protocol running on the Ethereum blockchain that supports trustless token swaps, which means that all transactions on the exchange are automatically executed by smart contracts, and users do not need to rely on an intermediary There is also no need to trust a third party. On the Uniswap platform, there are three roles: the first is the liquidity provider, which is risk-neutral and aims to earn traders’ fees. The second is traders, who are the real buyers and sellers in the platform. The third is arbitrageurs, who profit from trading when the platform price deviates from the market price, and passively adjust the price on the platform.

  4. Since 2019, Uniswap has developed rapidly. By the end of the year, the total value of Uniswap locked was 29.1 million US dollars. By 2020, Uniswap will develop even faster. In the past month, Uniswap trading volume has increased by 10 times, and liquidity has increased by 200%. There are four reasons why Uniswap has seen a significant increase in both transaction volume and user numbers during this period:

The implementation mechanism of Uniswap is simple. The design complexity of Uniswap is low. Only after the deployment of smart contracts and algorithms, it can operate by itself, and the startup cost is low. In addition, Uniswap users do not need to register or go through the cumbersome KYC process, but can enter the market as long as they have an Ethereum wallet. Due to the serious performance limitations of Ethereum 1.0, Uniswap's low gas fee has become a major advantage.

Tokens on the Uniswap platform can be listed without permission, meeting the demand for long-tail tokens.

Uniswap V2

During the rise of Uniswap, the infrastructure of DeFi has been very rich. Now there are various derivatives such as loans, leverage, options, insurance, etc. These infrastructures have attracted a large amount of capital and provided sufficient liquidity for the ecology.

Uniswap’s mechanism is quite simple and reasonable from an economic point of view: Uniswap charges traders a small handling fee, and uses the handling fee as the incentive basis for liquidity providers, with a handling fee of 0.3%. The liquidity provider allocates the transaction fee to the trader according to the proportion of the tokens injected into the liquidity pool to the total liquidity pool.

However, currency trading is not supported in Uniswap V1, that is to say, if a trader wants to convert token A into token B, he must first buy ETH with token A, and then buy token B with ETH . Traders need to pay two transaction fees and gas fees, rather unintuitive.

Uniswap conducted an iteration in March 2020, upgrading Uniswap to Uniswap V2. There are three main changes. First, the trading pair of ERC20 to ERC20 tokens. Uniswap V2 no longer needs ETH as an intermediate exchange token to assist ERC20 currency transactions. It is expected that the transaction volume can be reduced by half, and the gas fee of the transaction can also be saved. If there is no liquidity pool between the tokens that traders are trying to trade, they can use roundabout routes to more efficiently obtain the trading pairs they want to trade without going through the congested ETH.

Second, Flash Swap. There are three steps in the lightning transaction process: one is to lend tokens from Uniswap's liquidity pool. The second is to use these tokens for an operation. The third is to repay these tokens. If any stage of this process fails, all state changes will be undone, and the relevant tokens will return to the corresponding Uniswap liquidity pool, and the transaction is atomic. The main purpose of lightning trading is arbitrage trading, and traders can carry out arbitrage at low cost. Return the value of previously borrowed tokens to the Uniswap liquidity pool while making a profit, which consumes less gas than directly using the tokens you hold to repay.

Third, price oracles. The price of Uniswap is determined by the function curve, so it often deviates from the market price. Uniswap V2 introduces price oracles to improve this problem. Before a Uniswap transaction occurs, each trading pair will measure the market price at the beginning of each block, and the price at the beginning of each block is the transaction price of the last transaction in the previous block. If the attacker tries to manipulate the price, he needs to make multiple consecutive transactions that deviate from the market price, and there are no arbitrageurs involved.

In addition, Uniswap V2 sets a cumulative price variable in the smart contract, which is weighted by the time the transaction price exists. This variable represents the sum of the price per second over the entire Uniswap history of the contract. This variable can be used externally to track the time-weighted historical average price in Uniswap over any time interval. Taking this approach can avoid market crashes and violent price fluctuations, as well as increase the cost of attackers. However, Uniswap uses the time-weighted average price to correct the results after the fact, and cannot accurately present the market price. For mainstream trading pairs, Uniswap cannot grasp the pricing power and needs to rely on other exchanges.

secondary title

  1. The rise of SushiSwap

  2. According to DeBank statistics, SushiSwap's average daily trading volume jumped to the second largest decentralized exchange on September 14, reaching $150 million. The locked position on the chain also exceeded 1.3 billion US dollars, surpassing MakerDao to become the second largest agreement in DeFi, and caused Uniswap to lose more than 70% of its liquidity. SushiSwap can be understood as the Uniswap protocol plus a liquidity mining mechanism. Liquidity providers on Uniswap only earn pool transaction fees when they provide liquidity. Once they withdraw their funds from the pool, they will no longer receive corresponding income. Also, impermanent losses often cut into their gains.

  3. SushiSwap can be said to be an advanced version of Uniswap. Its designed mechanism has largely attracted the entry of liquidity providers, but there are several risks that need attention:

SushiSwap has no upper limit on the total amount of tokens issued, and is currently mining at a rate of 5.5 million tokens per day. Even in the second phase, tokens will still be mined at a rate of 550,000 per day. Although SushiSwap is designed to repurchase at a rate of 0.05% transaction fee, SushiSwap has the possibility of inflation depressing the currency value, which in turn affects the willingness of liquidity providers to participate.

Although SushiSwap claims that the smart contract will be audited by a technical audit company, there is no formal security audit result yet, and the code security is still unknown.

first level title

  1. Uniswap's impact on future exchanges and its bottleneck

  2. Exchanges are naturally subject to network effects, as traders want to trade on the most liquid platforms. Since arbitrageurs can adjust the liquidity pool, the network effect of this liquidity also has a certain limit. Compared with traditional centralized exchanges, the idea of ​​decentralization of decentralized exchanges is more in line with the original intention of the blockchain. If the problems of performance and architecture design are solved, it may win more support in the long run. But in terms of supervision, traditional centralized exchanges are gradually moving closer to regulatory compliance, using mechanisms such as real-name system or KYC for supervision, combined with the support of third-party security companies (such as AML systems), which can effectively avoid money laundering or cryptocurrency crimes . Decentralized exchanges are always difficult to supervise, mainly reflected in two levels:

Influence

The first is the user. Uniswap or some decentralized exchanges cannot grasp the basic identity of the user, and do not need to conduct KYC review, which means the possibility of financial crime. Criminals can use decentralized exchanges to conceal the flow of funds, and even use the issuance of new coins for money laundering.

  1. The second is the project. Although most decentralized exchanges do not charge listing fees like centralized exchanges, it also causes uneven quality of projects on the decentralized exchange platform. For example, the projects on Uniswap are not It can be traded on the platform without review, and the platform is prone to greater legal risks. In addition, the trading depth of decentralized exchanges is insufficient to support large transactions. When a large transaction occurs, it is easy to cause a premium transaction.

  2. secondary title

Influence

Algorithmic decentralized exchanges can have a profound impact on future cryptocurrency exchanges, whether centralized or decentralized cryptocurrency exchanges in the future can apply this model on the basis of some basic improvements. These improvements include the adoption of consortium chains or private chains, identity authentication and KYC of trading users, and review of the use of compliant cryptocurrencies, etc. The application of the Uniswap model can provide another possible option for traditional stock exchanges, which can be mainly reflected in two parts:

Winkrypto
作者文库