Author: YBB Capital Researcher Zeke

Preface

For Web3, I think there are three most important historical moments: Bitcoin pioneered the decentralized system blockchain, Ethereum's smart contracts gave blockchain imagination beyond payment, and UNI decentralized financial privileges and sounded the clarion call for the golden age of blockchain. From V1 to V4, from UNI X to UNI Chain, how far is UNI from the ultimate answer to Dex?

UNI V1: The Prelude to the Golden Age

It's not that there were no on-chain exchanges before UNI, but only after UNI can on-chain exchanges be called decentralized exchanges (Dex). Many articles attribute UNI's success to simplicity, security, privacy, and the creation of AMM. In fact, in my opinion, apart from simplicity, UNI's success is not closely related to other factors. Unlike what most people know today, UNI is not the first on-chain exchange to adopt the AMM model. Before UNI, there was Bancor (the second largest ICO project in the history of blockchain), and exchanges that adopted the on-chain order book model have long existed. UNI is neither the pioneer nor the only on-chain exchange that can achieve privacy and security. Why can UNI strike back? Let's first talk about Bancor, which was born earlier than UNI. The project was once a top-level on-chain exchange in the currency circle. EOS RAM and IBO (B refers to the Bancor protocol) that were popular in the early years both used the algorithm or protocol provided by Bancor to issue assets. The constant product market maker (CPMM) we are familiar with was also first practiced by Bancor. As for why Bancor was defeated by UNI, there are many explanations in the materials I have read. Some say it is a problem of US regulation, some say it is not as simple as UNI, and some say it is a problem of comparing algorithms and protocol mechanisms. We will not elaborate on these issues here, because, in my understanding, the logic of UNI's success is very simple. It is the first Dex project that meets the definition of DeFi. The use of the AMM model was the only way to democratize market makers and asset issuance at that time. The on-chain order book model or the mixed on-chain and off-chain exchanges would never allow users to list tokens at will. On the other hand, users could not participate in market making or provide liquidity to make profits, which led to the lack of trading pairs and slow transaction matching in this type of project. Bancor, which also uses the AMM model, failed because of its rigid liquidity and the fact that the issuance of tokens requires the consent of the Bancor project party and the payment of listing fees. In essence, this project still operates around the interests of centralized entities and does not really return the "privilege" to users.

In my opinion, the early version of UNI is not very easy to use. The short-term price fluctuations are huge (one of the inherent problems of CPMM, through instantaneous large transactions, the token price can also be manipulated by attackers in a short time), the slippage caused by the inability to directly exchange between ERC20, the high gas cost, no slippage protection, and the lack of various advanced functions. Although AMM solved the problem of lack of liquidity and slow transaction matching in Dex under the order book model at that time, it is destined to not be able to compete with Cex. There were not many early users of the V1 version, but its significance is historic. It is the first manifestation of financial democratization in Dex, an exchange with no threshold for listing coins, and an exchange with liquidity from the public. It is precisely because of the existence of UNI that Meme Token can be so popular today, and some projects without top team backgrounds can also shine on the chain. Some privileges that once belonged only to large financial institutions also exist in every corner of the blockchain today.

UNI V2:DeFi Summer

UNI V2 was born in May 2020. Compared with today's "DeFi behemoth", the TVL of UNI V1 was less than 40M at that time. The improvements of V2 focus on the main shortcomings of V1, such as the short-term price manipulation mentioned above and the need for ETH to transfer token exchange. In addition, a flash exchange mechanism is introduced to improve overall practicality. The most noteworthy thing in this version is UNI's idea of ​​solving price manipulation. UNI first introduced a price determination mechanism at the end of the block, which takes the price of the last transaction in each block as the price of the block. In other words, the attacker must complete the transaction at the end of the previous block and complete the arbitrage in the next block. To achieve this operation, the attacker must be able to complete selfish mining (that is, concealing the block from broadcasting to the network) and mining two blocks in a row, otherwise the price will be corrected by other arbitrageurs, which is almost impossible to achieve in actual operation, and the cost and difficulty of the attack are greatly increased. Another point is the introduction of time-weighted average price (TWAP). This mechanism does not simply take the average price of the last few blocks, but weighted averages according to the duration of each price. Let me give you an example. Suppose the prices of a token pair in the past three blocks are:

