The first anniversary of the Uniswap agreement, how is this alternative Ethereum DEX developed?

Uniswap, one of the most interesting dApp projects on the Ethereum platform in recent years, has ushered in its one-year birthday.

Uniswap is an alternative to the Decentralized Exchange (DEX), which achieves a high degree of decentralization. The project has no native tokens, and the project itself does not charge transaction fees, nor does it have any privileges (for example, if you I have issued an Ethereum token, and you can create a trading market yourself through Uniswap without the permission of anyone.)

The biggest feature of the agreement is that it does not have an order book. The price is automatically adjusted according to the user's purchase and sale on this exchange. Therefore, you can only passively accept the price of Uniswap, but not the pending order. This is also considered by many to be a flaw.

Despite this, Uniswap's performance in the DEX field is still eye-catching, and it is also an important part of the Ethereum DeFi ecosystem.

Uniswap

1. The birth of Uniswap

In July 2017, Hayden Adams, the founder of the Uniswap agreement, had just experienced unemployment. At that time, he knew nothing about Ethereum. Later he entered the circle under the Amway Foundation member Karl Floersch's Amway and spent I learned the basics of Ethereum, Solidity and Javascript for 2 months.

Then, based on the blog post published by Vitalik, Adams decided to implement an automated matchmaking market.

At that time, the most well-known project on the DEX market was EtherDelta, but its user experience was really bad.

At the same year's Devcon 3 conference, Karl Floersch introduced Uniswap's Demo application during the presentation, and it was this speech that attracted the interest of the attendant Pascal Van Hecke, who extended a helping hand to the Uniswap founder.

After nearly a year of development, Hayden Adams and others chose to deploy Uniswap's smart contract to the Ethereum main website on the last day of the Devcon 4 conference (November 2, 2018).

In addition, it is interesting that Uniswap was not originally the name of the project, its original name is actually Unipeg (a combination of unicorn and Pegasus).

Er

After Hayden Adams told Vitalik about the DEX project, Vitalik gave the project a better name:

"Unipeg? It sounds like Uniswap."

2. How to use Uniswap?

First, you need an Ethereum wallet, such as MetaMask, imToken, Coinbase, etc. Here is MetaMask as an example.

Then, use your browser to open the Uniswap Exchange and click on “Connect” to connect with your wallet account after jumping out of the “Connect Wallet” page.

Currently, there are four types of operations on Uniswap:

  1. Exchange (Swap);
  2. Send (Send);
  3. Add liquidity, remove liquidity (Add/Remove Liquidity);
  4. Create an exchange (Create Exchange);

The redemption operation can be divided into ETH ⇄ Token exchange and Token ⇄ Token exchange operation. The difference between the two is the handling fee. The former's handling fee is 0.3%, and the latter is about twice the former (actually 0.5991%). .

34

(Photo: Uniswap redemption page)

In the case of a Send operation, the exchanged coins are immediately sent to another person while the redemption operation is completed.

45

(Figure: Uniswap send page)

The “add liquidity” operation allows participants to enjoy the system's fee sharing, but this is not a stable profit, and participants also need to bear the risk of price changes.

56

(Figure: Uniswap adds liquidity page)

The final "Create Exchange" operation is to create a trading market for the ERC20 token you created. You only need to fill in the token address and click "Create Exchange" to complete the operation. Of course, after you complete this step, the token will not appear in the token selection column of the Uniswap website immediately, but you need to issue the issue and pull request in the uniswap-frontend repo . In the column.

In fact, this is done to avoid confusion caused by counterfeit coins of the same name. Of course, even if your currency has not been approved, you can find its market by searching for your token address.

1_PviRzzZvG0c7yovmtZoiCQ

3. What is the core principle of Uniswap?

Above, we briefly talked about the use of the Uniswap transaction protocol. So, what is the underlying implementation logic?

In fact, Uniswap is surrounded by the “constant product market maker” formula of x * y = k .

Where x and y are the number of tokens in the liquidity pool and k is the product. To make the product k constant, the changes in x and y can only be reversed. Examples are as follows:

