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.
- Research report | Libra is still on the line, the project development is hot
- Weekly data on the BTC chain: data on the chain began to fall, and the exchange traded frequently
- Can BTC be independent?
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).
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:
- Exchange (Swap);
- Send (Send);
- Add liquidity, remove liquidity (Add/Remove Liquidity);
- 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%). .
(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.
(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.
(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.
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.
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.
(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”.
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!
Was this article helpful?
93 out of 132 found this helpful
Related articles
- BTC retreats slightly, but the average support is still strong
- Babbitt Entrepreneurship + | "All changes are possible", how does the investment institution X-Order explore the new open financial order?
- CasperLabs launches "Highway" to improve the security of the PoS blockchain
- People's Daily Commentary Blockchain: Breakthroughs in Overtaking
- Market Analysis: BTC continues to maintain shock consolidation, lowering expectations
- Insurance faucet accelerates the blockchain
- Bitcoin is inevitable in a battle: "quantum hegemony" between the real and the future