● Block 1: Price 10, Duration 15 seconds

● Block 2: Price 12, Duration 17 seconds

● Block 3: Price 11, Duration 16 seconds

Then the value at the end of block 3 is: 10 * 15 + 12 * 17 + 11 * 16 = 488. If you want to calculate the TWAP of these three blocks, it is 488 / (15 + 17 + 16) ≈ 11.11. Through this weighted average, short-term price fluctuations have less impact on the final TWAP, and the attacker needs to manipulate the price for a longer period of time to affect the TWAP, which makes the attack more costly and more difficult.

This idea can also be seen as an effective way to fight against MEV in the early stage. In addition, it also makes AMM more secure and reliable, and UNI gradually becomes the mainstream choice of on-chain Dex. After talking about internal improvements, let's talk about external reasons. UNI's rise in this period actually has a certain luck factor. A key event occurred in June of 20, which officially opened the golden age of blockchain, which is what we often call DeFi Summer later. The cause of this event was that the lending platform Compound Finance began to reward Comp tokens to both borrowers and lenders, and other projects followed suit, bringing about stacking investment opportunities known as "yield farming" or "liquidity mining" (today's Point is actually a rogue version of liquidity mining). As a Dex with a very low threshold for listing and active liquidity addition, UNI is naturally the first choice for carrying all kinds of copycat projects. The situation of "gold miners" breaking through the threshold is like the California gold rush in the mid-19th century. The crazy liquidity infusion has made UNI firmly sit in the top spot of DeFi (UNI V2's TVL peak exceeded US$10 billion on April 29, 21). At this point, DeFi has become famous and blockchain has begun to enter the mainstream.

UNI V3: The beginning of a long journey to fight against Cex

UNI has been the standard answer to AMM-type Dex in version V2. It can be said that the core architecture of 99% of similar projects in that era is almost the same as UNI. At this time, UNI's enemy may no longer be Dex, but Cex. Compared with the high efficiency of centralized exchanges, a big problem with AMM is the low utilization rate of funds. For ordinary users, there is a great risk of impermanent loss in providing liquidity for non-stable currency trading pairs. For example, in the DeFi Summer of 20-21, it is common to return the principal to zero in order to obtain liquidity mining income. If you want to continue to make profits in LP, the best choice is naturally stable currency trading pairs, such as DAI-U, which means that a considerable part of the funds in TVL have little practical utility. On the other hand, the liquidity of V2 is evenly covered in all price ranges from 0 to ∞. Even if some price ranges have never occurred, liquidity is also covered on them. This is a manifestation of low capital utilization in V2.

To solve this problem, UNI introduced concentrated liquidity in the V3 version. Unlike V2, where liquidity is evenly distributed across the entire price range, V3 allows LPs to concentrate their funds within a specific price range of their choice. LP funds are only used within the price range, rather than being dispersed across the entire price curve. This allows LPs to provide the same liquidity depth with less funds, or provide greater liquidity depth with the same funds. This approach should be particularly beneficial for stablecoin trading pairs that trade in a narrow range.

But in terms of specific circumstances, the results of V3 are not as good as imagined. The reality is that most people will choose to provide liquidity within the range of expected price fluctuations. This means that these high-yield areas will be flooded with capital, while other areas will still lack liquidity. Although the capital utilization efficiency of a single LP has improved, the distribution of overall funds is still uneven, and it will not significantly improve the problem of low capital utilization efficiency in V2. In terms of liquidity efficiency, it is not as good as the price box proposed by Trader Joe in the same period. Stablecoins are not as good as Curve in terms of transaction optimization. And with the advent of Layer 2, Dex, which is based on the order book model, is likely to occupy a high position again. At this time, UNI has not yet realized its dream of conquering Cex, but has fallen into the embarrassment of a "midlife crisis".

UNI V4: Ten Thousand Hooks

UNI V4 is a major update two years after V3. We have made a more detailed analysis of this in our previous research reports. I will just briefly state it here. Compared with the V3 version two years ago, the core of V4 lies in its pursuit of customization and efficiency. The V3 version needs to introduce a centralized liquidity mechanism to improve the efficiency of capital utilization, but the trading position requires LP to accurately select the price range, which has certain limitations and may face the problem of insufficient liquidity in extreme market conditions. Compared with this, the Curve protocol and Trader Joe mentioned above provide better options.

