Uncovering the Uniswap NFT Market Protocol: More Than Just an Aggregator

Uncovering the Uniswap NFT Market Protocol: More Than Just an Aggregator
This time, Uniswap did not just release an aggregator platform and scheduling protocol, but released two complementary protocols, Permit2 and Universal Router.

Written by: Shisijun

For UniSwap, which has a daily trading volume of US$770 million and more than 4 million users, entering the NFT market also means the beginning of a new round of offense and defense. Many platforms are worried about whether the other party will throw out a good card like SudoSwap that is a king bomb at the beginning.

However, the market data after three days of launch was disappointing. With the 500WUSDC airdrop and GAS discount, it only received 2% of the transaction share. For a while, mediocrity and unremarkability became synonymous with the Uniswap NFT market.

Is that really the case? In fact, the current markets and contracts are not complete versions, and even many functions are not open. Please follow Shisijun. This article will start from the operation of the NFT trading market and the principle of aggregators, combined with Uniswap’s latest Permit2 and Universal Router protocols, to deeply understand how the largest DEX platform thinks about the dilemma of FT and NFT Swap!

1. Background

1.1. What is an aggregator?

Traditionally, aggregators are mainly used for data aggregation. They can collect data across various websites and then present the information in a platform in different categories to meet the needs of different users. Professional NFT aggregators need 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: Provides functions that a single NFT market does not have, and focuses more on user experience

  • Trading experience: The following will sort out various trading system architectures. You can clearly feel the fragmentation of the trading process and the inability to complete the one-click trading experience in one step.

So why is there a demand for aggregation in NFT purchases? Let’s first outline the operating model of the mainstream NFT market.

1.2. Mainstream trading market model

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

  • On-chain orders:

  • Vertical built-in market: [Contract interpretation] CryptoPunk The world's earliest decentralized NFT trading market

  • AMM Matching Market: Explained in One Article - AMM Mechanism of SudoSwap, a Newcomer in the NFT Market - Innovation Challenges and Limitations

  • Off-chain orders:

  • Third-party market: After capturing X2Y2’s 100,000 NFT orders, how many users actually did so after analyzing whether they could waive royalties?

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

The advantages of off-chain orders are: low cost and easy traffic aggregation, 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 single platform and completes the transaction.

Currently, Uniswap has integrated the top 10 trading platforms: OpenSea, X2Y2, LooksRare, Sudoswap, Larva Labs, X2Y2, Foundation, NFT20 and NFTX.

Currently, the third-party market model for off-chain orders is the mainstream (more than 90%), and its greatest competitiveness lies in traffic and user habits, which is closely related to the design of the contract system and is also combined with user cognitive habits.

From the seller's perspective, they will place orders wherever there are buyers and where transactions are easy to complete, and buyers will naturally look for platforms with more seller orders to quickly complete transactions. However, although there is a giant OS, it is not the end of the competition. Although OS has a solid 80% of the transaction volume, it has always hoped to go the web2 listing route, so it has been slow to issue coins and share revenue with users. As a result, it has gradually been eroded by x2y2 and other aggregators this year. However, other platforms are trapped by their own small traffic, and most new users prefer large platforms, so they have mediocre development.

1.3. Working Principle of Aggregator

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

Among the 9 platforms integrated by Uniswap, platforms like os and x2y2 all have open order pool systems. The purpose of this opening is to provide a system for programmatic order transactions, which is mostly used by robots. For a platform, a good platform is one that can complete transactions quickly. Opening an order pool is a mutually beneficial intention for ecological co-construction.

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

How does aggregation replace third-party markets to complete orders? For example, as shown in the following figure

The pre-process is

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

  • First, the seller authorizes the NFT contract (operation 0), thereby allowing the deduction. At this time, x2y2:Exchange can directly transfer the seller's assets in the NFT contract at any time, which is why the third-party platform is too centralized.

  • The transaction intention is confirmed by on-chain signature verification, such as x2y2:Exchange or os:Seaport protocol.

  • The order comes from the web2 system of the third-party market. The aggregator gets the user's signature and the selling conditions (for example, 1 monkey can only be traded for 50 ETH)

The execution flow is:

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

  2. The user sends a transaction to the aggregator's on-chain contract

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

  4. Because it passes through the aggregator contract, multiple purchases can be completed in the same transaction

1.4 Why can aggregators 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 of an on-chain transaction is composed of three aspects:

  1. Gas consumption of a single transaction: 21000 Gas

  2. Transaction parameter cost: 68 Gas per non-zero byte

  3. Consumption when executing a contract: Gas cost is calculated based on the modification of the storage slot and the EVM workload

Therefore, the part that can be saved is: the process of combining N transactions into 1 transaction, and the cost of N-1 transactions saved.

Further reading: [Source code interpretation] What exactly is the NFT you bought?

