Editor's Note: The original title was "Understanding Uniswap"
2019 is the first year of DeFi. MakerDAO, Synthetix, Uniswap, Compound and Kyber all performed well. Among them, Uniswap attracted the attention of Blue Fox because of its uniqueness. Uniswap does not issue tokens, nor does the founding team capture transaction fees. It is a very unique presence in the crypto world.
From January 1st, 2019 to December 31st, 2019, Uniswap has developed rapidly.
- Tether issued a stable 24-hour trading volume of anchored offshore RMB, only 0.1BTC
- A picture to understand the difference between Bakkt's bitcoin futures and "traditional" futures
- EOS daily support appears, but it also needs to pay attention to the market dynamics
- What is the experience of the two girls traveling without cash and paying only cryptocurrency for almost half of the country?
- Market Analysis: Market sentiment still needs to be stable, BTC and mainstream currency enter the pending stage
- Talking from NuCypher, why is $100 million a standard for future projects?
- Lock in total value
As of writing, the total value of Uniswap's lock-in is $ 29.1 million, ranking fifth in DeFi.
(Data from defiplus)
- Daily trading volume: + 6000% growth; from $ 25,000 to $ 1,500,000.
- Liquidity: + 5000% growth; from $ 500,000 to $ 25,000,000.
- Peak transaction volume: from $ 800,000 to $ 390,000,000.
- Cost captured by liquidity providers: from $ 2,400 to $ 1,200,000.
- Over 50,000 USD token pool: from 2 to 28
- The largest token pool: from $ 100,000 (SAI / ETH) to $ 10,000,000 (sETH / ETH); it can process $ 60,000 transactions with only 1% slippage.
- SAI / ETH pool fee return: up to 23.88%.
- Integration: integrated in DEX aggregators, wallets, trading protocols, stablecoins, synthetic assets, use tokens, dynamic pricing products, etc. For example, the blockchain coffee "Blockchain Coffee: The Road to Landing on the Blockchain" mentioned by Blue Fox Note also implements the exchange of tokens by integrating Uniswap.
- Performance: In cooperation with Plasma Group, the exchange that released layer 2 adopts Optimistic Rollup, which can reach 200tps.
- Development: Uniswap version 2.0 will release details and open source contracts in the coming weeks.
From the above data and R & D progress, Uniswap performed well in 2019 and is one of the projects worthy of attention in the DeFi field.
What does Uniswap do?
Uniswap is a token exchange protocol based on Ethereum.It is decentralized, not only different from traditional cryptocurrency exchanges, but also different from ordinary decentralized token exchanges. Uniswap is a set of contracts deployed to the Ethereum network, and all transactions are performed on-chain.
Like other DEX, it can freely deposit tokens for exchange and free withdrawal, without the registration, identity verification and withdrawal restrictions of centralized exchanges. At the same time, compared with other DEX, its gas utilization rate is higher, so the gas cost is cheaper; its trading counterparty is not other trading users, it trades with the token pool, and has an automatic market making model Calculate the transaction price.
Uniswap's Automated Market Maker
Ordinary exchanges have the concept of limited price orders, and general market makers provide liquidity to set prices, which are not available in Uniswap. At Uniswap, market makers only need to provide token funds, and the rest can be solved through mechanisms. Ordinary exchanges need trading counterparties. Market makers set the buying and selling prices. One is to provide liquidity to the market, and the other is to obtain the trading spread. These set prices form a limit order. Of course, these orders may or may not be filled. If the exchange collects everyone's orders into two large pools, traders will not be willing, they do not want their orders to be mixed with other people's orders.
What Uniswap has to do is to mix tokens together, and market makers do not have to specify the prices they want to buy and sell. Why does Uniswap do this? This stems from the design of Uniswap's automatic market maker.
One of the characteristics of Uniswap is to pool everyone's liquidity together and then make market based on algorithms. That is, it is essentially an algorithm-based automatic market making service. Uniswap will have some predefined rules under which it will offer users a quote for redeeming tokens. There are many rules for automatic market making, and Uniswap uses one of them.
Uniswap uses an automatic market-making model based on the "Constant Product Market Maker Model" variant. It has a very interesting feature. In theory, it can provide unlimited liquidity, can have a large order size, and don't worry about the small flow pool. The reason for this is related to its Constant Product automatic market making model. So, what is the model of Constant Product's automatic market making?
Let us assume that the liquidity provider offers ETH / MKR trading pairs. Assume that according to the current exchange rate, 1MKR = 3.5ETH. If you want to provide liquidity for Uniswap, you provide 100MKR and 350ETH to the fund pool. Then, Uniswap will multiply the two values to get Constant Product: 100 * 350 = 350,00.
The formula is X * Y = K, where X is ERC20 token, Y is ETH, and K is constant. Uniswap keeps the K constant at 350,00. In order to keep K unchanged, then X and Y are the same. If someone buys ETH in this contract, the MKR will increase because the buyer adds MKR to the liquidity pool and decreases ETH at the same time. The ETH is bought by the buyer, which reduces its amount in the liquid pool.
However, depending on the amount of purchase, the cost paid by the user is different, that is, the actual price is different. Assume that the transaction fee is 100 tokens per pool (in fact, 0.3%, here is mainly to simplify the description), we have the following exchange relationship:
As can be seen from the table above, there are 100 MKR and 350 ETH in the pool, and the constant is 100 * 500 = 35,000;
In this case, if MKR is purchased with ETH, each time the ETH purchase amount is different, the cost of the purchase is also different. If 1ETH is injected into the liquid pool to exchange for MKR, then 0.282 MKR can be exchanged. The cost is 3.5453, and the cost of purchasing MKR has increased by 1.294%. If 350ETH is used to exchange for MKR, this means that the ETH flow pool has 696.5ETH (minus 3.5ETH transaction fees). According to the calculation formula, the MKR flow pool has 50.2513 left MKR, then 350ETH can be exchanged for 49.7487 ETH, and the cost of a single MKR exchange is as high as 7.0353; the cost of purchasing MKR rises more than 100%, and this slippage is too large.
However, if there are enough MKR and ETH in the pool, the slippage will be much smaller. As of the writing of the Blue Fox Notes, in reality, the liquidity of MKR can reach 23,238 ETH, which is more than 3,000,000 USD. If you exchange 350ETH for MKR, you can exchange 104.8559, and the price slippage is 2.88%. Of course, this flow cell is not large enough. If it is bigger, it may not even reach 1% slippage.
Here is another concept that needs to be clear. After each exchange, a new flow pool will be generated, and a new constant will also be generated. The reason is that the fees generated after each transaction will be returned to the liquidity pool, so that the fees will be re-added to the fund pool after the calculation of the exchange of token prices, so that the constant will become slightly larger after each transaction. This can provide systemic profits for liquidity providers.
For example, according to the figures above, if the user exchanges 100K for MKR, assuming a 1% rate, then the flow pool of MKR is 77.9510MKR, and the flow pool of ETH is 450ETH. According to the rules, the new constant is 77.9510 * 450 = 350,77.95, which is 77.95 more than the original constant of 350,00.
In addition to the exchange of ETH and ERC20 tokens, ERC20 tokens can also be exchanged without the need for a separate fund pool. The method of exchange is to complete the exchange through ETH, because ETH is a universal trading pair for all ERC20 tokens, it can become a medium for transactions between different ERC20 tokens, such as exchange between MKR and SNX tokens, first through MKR The / ETH trading pair is converted into ETH, and then the conversion is completed through the SNX / ETH trading pair.
Uniswap's liquidity provider can capture transaction fees
Uniswap's liquidity provider first sets a reasonable x / y ratio, as this represents the price of the trading pair. In the above example of MKR / ETH, 100MKR / 350ETH = 0.2857. That is, in this example, 1ETH = 0.2857MKR. As of the writing of the Blue Fox Notes, 1ETH = 0.3097MKR, that is, if Uniswap, 1ETH is 0.2857MKR, and the actual exchange is 1ETH = 0.3097MKR, then there is arbitrage space here. Equivalent to Uniswap, one MKR can be exchanged for 3.5 ETH, and the exchange can be exchanged for 3.2 ETH. Then, people buy one MKR with 3.2ETH on the exchange, and then sell it on Uniswap to get 3.5 ETH. . This arbitrage behavior will eventually lead to the same exchange rate between the two.
When a liquidity provider adds liquidity to the Uniswap pool, it needs to provide a ratio similar to the current market, which means that if it provides too much ETH or ERC20 tokens, it will change the ratio in the fund pool, then According to its smart contract calculations, this would change the exchange price, which would attract arbitrageurs. And this can cause losses for liquidity providers. Uniswap's front-end interface generally defaults to the ratio. For example, when you provide MKR / ETH trading pairs, if you enter 10ETH, 3.0827 will automatically appear in the MKR column (the corresponding conversion ratio at the time of the screenshot of Blue Fox Note)
If in the current 100MKR and 350ETH fund pool, you add 10MKR and 35ETH, you will increase the liquidity of the flow pool by 10%. The contract will mine and send you "Liquidity" according to your proportion in the fund pool. Token". These tokens are the share of the recorded liquidity provider. If someone adds liquidity to the fund pool, new tokens will also be mined. If someone withdraws from liquidity, the mined tokens will be destroyed, so that the relative proportion of each liquidity provider remains the same.
The liquidity provider's revenue comes from transaction fees, which is currently 0.3% of the transaction volume. These transaction fees will be distributed to the liquidity providers in proportion, and the fee income generated in 2019 will reach 1.2 million US dollars. Uniswap requires formalities:
1) Exchange ERC20 tokens with ETH, the handling fee is 0.3% of ETH;
2) ERC20 tokens are exchanged for ETH, and the handling fee is 0.3% of ERC20 tokens;
3) ERC20 tokens are exchanged for ERC20 tokens, and the handling fee includes two parts: First, the transaction from ERC20 tokens to ETH, the handling fee is 0.3% of ERC20 tokens; from the converted ETH to the new ERC20 tokens For tokens, the handling fee is 0.3% of ETH.
For liquidity providers, there is another benefit that it reduces management costs. It does not require more bid or quotation order management, which is an automatic market making mechanism. Small market makers can also earn liquidity by providing liquidity, and regardless of the amount of income, even if you only have 1ETH and 0.3 MKR, you can become a liquidity provider. Of course, the size of the income is related to the proportion of the contribution.
In addition, it should be noted that due to the great volatility of cryptocurrencies, there is no guarantee that you can earn more income through fees.
Uniswap currently applicable scenarios
This feature of Uniswap is suitable for small traders, especially for small traders who do not want to set limit orders. Large transactions may be more expensive due to the problem of the capital pool and are not suitable for trading here. Uniswap is also suitable for micro transactions, such as machine-to-machine transactions. Uniswap is currently not suitable for trading a large number of orders. At present, the transaction of sETH / ETH is about 60,000 US dollars, and the slippage is within 1%. Liquidity of more than $ 10 million is only sETH for the time being, and more than $ 100 are MKR (more than $ 3 million), Dai (more than $ 2.3 million), wETH (more than $ 1.5 million) and Sai (more than $ 1.1 million).
In addition, other companies use Uniswap for token issuance. For example, the issue of CAFE tokens for the blockchain coffee mentioned above by Blue Fox Note is carried out through Uniswap.
Uniswap and Bancor
The mechanism of Uniswap is similar to the Bancor network, but Uniswap does not charge a listing fee, and its gas utilization is high, and the transaction cost is relatively low. The figure below is from the white paper of Uniswap. The test results show that its gas consumption is one tenth of Bancor's, and even less than the gas consumption of other DEXs, the utilization rate is higher.
In addition, Bancor requires the mortgage of BNT tokens to create a market, which requires filling in application forms, which is more cumbersome. Compared to Uniswap, which only provides ETH and ERC20 token fund pools and simple creation of trading contracts, the threshold is higher. In other words, Uniswap requires no permission, has less friction, and is more decentralized.
From the perspective of liquidity, Uniswap still has a long way to go, but don't forget that in 2019 alone, its development is amazing. From almost no liquidity, to the overall liquidity of more than 25 million US dollars, this is a Great results.
Uniswap developed a decentralized trading protocol based on Ethereum. It uses an automatic market maker model and does not need to rely on the price information flow of the oracle. It has developed from an experimental small project to its current scale, which is a firm foothold.
Not only does it provide traders with license-free token transactions and a simple user experience, it also provides liquidity providers with the opportunity to capture value. Finally, because Uniswap does not require a license, it has the opportunity to become one of the important Lego in the DeFi world, helping to develop the entire DeFi field.
Risk warning: All articles of Blue Fox Note can not be used as investment advice or recommendations. Investment is risky. Investment should consider personal risk tolerance. It is recommended to conduct in-depth inspection of the project and make good investment decisions.