Interpretation of the UniSwap NFT market protocol is not just an aggregator

avatar
十四君
1 years ago
This article is approximately 2588 words,and reading the entire article takes about 4 minutes
In-depth understanding of how the largest Dex platform thinks about the dilemma of FT and NFTSwap.

For UniSwap, which has a daily trading volume of 770 million US dollars and more than 4 million users, entering the NFT market track also means the beginning of a new round of offensive and defensive battles. Wang fried a good card.

However, the market data for the first three days after the launch was embarrassing. With the 500 WUSDC airdrop + GAS discount, only 2% of the transaction share was obtained. The mediocre and unremarkable aggregator has become synonymous with the Uniswap NFT market.

Is that really all that is?In fact, the current market and contracts are not the full version, even many functions are not open

first level title

secondary title

1.1. What is an aggregator?

In the traditional sense, aggregators are mainly used for data aggregation. It can collect data across various websites, and then classify and present information on one platform to meet the needs of different users. A professional NFT aggregator needs to collect all NFT transaction order information from different public chains and applications and integrate them into one platform. This provides users with a smooth trading experience and improves transaction efficiency.

Therefore, the focus of the aggregator is:

  • Tool attributes: provide functions that a single NFT market does not have, and focus more on user-side experience

  • Trading experience: The following will sort out the various trading system architectures, and you can clearly feel the fragmentation of the trading process, and it is impossible to complete the experience of one-click trading in one step

So why is there an aggregated demand for NFT purchases? Lets start with an overview of how the mainstream NFT market works

1.2. The mainstream model of the trading market

The classification is based on the three core aspects of the transaction flow life cycle, how to publish, how to bid, and where to match the deal, and the different implementation of these three aspects will lead to differences in their traffic sources, operating costs, and market audiences. The typical ones are :

Interpretation of the UniSwap NFT market protocol is not just an aggregator

  • On-chain order:

  • Off-chain orders:

The advantages of on-chain orders are: security, information disclosure, and decentralization, but the disadvantages are high cost and lack of traffic

The advantages of off-chain orders are: low cost, easy to gather traffic, but the disadvantages are: centralization, trust cost and cancellation cost

The above is the model of a single NFT trading platform, and the aggregator is a tool that calls the system of the above-mentioned single platform and completes the transaction.

At present, Uniswap has integrated the top 10 trading platforms: OpenSea, X2Y2, LooksRare, Sudoswap, Larva Labs, X2Y2, Foundation, NFT 20 and NFTX.

At present, the third-party market model of off-chain orders is the mainstream. The biggest competitiveness lies in traffic and user habits. This is closely related to the design of the contract system and also combined with user cognitive habits.

secondary title

1.3, the working principle of the aggregator

The aggregator is naturally a tool attribute. It is calling the trading system of other platforms, rather than building its own trading protocol.

Among the 9 platforms integrated by Uniswap, os, x2y2, etc. are all open order pool systems. The purpose of this opening is to provide a system for programmatically realizing order transactions. Most of this is for robots. For the platform, it can Fast transaction is a good platform,Opening the order pool is the original intention of mutual benefit for ecological co-construction.

The on-chain order system analyzes mainstream on-chain protocols such as sudoswap and nftx.

How does the aggregation replace the third-party market to complete the order? Take a chestnut to see, as shown below

The pre-process is:

  • An order can be initiated by the seller or the seller, or even initiated by the platform (including the aggregator)

  • First, the seller authorizes the NFT contract (operation 0 ), thereby allowing the withholding. At this time, in fact, x2y2: Exchange can directly transfer the sellers assets in the NFT contract at any time,This is also the reason why third-party platforms are too centralized.

  • Use the method of on-chain signature verification to determine the willingness to trade, such as x2y2:Exchange or os:Seaport agreement

  • The order comes from the web2 system of the third-party market, and the aggregator gets the users signature and the sales conditions (for example, 1 monkey, 50 ETH can be traded)

The execution flow is:

  1. Build the buy and sell order parameters (including signature and amount) on the aggregator platform

  2. A user sends a transaction to the aggregators on-chain contract

  3. The aggregator contract replaces the part of 1 in the figure below and sends it to the contract on the third-party market chain

  4. secondary title

Interpretation of the UniSwap NFT market protocol is not just an aggregator

1.4. Why can the aggregator save Gas?

From the above process, the essence of the aggregator is to call the third-party contract, but it does not mean that the lower limit of the transaction is the third-party system, because the cost composition of an on-chain transaction is composed of three aspects

  1. The consumption of a single transaction itself: 21000 Gas

  2. Consumption of additional parameters of the transaction: 68 Gas for each non-zero byte

  3. Consumption when the transaction executes the contract: Calculate the Gas cost based on the modification of the storage slot and the EVM workload

[Source Code Interpretation] What exactly is the NFT you bought?