Combined with the following figure, the specific calculation of the efficiency

  • The more aggregated transactions, the more cost-effective it is: if the platform needs 20WGas to complete a single NFT transaction, then 10 transactions can be completed as one transaction, which can save 9*21000 Gas, which is about 9.45% of the 10 transactions.

  • Aggregation itself also consumes a lot of money: for example, a single Gem transaction costs 280,000, and a batch transaction of 2 requires 500,000. Roughly, each NFT needs to share 60,000 aggregation losses. Therefore, it will only start to be cost-effective when the batch transaction is more than 3.

The transaction type and Gas table in the figure above (randomly selected, not statistical results)

1.5 What is the value of aggregators?

The batch trading function catered to the demands of project hype, investors' rush to buy, and retail investors' easy-to-use tool competitions for a period of time, so it has good traffic and brings in order transactions. In fact, half of x2y2's orders come from aggregators.

Compared with traditional trading markets, NFT aggregators have some obvious advantages, including:

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

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

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

  • 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, all kinds of users can benefit and be reached, including the project parties’ bulk buying and selling and market making, large investors’ bulk buying and selling, and retail investors’ observation of data information. Therefore, the aggregator is going further and further on the road of tool attributes, and the competition is becoming more and more fierce. It tests how to reduce the loss of 60,000 in the contract implementation, and how the tool platform can better present the data. However, the author believes that the main value and goal of Uniswap’s NFT market is not to make a good tool that is easy to use, but to realize a unified on-chain interaction protocol, which is aimed at how to achieve a smoother transaction process when the payment method is not ideal.

2. UniSwap’s NFT Exchange Protocol

Don’t be impatient, and don’t use the current low trading volume to fight back. The author is not endorsing the project or writing soft articles, but from its source code implementation, I can see that more functional points are reserved, not just the currently open functions.

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

This time, UniSwap did not just release an aggregator platform and scheduling protocol, but released two complementary protocols , Permit2 and Universal Router.

2.1. Permit2 - A new generation of efficient and secure authorization protocol

2.1.1 Limitations of traditional authorization mechanisms

Remember the x2y2 architecture diagram above? A new user wants to complete an NFT transaction. For such a simple request, the first thing he needs to do is to replace Weth and authorize the deduction of Weth and the corresponding NFT contract.

The cost of one or two transactions is not only limited, but also involves the risk of unlimited deductions and theft. In the previous OS, the pending orders did not automatically expire, such as problems with the chain settings, which led to losses when users transferred high-net-value NFTs from cold wallets to low-priced transactions.

2.1.2. Withholding authorization is a common problem of ERC20

Although there is Eip-2612: "EIP-20 approval through EIP-712 secp256k1 signature" which has entered the final stage, from the perspective of the protocol, ERC20 is still a second-class token because users do not have the ability to interact with Ethereum without holding any ETH.

The above picture shows how to use Eip-2612 to implement unauthorized deductions.

  1. Alice signs the off-chain “permission” message msg and sig, indicating her authorization of the permission (based on EIP-2612) token.

  2. Alice submits msg and sig 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 obtains authorization based on EIP-2612 tokens and can deduct Alice's tokens.

It is an improvement to the ERC20 standard that solves these shortcomings (additional approve expenses and unlimited withholding risk), but it can only be applied to new token contracts that integrate Eip-2612.

2.1.3、uniSwap’s Permit2 authorization optimization mechanism

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

permit2 is a design that is compatible with any token, which is equivalent to a unified authorization management contract.

  1. Upper part: Alice calls approve() to grant unlimited authorization to the Permit2 contract based on the ERC20 contract.

  2. Lower half: Alice signs the off-chain "permit2 type" messages msg and sig, indicating signature permission.

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

  4. The protocol contract calls the Permit2 contract, and after verifying msg and sig, controls the erc20 transfer from its authorization

Overall

Although requiring users to authorize a license first seems like a step backwards. However, instead of granting it directly to a certain protocol, users grant it to a standard Permit2 contract (which can be unique to the public chain). Users only need to authorize once, and then they can skip all subsequent authorization operations for protocols and transactions with them, and use off-chain signatures instead. This means that users no longer need to initiate separate transactions to interact with various protocols.

More scenario-specific capabilities can also be implemented here, such as automatic validity period of signature authorization, so there is no need to worry about the risks of long-term authorization, and batch approval (signatures for multiple deductions can be completed in one go, and batch cancellation of deduction authorization signatures can also be completed in one go).

Automatic validity period is similar to: [Source code interpretation] How does Ethereum's new standard EIP-4907 realize NFT leasing?

Once it is formed, or based on the popularity of Uniswap itself, a completely decentralized protocol that can only control authorization through user signatures will become a must-have for everyone (who would refuse something that is both safe and cheap?).

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

Yes, Permit2 has been integrated into the Universal Router released by Uniswap at the same time, which is the underlying protocol of the NFT market. The code has been integrated but the functions have not yet been opened (because the NFT version of Permit2 has not yet been released). Currently, the ERC20 version of Permit2 is only being tested on a small scale.

2.2. Universal Router - Unified FT and NFT Exchange Protocol

The positioning of this protocol is: the next-generation router of Uniswap, which unifies the swap transactions of F and NFT into a highly flexible, gas-optimized, secure and scalable exchange router.

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