The liquidity provider deposits 10 ETH and 500 OMG (ERC20 tokens) into the smart contract, and the invariant is automatically set to ETH_pool * OMG_pool = 5000 .

Then, someone wants to use ETH to exchange OMG with Uniswap, which sends 1 ETH to the contract, and the liquidity provider charges 0.25% of the transaction, and the remaining 0.9975 ETH is added to ETH_pool. Next, divide the invariant by the new ETH amount in the liquidity pool to determine the new size of the OMG_pool, and the remaining OMG is sent to the buyer.

"Buyer sent: 1 ETH fee = 1 ETH / 500 = 0.0025 ETH ETH_pool = 10 + 1 – 0.0025 = 10.9975 ETH OMG_pool = 5000/10.9975 = 454.65 OMG Buyer received OMG: 500 – 454.65 = 45.35 OMG ”

This fee is now added to the liquidity pool. Since the cost is added after the price calculation, the invariant will increase slightly with each transaction, which makes the system beneficial to the liquidity provider. In fact, this invariant really represents ETH_pool * OMG_pool at the end of the last transaction.

"ETH_pool = 10.9975 + 0.0025 = 11 OMG_pool = 454.65 New invariant = 11 * 454.65 = 5,001.1

In this case, the buyer received a rate of 45.35 OMG/ETH. If another buyer trades in the same direction, they will get a worse OMG/ETH trading ratio. However, if the buyer trades in the opposite direction, they will get a slightly better ETH/OMG rate.

32

Through the above introduction, we realized that if the transaction volume is too large, it will lead to the problem that the transaction price is too large.

In an active market, this model ensures that the transaction price does not deviate too much from other exchanges, but in a non-active market, the situation will be completely different.

summary:

Unlike traditional DEX, Uniswap eliminates the orderbook mechanism. Instead, it uses an algorithmic mechanism that guarantees liquidity and provides a lower price. This pricing mechanism works well and is easier to program in terms of programming. In addition, it has the benefit of relatively lower gas consumption.

twenty one (Photo from uniswap)

According to the data provided by Dapptotal, the value of the assets of the Uniswap agreement locks has risen from $100,000 in early November to nearly $18 million, which can be called “development stability”.

twenty one

We can see that Uniswap's 24-hour active users, transactions and transaction data are very prominent in the Ethereum DEX ecosystem, but compared to the lock-in value, its transaction data has ups and downs, which may be It has a lot to do with market conditions.

As for whether Uniswap and its DEX model will develop better in the future, it remains to be seen.

Reference materials:

1. Uniswap Whitepaper

2, https://medium.com/@hayden_41532/uniswap-birthday-blog-v0-7a91f3f6a1ba

3, https://dapptotal.com/defi

We will continue to update Blocking; if you have any questions or suggestions, please contact us!

Share:

Was this article helpful?

93 out of 132 found this helpful

Discover more

Blockchain

Interpreting FTX's preliminary restructuring plan Cash compensation is adopted, excluding FTT holders.

At present, the restructuring plan of FTX is still in its early stages. The team will submit a revised plan and discl...

News

Investment tips for the next bull market: In-depth analysis of the development status and trends of 15 cryptocurrency tracks

Following the regular industry cycle pattern, the bear market has passed halfway. The Ethereum upgrade has brought ab...

Blockchain

The original market maker is not "Zhuang"? What is the significance of the coin safety ball recruitment market?

On September 30th, the company announced that it has launched the Global Markets Program and will recruit Market Make...

Blockchain

Pushing the IEO platform and expanding the scale of the currency, why is the conservative Coinbase “flying itself”?

At the end of the IEO, Coinbase, the largest cryptocurrency trading platform in the United States, has heard the news...

Market

Wu said Zhou's selection Hong Kong regulatory agency opens retail trading, Curve hacked, Binance US Department of Justice progress and news Top10 (0729-0805)

Author | Wu's Top 10 Blockchain News of the Week. The Hong Kong Securities and Futures Commission has approved the li...

Market

What impact does BlackRock's submission of a physical Bitcoin ETF application have on the industry?

According to a public document, on the afternoon of June 15th, New York time, investment management giant BlackRock s...