Further reading:[Source Code Interpretation] What exactly is the NFT you bought?

Combined with the figure below, the specific efficiency is calculated:

The more aggregated transactions, the more cost-effective: If the platform needs 20 WGas to complete a single NFT transaction transaction, then 10 transactions as 1 transaction can save 9* 21000 Gas, accounting for about 9.45% of the 10 transactions

Aggregation itself also consumes a lot: for example, Gem requires 28 W for a single transaction, and 50 W for 2 batch transactions. Roughly, each NFT needs to share 6 W of aggregation loss, so when more than 3 batch transactions, it will start bargaining

Interpretation of the UniSwap NFT market protocol is not just an aggregator

The above transaction type and Gas table (belonging to random separate sampling, not statistical results)

1.5. What is the value of the aggregator?

For a period of time, the function of batch trading has catered to the hype of the project side, the rush of investors to buy, and the selection of easy-to-use tools for retail investors. Therefore, it has good traffic and brings order transactions. In fact, half of the orders of x2y2 come from aggregators.

NFT aggregators have some distinct advantages over traditional marketplaces, including:

  • Highly aggregated information: such as transaction volume, floor price, transaction price, quantity, top holders, top buyers, etc.

  • Highly aggregated operations: Users can view, trade and buy NFTs on all markets through one platform.

  • Improve transaction efficiency: information and operation aggregation, easy price comparison decision

  • Diversified payment methods: Ideally (supported by the third-party market protocol itself), any token can be used for payment on the NFT aggregation platform.

On the whole, it is for the project party itself to buy and sell in batches, to buy and sell in batches for large investors, and to obtain benefits and access to various users of retail observation data information. Therefore, the aggregator is going further and further on the road of tool attributes. The competition is also becoming more and more fierce, that is, to test how to reduce the loss of 6 W in the implementation of the contract, and to test how the instrumental platform can better present the data.

first level title

2. UniSwaps NFT exchange protocol

Dont worry, dont use the current sluggish trading volume to fight back. The author is not endorsing or writing soft articles for the project, but from the implementation of its source code, I can see that more function points are reserved, not just the functions that are currently open .

For UniSwap, which has a daily trading volume of over 770 million US dollars and more than 4 million users, there is no shortage of contract development capabilities or insufficient investment funds. The more problem is, what kind of NFT trading protocol do users need? ?.

secondary titleUniversal Router

text

2.1.1. Limitations of Traditional Authorization Mechanisms

Remember the architecture diagram of x2y2 above? New users expect to complete an nft transaction. For such a simple request, the first thing they need is to replace Weth and authorize the withholding of Weth and the corresponding NFT contract.

text

2.1.2. Withholding authorization is a common problem of ERC 20

Although there is Eip-2612 that has entered final: EIP-20 approval through EIP-712 secp 256 k 1 signature, but from the perspective of the agreement, the status of ERC 20 is still a second-class token, because users in Without holding any ETH, there is no ability to interact with Ethereum

Interpretation of the UniSwap NFT market protocol is not just an aggregatorThe above figure shows how to use Eip-2612 to realize deduction without authorization

  1. Alice signs the off-chain permission messages msg and sig, indicating her authorization to grant (based on EIP-2612) tokens.

  2. The msg and sig submitted by Alice as part of her protocol contract interaction.

  3. The contract calls permit(), and the Token contract based on 2612 verifies the permission message and signature, and grants permission.

  4. At this time, the contract is authorized based on the EIP-2612 token, and Alice’s Token can be withheld

text

2.1.3, UniSwaps Permit 2 Authorization Optimization Mechanism

In order to solve the forward compatibility problem that must be integrated into the token contract layer based on Eip-2612 (that is, the old token cannot be used)

permit 2 is a design compatible with any token, which is equivalent to a unified authorization management contract

Interpretation of the UniSwap NFT market protocol is not just an aggregator

  1. The first half: Alice calls approve() to grant unlimited authorization to the Permit 2 contract based on the ERC 20 contract.

  2. Bottom half: Alice signs off-chain permit type 2 messages msg and sig, denoting signed permission.

  3. Alice calls the interaction function on the protocol contract, with msg and sig

  4. The protocol contract calls the Permit 2 contract to control the erc 20 transfer from its authorization after verifying the msg and sig

Overall:

Although asking the user to authorize the permission first seems like a step backwards. However, instead of directly granting it to an agreement, the user grants it to a canonical Permit 2 contract (which can be unique to the public chain).The user only needs to authorize once, and can skip all subsequent authorization operations of the agreement and its transactions, and use the off-chain signature instead. It means that users no longer need to initiate this transaction separately to interact with various protocols

There are also more scenarios that can be implemented here, such as the automatic validity period of signature authorization, so that there is no need to worry about the risk of long-term authorization, batch approval (multiple deduction signatures can be realized at one time, batch cancellation of the signature of withholding authorization Can also be realized in one stroke)