Its application scenario is an aggregator, but it is not just an aggregator. Its target is a multi-asset swap protocol that can perform exchanges (such as Uniswap pools and NFT markets).

2.2.1. What is the value of the Universal Protocol?

The value comes from the current complexity of executing NFT purchases.

  • There is little protocol layer support for purchasing NFTs with any ERC20 (except for the natural support of OpenSea's Seaport protocol), which means that if you want to purchase NFTs directly with any ERC20 (such as USDC), you need at least 2 transactions from USDC→ETH and from ETH→NFT.

  • Both buying and selling NFTs require an authorization, and cross-platform transactions require multiple authorizations, resulting in high protocol compatibility and upgrade costs. It can naturally integrate uniswapV2 and V3, perform multiple token exchanges (as shown below), and purchase NFTs from multiple markets in one transaction.

In fact, the Seaport protocol, the culmination of OS, also realizes the exchange between any asset combinations (also, the web3 end website currently does not open all the protocol preset functions). The support of the full on-chain protocol layer can allow more applications to naturally integrate the direct exchange between on-chain FT and FT, FT and NFT combinations. Higher transaction efficiency will also open up more application scenarios (refer to the World of Warcraft trading system, the most basic point-to-point single commodity transaction will eventually be replaced by batch and mixed transactions).

The ultimate value of multi-token payment is that users do not need to keep ETH as a handling fee. This will further reduce the transaction process. Of course, to fully achieve this, it probably depends on the future blueprint of the ERC-4337-based account system to be realized.

Further reading: Ethereum Account Abstract 10,000-word research report: Disassembling 10 related EIP proposals and the seven-year journey to break the bottleneck of tens of millions of daily active users

Of course, you cannot currently see the actual operation of such multi-token payments in on-chain transactions, because it has not been fully released (the NFT version of permit2 is still required) and is still in an optimization stage waiting for the vulnerability plan to be modified.

2.2.1. How much resources does approve occupy?

Based on on-chain data statistics, as of block height 1597W, Ethereum has accumulated a total transaction volume of 1.757 billion.

There are a total of 47.7 million transactions that executed the ERC20 approve function, with an average gas consumption of 84,699 per transaction and a historical average gasPrice of 73Gwei.

Finally, converted into ETH, the cumulative consumption was 295345 ETH, which is 380 million US dollars at the current price.

Summarize

Although this article seems soft, and even in the case of significant on-chain data (insufficient transaction volume), it is still analyzing the pros and cons of such a transaction protocol. In the final analysis, the author is more optimistic about such a non-upgradeable ownerless protocol, which is completely open to code and SDK, and 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, fully functional multi-order system is completely open to the outside world, providing a giant's shoulder for countless dapps (such as gamefi) that need to build their own internal trading platforms, and the world of web3 can gradually establish its value on decentralized protocols one by one.

The current protocol does have limitations

If you want to integrate this protocol to realize NFT interaction functions, the core problem is that it is too dependent on the centralized order pool. Today, order information is queried through the official website of Uniswap itself, such as os, x2y2, etc., in addition to direct queries of contracts that are fully supported on the chain like SudoSwap (the initial concept of SudoSwap was amazing, but the operation was bleak, and the token allocation protocol released was too biased towards the development team, and gradually no one was interested). The gas optimization effect of transaction aggregation still depends greatly on the number of NFTs traded, so the attribute positioning of tooling (for project investors) remains unchanged.

Although Uniswap's protocol is positioned to build a public infrastructure that drives the development of cryptocurrencies, and adopts a model that is easier for developers to integrate with other dapps, the product's functions are still based on the starting point of an aggregator, but there are no more tools that meet the needs of aggregator users. Naturally, it was not well received at the beginning, even with the 500WUSDC airdrop.

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 have to endure the poor product experience and the era of using products is over.

Scott, the head of Uniswap NFT products, once said on Twitter that Uniswap will implement NFT transactions by inheriting Sudoswap. It is expected that the infrastructure launched later will no longer be such a fat protocol, but a thin application.

<<:  Web3 security incidents in November: 36 in total, with losses of $590 million

>>:  Variant co-founder: How does the FTX incident affect our view of user ownership?

Recommend

What is Danfeng Eye?

Danfeng Eyes, What Are Danfeng Eyes? People with ...

Revealing the secrets of what kind of face is unlucky for your husband

No matter whether you have a face that brings bad...

What are the shortcomings in personality and fortune of people with thin cheeks?

1. Poor marriage fortune Generally, people with t...

Bitmain Hard Fork

Author: Jiang Xiaoyu, Editor: Qin Jin Bitmain, wh...

How to predict diseases through palm lines

We all know that looking at our palm lines can in...

Do people with pointy ears have bad luck?

"Any change in the five senses will lead to ...

Three types of faces indicate a hard-working life

When we were young, we understood that what is ea...

What is the face of a boy with a long head? Which face has the worst fate?

Generally speaking, boys with long heads will gro...

A Little Miner's Mining History (Part 1)

Introduction: Today I officially dismantled my gr...