The preemptive transaction damages the fairness of DeFi. What is the solution to the “fair ranking” proposed by Chainlink?

The preemptive transaction damages the fairness of DeFi. What is the solution to the “fair ranking” proposed by Chainlink?

Loading

Fair sequencing service FSS provides DeFi developers with the tools they need to customize transaction sequencing principles to ensure the fairness of the system and user experience.

Original Title: “Fair Ranking Service: Establishing a Verifiable Fair DeFi Ecosystem”
Written by: Ari Juels, Lorenz Breidenbach and Florian Tramè, at Chainlnk Labs

The development of Ethereum was initially driven by tokens, then decentralized exchanges, and now DeFi. With the increasing volume of transactions on Ethereum, gas fees in the network continue to break new highs. This means that Ethereum has achieved great success, but at the same time it also means that transaction costs have increased and mining delays have increased. The shrinking of transactions in the memory pool has also produced another side effect, which is the phenomenon of preemptive transactions.

User transactions will pass through the memory pool. Even when the gas price is low, savvy traders or algorithms can check the transaction content before mining. Therefore, experienced players can strategically create deals and profit through this advanced gameplay. They can pay a higher gas price than the current transaction to ensure that their transaction ranks first.

This problem does not only exist in imagination. A recent study conducted by Danian et al. (Note: including the author of this article) found that DeFi contracts generate up to several million dollars in revenue each year through runaway transactions.

The preemptive transaction damages the fairness of DeFi. What is the solution to the “fair ranking” proposed by Chainlink?

Nowadays, the gains of runaway transactions are definitely higher than the data shown in the research. At present, most transactions still come from centralized exchanges, and operators of centralized exchanges or other participants may rush away, so the findings in the research are likely to be just the tip of the iceberg. [1] Wall Street has been earning huge returns through runaway transactions for many years. The company regularly sells customer orders to high-frequency traders. The following example elaborates on this issue and its possible impact on smart contracts.

Sorting problems in DeFi and other fields

DeFi contract operators hope to provide customers with fair and transparent services, so they usually take some measures to restrict preemptive behavior, such as setting a gas limit, but these mechanisms still have loopholes. In addition, there is no mechanism to prevent miners from launching malicious attacks, such as manipulating the sorting mechanism. Prediction of oracle reports and other transaction types can also cause the same threat.

Daian et al. invented the term “miner extractable value” (MEV) to describe the opportunity for miners to profit from smart contract systems by manipulating the order of transactions. The term MEV itself is somewhat misleading, because not only miners, but ordinary users can also extract part (or most) of MEV. The power of miners to sort transactions in a block is not restricted, so MEV only represents the maximum value that various attackers can extract. MEV exists because most blockchains have an unspoken rule, that is, they are centralized for a period of time, which means that a certain miner can completely determine the order of transactions in each block.

Recently, some people have proposed to establish an MEV extraction system, and some people call it MEV auction. Regarding the concept of MEV auctions, there are some truths in support and opposition, and we believe that MEV auctions will be detrimental to the development of the community. Click here to view the details.

Currently, transaction processing solutions such as Rollup have been introduced. This solution can achieve scalability and transaction privacy, but unfortunately it still cannot solve the MEV problem. The Rollup scheme puts the transaction ordering power in the hands of those who package transactions. It basically turns MEV into REV, that is, “packager can extract value.”

When Chainlink Labs formulated the next development plan of Chainlink, it proposed to establish a fair transaction ranking mechanism in a decentralized (or even centralized) system. This solution can solve the Rollup mechanism and the transaction ordering problems in the entire DeFi field, and at the same time solve the problems of excessive gas cost and unfair transaction ordering. The name of this scheme is called Fair Ranking Service (FSS).

FSS can serve all smart contracts without changing the Layer1 blockchain where the contract is located.

In short, the underlying logic of FSS is: use the oracle network to sequence the transactions sent to a smart contract SC, including user transactions and oracle reports. The oracle node network obtains transactions and reaches a consensus on the ordering of transactions, and no single node can make a decision alone. Then, the node network sends the transaction to the smart contract SC. The node will add the nonce value or sequence number to the transaction, or send it in batches to sort the transaction.

FSS, like the MEV auction, separates the ability to extract MEV from the mining ability, but unlike MEV auctions, FSS does not essentially cause any preemptive behavior. In general, FSS eliminates the centralization factor in the mining process and implements a decentralized transaction sequencing mechanism.

Since the gas cost determines the ordering of transactions, what sorting standard should the oracle node establish? The most logical standard is “first come, first served”, which is sorted according to the time when the transaction arrives. So what should we do?

Order fairness

The issue of transaction sequencing is very important. In fact, it is a very difficult issue.

For decades, when studying the Byzantine fault tolerance mechanism (Note: the consensus mechanism of the permission system), everyone has ignored the issue of “sequencing fairness”. The goal of most BFT systems is activity and consistency, that is, transactions need to be processed in a timely manner, and all nodes need to reach a consensus on the order of transactions. But this principle does not specify how to sort when the transaction time is close. Even if all nodes receive T1 first and then T2, according to the BFT mechanism, T2 can be ranked before T1.