The advantage of the V4 update is that it can achieve the best balance between customizability and efficiency, in order to achieve precision and capital utilization that surpasses both. The most important Hooks (also smart contracts) mechanism gives developers unprecedented flexibility, allowing developers to insert custom logic at key points in the life cycle of the liquidity pool (such as before/after transactions, LP deposits/withdrawals). This allows developers to create highly customized liquidity pools, such as supporting time-weighted average market makers (TWAMM), dynamic fees, on-chain limit orders, and interactions with lending protocols.

On the other hand, V4 adopts the Singleton structure to replace the Factory-Pool architecture that V1 has been using to this day, and concentrates all liquidity pools in a smart contract so that developers can build more of their own Lego blocks. This greatly reduces the gas cost of creating liquidity pools and cross-pool transactions (can be reduced by 99%), and introduces the "Flash Accounting" system to further optimize Gas efficiency. As an update at the end of the 23-year bear market, UNI V4 has greatly recovered its position in the AMM competition that has gradually been at a disadvantage. However, the high degree of customization of V4 also brings some problems. For example, developers need to have stronger technical capabilities to fully utilize the Hooks mechanism, and need to design carefully to avoid security vulnerabilities. In addition, highly customized liquidity pools may also lead to market fragmentation and reduce overall liquidity. In short, V4 represents an important direction for the development of DeFi protocols-highly customized and efficient automated market maker services.

UNI Chain: Towards Highest Efficiency

UNI Chain is a major update announced recently, and it also symbolizes that the future direction of Dex may be to become a public chain (but what puzzles me is that UNI Chain is not an application chain). UNI Chain is built on Optimism's OP Stack. The core goal of the chain is to improve transaction speed and security through innovative mechanisms, and ultimately capture the value of the protocol itself and give back to UNI token holders. Its core innovation is reflected in three aspects:

Verifiable block construction: Using Rollup-Boost technology in cooperation with Flashbots, combined with the Trusted Execution Environment (TEE) and Flashblocks mechanism, fast, secure and verifiable block construction is achieved, reducing MEV risks, increasing transaction speed and providing rollback protection;

UNIchain Verification Network (UVN): Incentivizes validators to participate in block verification through UNI token staking, solves the risk of single sequencer centralization, and improves network security;

Intent-driven interaction model (ERC-7683): ​​simplifies user experience, automatically selects the optimal cross-chain transaction path, solves liquidity fragmentation and inter-chain interaction complexity, and is compatible with OP Stack and non-OP Stack chains;

In short, it is MEV-resistant, decentralized sorter, and intent-centric user experience. UNI becoming a member of the super chain will undoubtedly make the OP Alliance stronger again. However, this is bad news for Ethereum in the short term. The deviation of the core protocol (UNI accounts for 50% of Ethereum's transaction fees) will make the fragmented Ethereum even worse. But in the long run, this may be an important opportunity to verify the Ethereum rental model.

Conclusion

At present, as the infrastructure performance of DeFi applications exceeds that of other applications, more and more Dex are turning to the order book model. AMM is simple, but it is just an order book model that only needs performance, and the capital utilization rate of AMM will never be higher than that of the order book. So will AMM disappear in the future? Some people think that AMM is just a product of a special era, but I think AMM is already a totem of Web3. As long as Meme exists, AMM will exist, and as long as the bottom-up demand is still there, AMM will exist. One day in the future, we may see UNI being surpassed, or even UNI launching an order book, but I believe this totem will remain forever.

On the other hand, UNI is now becoming more centralized, with a16z "vetoing" its governance, and charging fees on the front end without informing the community. One thing we have to admit is that the way Web3 develops is contrary to human nature and reality. How exactly should we coexist with these giants that have suddenly grown up? This is a question we all have to think about.

References

1.UNIswap Documentation

2. Re-examining the Bancor Algorithm: Why CW is an Invalid Design

3. UNIswapX Research Report: Summarizing the development chain of V1-3 and interpreting the principle innovation and challenges of the next generation of DEX

4.UNIswap: From Zero to Infinity

5.YBB Capital: Farewell to Fork Swap, is UNIswap V4 entering the era of "Ten Thousand Hooks"?