๐Ÿ“Œ Uniswap Technical Analysis Series #1: An Exchange Built on Mathematics Hello, I am BQ Developer. @BQ_Developer Every time I used Uniswap, I found it fascinating. How is it possible for an exchange to operate 24/7 without a single person? Starting today, I will explore over several parts how Uniswap made this "impossible" possible through various technical choices. First, let's find out why the Uniswap team created an exchange using a single mathematical formula instead of a traditional order book. ๐Ÿค” Want to create an exchange on Ethereum? When Hayden Adams first conceived Uniswap in 2018, the most natural approach would have been to move a traditional exchange onto the blockchain. But soon, he would have faced a fundamental problem. To place an order on Ethereum, you have to pay gas fees, and you also have to pay gas fees when modifying or canceling an order. When the market moves quickly, you need to constantly adjust your orders, but if you're paying $20-30 each time, who would do market making? The more critical issue is that in an environment where blocks are generated every 15 seconds, real-time order matching is impossible. Traditional exchanges process orders in milliseconds, which is structurally impossible on the blockchain. โš™๏ธ An Automated Exchange Made with Two Buckets The solution for Uniswap was simple. They eliminated orders altogether. Instead, imagine two connected buckets. One is filled with ETH, and the other with USDC. A trade is like taking liquid from one bucket (taking ETH) and pouring a corresponding amount into the other (adding USDC). The key here is that the relative levels of the two buckets determine the price. The more ETH you take, the lower the level of the ETH bucket, and the price of the relatively scarce ETH automatically rises. This entire process is controlled by a simple mathematical formula: x * y = k, where x is the amount of ETH, y is the amount of USDC, and k is a constant product. If you take from one side, you need to add more to the other side to keep the product constant. ๐Ÿง  A System That Operates Without People The most elegant aspect of this design is its complete automation. Traditional exchanges require market makers to constantly adjust quotes, but Uniswap does not need that. Every time a trade occurs, the price adjusts automatically, and trades can happen at any price from zero to infinity. When the price of ETH rises in external markets, arbitrageurs buy relatively cheap ETH from Uniswap, and the pool's price automatically aligns with the market price. There is no need for human intervention in this entire process. ๐Ÿ’ญ The Reality of Trade-offs Of course, this elegant solution comes at a cost. The biggest issue is slippage. The larger the trade, the more the price moves exponentially, which can lead to trading at a worse price than expected. Additionally, most of the liquidity in the pool is actually dormant at extreme price levels, reducing capital efficiency. However, considering these limitations, I believe what Uniswap has created is truly an incredible achievement. By replacing a complex financial system with a simple mathematical formula, they have built a global exchange that operates 24/7 without interruption. โœ๏ธ In the next part, While they created an exchange with x*y=k, I found a critical issue when actually using it. 90% of the money in the pool was dormant at extreme price levels that no one was using. How did Uniswap V3 solve this problem? --- Your likes and shares are love ๐Ÿฅฐ #BQDeveloper #Uniswap #AMM #DeFi
Show original
4.05K
7
The content on this page is provided by third parties. Unless otherwise stated, OKX is not the author of the cited article(s) and does not claim any copyright in the materials. The content is provided for informational purposes only and does not represent the views of OKX. It is not intended to be an endorsement of any kind and should not be considered investment advice or a solicitation to buy or sell digital assets. To the extent generative AI is utilized to provide summaries or other information, such AI generated content may be inaccurate or inconsistent. Please read the linked article for more details and information. OKX is not responsible for content hosted on third party sites. Digital asset holdings, including stablecoins and NFTs, involve a high degree of risk and can fluctuate greatly. You should carefully consider whether trading or holding digital assets is suitable for you in light of your financial condition.