The recent research of Kelkar et al. (including one of the authors of this article) added the dimension of “ranking fairness” to the consensus for the first time. The specific details are very complicated, but the general logic is: if most nodes receive T1 first and then T2, T1 cannot be ranked behind T2. This includes a set of protocols called “Aequitas” [2], which together realize this function. Although the current operating costs of these agreements are high, we believe that they will produce higher practical value in the future.

FSS provides a framework for implementing transaction sequencing policies, one of which is Aequitas. It can also support simpler schemes, such as directly encrypting transactions, and nodes can use threshold signatures to decrypt after sorting. In addition, it also supports other schemes to insert oracle reports into transactions. (Note: If necessary, it can even support MEV auctions.)

In short, the purpose of FSS is to help DeFi developers establish standards and ensure fairness for users.

How are transactions sent to FSS?

Users can send transactions directly to the oracle network. Users need to send transactions to multiple nodes at the same time, so that all nodes participate in the transaction sequence to ensure fairness. [3]

We are currently exploring innovations to allow the oracle to monitor the memory pool on the target blockchain and obtain transactions from the blockchain on behalf of the SCON contract. Oracle nodes usually use web services as data sources, but they can also use memory pools as data sources and generate reports in response to user transactions. Please refer to the figure below for details.

This program has two major advantages:

  • High compatibility: Users can directly transfer transactions to the blockchain without providing any special software for interaction with the oracle network.
  • Low gas cost: If the transaction can be delivered to the memory pool to ensure delivery, then users don’t need to worry about the block confirmation speed, that is, the transaction transmission cost can be reduced. After the transaction is packaged into a block, a reviewable record will be created to prove that the transaction has not been manipulated. [4] The oracle network can provide a higher gas price and resend the sorted user transactions to the smart contract to ensure that the transactions are processed in a timely manner. However, the oracle network can reduce the gas cost of unit transactions through various technologies such as batch sending and packaging.

The preemptive transaction damages the fairness of DeFi. What is the solution to the “fair ranking” proposed by Chainlink?

The fair sorting service of the memory pool can be monitored. The user sends two transactions to the SCON contract, sending T1 first and then T2. ​​The oracle network finds the two transactions, sorts them according to the time when the transactions arrive in the memory pool, and sends them to SCON.

P2P networks are very complex, and attackers with fast network speeds and many peer nodes may become pre-runners. If the peer nodes of the oracle node are all over the entire network and actively monitor various attacks such as flooding, this can greatly increase the difficulty of running away.

In addition, the oracle node should also try other similar solutions to directly deal with the preemption problem in the smart contract (such as: commit-reveal mechanism or verifiable delay function). The key advantage of this scheme is that the oracle node can perform defenses off-chain, and avoid the problem of preemption faster (because the network causes delays rather than block confirmations).

The fair sorting service is a more innovative and simple solution, which can solve the problem of running off at the network level. For example, users can perform threshold encryption on transactions sent to the oracle node, and the transaction content will only be displayed after the nodes reach a consensus on the ordering of the transactions. [5] Encryption before transaction sorting can simply and effectively solve the problem of preemption in decentralized exchanges and other DeFi systems, but this can only hide transaction content, not transaction metadata, so based on transaction metadata There is still no way to put an end to a runaway transaction. (For example: knowing that a certain user has posted a transaction can also cause other users to jump in and run away, or conspire to run away with the person in charge of sorting) On Ethereum, mechanisms such as submarine transactions can be used to prevent more advanced runaway phenomena. It is not yet known whether a similar defense mechanism can be deployed at the network level. This issue is worth exploring.

to sum up

Although some systems can achieve fairness when running alone (such as batch auctions), they are not compatible with other systems. [6] Fairness in a broad sense will be a thorny issue now and in the future. The purpose of FSS is to provide DeFi developers with the necessary tools, customize transaction ordering principles, and ensure the fairness of the system and user experience. We will elaborate on the technical details of FSS in the white paper to be released later. All in all, we hope to establish a fair transaction sequencing mechanism to realize the original intention of DeFi, which is to establish a more fair and transparent financial system than Wall Street.

Thanks to Andrew Miller, Dan Moroz, Fan Zhang, and Sergey Nazarov for their comments on the first draft of this article.

[1] Take it literally. Only 10% of the iceberg floats on the surface. The trading volume of decentralized exchanges accounts for 0.1% of the total trading volume of all types of exchanges.

[2] Latin, meaning “fairness”.

[3] If users are worried about the review issue, they can also establish a slow channel to connect to the smart contract and send it through the oracle.

[4] Users can resend the transaction at a higher gas fee, overwriting the original transaction. How the memory pool handles overwriting transactions depends on specific policies. For example, the oracle network can only recognize that the transaction sent for the first time is legal, and prohibit users from overwriting the transaction to fully guarantee auditability.

[5] Khalil and others proposed a good plan for centralized exchanges.

[6] If the assets sold by the batch auction system are also sold in the continuous market, then participants in the latter can block the auction, that is, at the last second, decide whether to participate in the batch auction based on the latest market price.

Source link: mp.weixin.qq.com