The automatic expiry date is similar to:[Source Code Interpretation] How does the new Ethereum standard EIP-4907 realize NFT leasing?

Interpretation of the UniSwap NFT market protocol is not just an aggregator

Once it takes shape, or based on the popularity of uniswaps own user base, a completely decentralized protocol that can only control authorization through user signatures will become a must-have for everyone (who would refuse to be safe and cheap).

So, what does this have to do with the launch of contracts in the NFT trading market?

secondary title

2.2. Universal Router - Unified FT and NFT exchange protocol

The positioning of this protocol is: Uniswaps next-generation router, which unifies swap transactions of tokens and NFTs into a highly flexible, gas-optimized, secure and scalable exchange router

This also means that the default swap routing function used by subsequent 400W users will be implemented by this protocol.

text

2.2.1. What is the value of the agreement?

The value stems from the complexity of the current process of executing NFT purchases.

  • Any ERC 20 purchase of NFT has little protocol layer support (except for the natural support of openseas Seaport protocol), so now if you want to realize any ERC 20 (such as USDC) to directly purchase NFT, you need at least 2 transactions from USDC → ETH, from ETH → NFTs,

  • Both NFT purchase and sale require an authorization, and cross-platform transactions require multiple authorizations, resulting in high protocol compatibility and upgrade costs. He can naturally integrate uniswapV2 and V3, first perform multiple token exchanges (as shown in the figure below), and purchase NFT from multiple markets in one transaction.

In fact, the Seaport protocol, the masterpiece of OS, also realizes the exchange between any asset portfolio. The full support of the protocol layer on the chain allows more applications to naturally integrate FT and FT on the chain, and the direct exchange between FT and NFT.

Interpretation of the UniSwap NFT market protocol is not just an aggregator

Further reading:

Further reading:Ethereum Account Abstract 4D Research Report: Dismantling 10 Related EIP Proposals and the Seven-Year Road to Breaking the Bottleneck of Tens of Millions of Daily Active Users

text

2.2.1. How many resources does approve occupy?

Based on the data statistics on the chain, as of the block height of 1597 W, the cumulative total transaction volume of Ethereum is 1.757 billion. There are a total of 4770 W transactions that execute the approve function of ERC 20, the average gas consumption per transaction is 84699, and the historical average gasPrice is 73 Gwei.

Summarize

Summarize

Although this article looks soft, even in the case of significant on-chain data (insufficient transaction volume), it is still analyzing the advantages and disadvantages of such a transaction agreement. In the final analysis, the author is more optimistic about such an agreement without an owner that cannot be upgraded and is completely open. Code and sdk, any application and protocol can be integrated. Similarly, although the Seaport protocol of os requires the coordination of a huge off-chain centralized system to operate, such a highly optimized and multi-functional multi-order system is completely open source to the outside world. ) and so on provide the shoulders of giants, the web3 world can gradually build its value on top of each decentralized protocol.

  • Currently its protocol does have limitations

At present, if you want to realize the NFT interactive function by integrating this protocol, the coreThe heart problem is still too dependent on the centralized order pool. Now the order information is os, x2y2, etc. query through the uniswap official website itself, in addition to the direct query of the contract that is fully supported on the chain like SudoSwap (the initial concept of sudoswap is amazing, but the operation is bleak, and the released token distribution agreement is too inclined to development The team, gradually no one cares about it). The gas optimization effect of transaction aggregation is still largely dependent on the number of NFT transactions, so the attribute positioning of instrumentation (for project side investors) remains unchanged.

Although the positioning of Uniswaps protocol is committed to building a public infrastructure that promotes the development of cryptocurrencies, it adopts a model that is easier to be integrated by developers and other dapps. At present, the function of the product itself is still the starting point of the aggregator.But there are no more tool integrations that suit the needs of aggregator users. Naturally, it was not popular at first, even if it was an airdrop of 500 WUSDC.

It has been half a year since Uniswap Labs acquired Genie, and the Uniswap NFT market launched today is almost the same as Genie half a year ago. Nowadays, due to the emergence of NFT markets such as X2Y2 and Blur that understand user needs, users had to endure the hot chicken experience of products, and the era of using products has passed.

Like and follow 14, bring you value from a technical perspective

You are welcome to leave a message from the background of the official account. The author discusses web3 industry issues

Like and follow 14, bring you value from a technical perspective

Original article, author:十四君。Reprint/Content Collaboration/For Reporting, Please Contact report@odaily.email;Illegal reprinting must be punished by law.

ODAILY reminds readers to establish correct monetary and investment concepts, rationally view blockchain, and effectively improve risk awareness; We can actively report and report any illegal or criminal clues discovered to relevant departments.

Recommended Reading
Editor’s Picks