MEXC Global Research: Ethereum’s MEV and Countermeasures

What is MEV?

MEV (Miner Extractable Value) was first proposed by Philip Daian et al. in April 2019 in the paper “Flash Boys 2.0” and started to gain traction following the development of DeFi.

Miner Extractable Value refers to a measure of the profit a miner (or validator, sequencer, etc.) can make through their ability to arbitrarily include, exclude, or re-order transactions within the blocks they produce.

In other words, miners can pack transactions in Ethereum to generate blocks. In the resulting blocks, miners can also re-order, include, exclude transactions, and do other operations. In addition to transaction costs and block rewards, the value miners receive from these operations is MEV.

In DeFi, MEV mainly occurs in arbitrage transactions and liquidation. Arbitrage transactions, such as between different DEXs like Uniswap and Sushiswap, may contain arbitrage opportunities.

For example:

Suppose the appearance of a $10,000 USD arbitrage opportunity on Uniswap after a large trade led to a price slippage. At this time, the arbitrage bot notices this and submits the arbitrage transaction to the miners. Then, there are two possible outcomes:

1. The miner will duplicate and review the arbitrageur’s transaction. The miner will trade and pack the opportunity first. If the benefits are higher than the simple operating costs, there will be sufficient incentives for miners to participate;

2. Other bots will notice this arbitrage opportunity and bid a higher transaction fee to start a bidding war for the arbitrage. This kind of bidding is called a “Priority Gas Bid” (PGA);

The profit behind this $10,000 USD is MEV. If the miners do not participate in the trade and the bots compete in a PGA, then the difference between the auction’s settlement price and the total MEV is the winning trader’s profit (for example, if an arbitrage bot pays the miners $7,000 USD, the remaining $3,000 USD is reserved for the arbitrageur).

Most MEVs are PGA-type MEVs, just like Uniswap arbitrage. However, there are other types of MEVs, such as theft from vulnerable smart contracts. Dan et al. described an example in their “Dark Forest” article and found a smart contract with a vulnerability that allows anyone to steal money from it. Dan plans to recover money from the loophole before the thieves have time to steal the money. However, an arbitrage bot automatically recognized the opportunity and copied Dan’s transaction, giving higher transaction costs. The bot successfully executed the transaction before Dan and eventually took the money away.

As development progresses, MEVs will exist across all smart contract blockchains. One party will always be responsible for sequencing transactions, including non-miner participants, such as validators in ETH2.0 and aggregators on Optimistic Rollup. Therefore, Flashbots proposed that MEV should be referred to more broadly as Maximum Extractable Value, expanding its scope from Ethereum to cover other blockchain architectures while keeping the name of MEV. It is worth mentioning that MEV extraction in Ethereum today is mainly performed by non-mining DeFi traders and bots.

MEV’s definite negative externality to the blockchain ecosystem is the malignant effect on the gas bidding mechanism. As long as the MEV is large enough, the runners will be willing to pay gas fees hundreds of times higher than ordinary transactions through vicious competition. At the same time, block space will record a lot of failed high fee transactions, resulting in a waste of this scarce resource, block space, and a certain degree of network congestion.

This results in ordinary traders and searchers having certain negative experiences regarding MEV. In traditional finance, regulators impose legal constraints on the behaviors that disrupt the order of market transactions, such as rush trading; In the decentralized financial ecosystem, it mainly depends on the game between stakeholders and the technological upgrading of decentralized system to promote the reform or optimization of the market mechanism.

MEV’s Impact

1. Leads to the reflections and redesign of ecosystem roles

2. Importance of fostering greater attention to the value of transaction data and the sequencing of block space

3. Miners can benefit from this extra profit

4. Hurting users: MEV is essentially a rush transaction and can cause network congestion

5. Hurting the Blockchain network: MEV essentially encourages consensus instability

6. There are no constraints or direct solutions and only mitigation measures are currently available

MEV’s Typical Practices

Front-running refers to earning profits by placing a particular transaction in the same block before the target transaction (attacked transaction), mainly for liquidation and arbitrage transactions.

Back-running refers to earning profits by placing a particular transaction in the same block as a target transaction, typically an Oracle transaction or a single big transaction order.

Sandwich attacks are the combination of the two forms of attack above which allows the target transaction to be caught exactly in the middle of two specific structured transactions for profit. Sandwich attacks greatly broaden the scope of an attack, making it possible to target even a common AMM DEX transaction. An attacker’s first constructed transaction creates greater price fluctuations, and the second structured transaction is executed immediately following the execution of the target, thereby profiting after exchanging the attacked cryptocurrency.

Flashbots

Flashbots is a research and development organization that aims to reduce the negative externalities and risks posed by MEV to the public chain of smart contracts. It wants to create a “permissionless, transparent, and fair ecosystem” for the public chain of smart contracts.

Flashbots provides a solution for MEV — MEV-Geth. MEV-Geth eliminates information asymmetry, opens arbitrage opportunities to the public and shares them with stakeholders. Ultimately, the distribution order of benefits established by Flashbots may form a bidding market based on arbitrage and liquidation bots, thereby eliminating free-rider behavior.

Flashbots’ solutions to mitigating the MEV crisis are divided into three parts: illuminating the dark forest, democratizing value mining, and distributing profits.

Illuminating the Dark Forest: To quantify the impact of MEV, Flashbots created the scanning of Ethereum blocks, enabling MEV indicators to display visualized MEV-Inspects, thereby eliminating information asymmetry.

Democratization of Value Mining: Ensure that all participants can use the basic financial module equally so that the core features of Ethereum can be retained. The publishing of go-Ethereum client upgrade, MEV-Geth, enabling of the block space sealed-bid auction mechanism, and conduction of transaction order preference communication alleviate the situation of front-running and back-running transactions and reduce the congestion of Ethereum to a certain extent.

Distribution of Profits: Establish a coordinated and sustainable ecosystem with full consideration of the roles of users, miners, developers, node operators, and others.

Related Data (Reference data: June 30)

Due to the persistence of transactions in the blockchain, MEV will always exist, and realized MEV could be roughly calculated from the historical data. According to Flashbots’ data, the cumulative MEV exceeded $749 million in January 2020.

(Source:flashbots MEV-Explore)

Proportion Of Protocols Used by MEV for Interaction

Uniswap: 42%

Sushiswap: 23%

Balancer: 11%

Curve: 9.8%

dydx: 7.6%

Others: About 6.6%

(Source:flashbots MEV-Explore)

The main ways to obtain MEV are arbitrage and liquidation, in which the proportion of arbitrage transactions is more than 97%.

(Source:flashbots MEV-Explore)

Some Conceptual Projects Focused on Mitigating MEV’s Issues

At present, there are two solutions to the negative impact of MEV. One is to let arbitrageurs and miners work together to avoid malicious competition among arbitrageurs. The other is to hide arbitrage opportunities, place transactions in black boxes, and give tips (extra benefits) to allow miners to pack selectively.

ArcherDAO

Native Token: ARCH

Price: 0.72USDT

Market Value: 8 million USDT

ArcherDAO is a network protocol that allows arbitrageurs and miners to work together directly. It uses a different solution than PGA to optimize the benefits of arbitrageurs and miners and avoid wasting gas costs for arbitrage. At present, ArcherSwap is a different solution from other DEXs, and is more in line with the future development of Ethereum.

There are two main roles in ArcherDAO, one as a miner and the other as a supplier. Suppliers submit transactions with MEV opportunities, miners pack transactions into blocks, and the protocol links the two to route transactions submitted by suppliers to miners.

In a collaboration effort, suppliers act as diggers for arbitrage and liquidation opportunities, and they are responsible for discovering potential profit opportunities everywhere. Once possible opportunities are found, they are sent to ArcherDAO, which in turn sends them to the miners for priority packing. Once the arbitrage is successful, the protocol will distribute the benefits proportionally between the suppliers and the miners.

Currently, in this distribution of benefits, the current protocol does not charge fees. In the future, some fees may be charged according to the governance of DAO.

mistX

Related token: Alchemist Project(MIST)

mistX is a decentralized exchange introduced by Alchemist using Flashbots technology. mistX, also known as FlashDEX, binds transactions through Flashbots to achieve transaction confirmation.

Additional ETH fees are required for transactions in Ethereum, but through mistX, no additional ETH fees are required for any cryptocurrency to be exchanged with ETH, and there are zero Gas fees for all such transactions.

However, when users use one token to exchange for ETH or use ETH to exchange for other tokens, they have to pay a percentage of the miners’ fees in each transaction, which is called “Bribe”. If two cryptocurrencies are exchanged in the transaction and there is no ETH involved, the user’s wallet must contain some additional ETH to pay the Gas fee.

Bribes are similar to Gas fees, except that they are used to protect transactions and prevent front-running transactions through mistX. By using Flashbots to “bind” a transaction before it is released, it will not be sent to the mempool to wait for miners to pack the transaction.

In addition, mistX can be used to cancel a transaction with one click without paying Gas fees. Since Flashbots uses “binding” to process transactions, users can cancel transactions at any time without paying any fees as long as the transaction is not confirmed on the network.

CowSwap

Related token: Gnosis Project(GNO)

CowSwap was developed by the development team for the Gnosis protocol. Gnosis is a decentralized application infrastructure. Products include decentralized prediction market, multisig wallet Gnosis Safe, Gnosis DAO, auction market, and many other types of applications.

CowSwap matches transactions using a “Coincidence of Wants (CoW)” approach. Simply put, if two people on CowSwap hold the assets the other wants, they can match the transaction directly without the need to broker transactions with a market maker or liquidity provider. This provides the best price for individual traders and exempts handling fees incurred by market makers or liquidity providers.

Since CoW’s approach does not require external liquidity in the chain, it avoids the appearance of MEV because it uses batch orders to settle at a unified price where all orders have the same price with zero transaction sequencing problems.

Comparisons of Anti-MEV DEXs

Automata Network

Native token: ATA

Price: 0.753USDT

Market Value: 90 million USDT

Automata Network is a decentralized service protocol with the functionality to enhance DApps or build privacy-based applications on decentralized networks. It provides traceless privacy services similar to middleware for applications in Ethereum, Polkadot, and Binance Smart Chain. The first two products of the Automata Network are Conveyor and Witness, where the Conveyor addresses MEV-related issues.

When Conveyor is handling MEV transactions, it uses specific Automata Network tokens gtoken (gETH, gBTC, and others) to help users implement privacy-protected transactions. Before the transaction starts, the user’s tokens are wrapped into gtokens. This allows transactions to be made using the private compute node, Geode. Wrapped tokens are processed by the Conveyor, which will not change the transactions sequence or obtain information about the contents of transactions. Only after the transaction is executed will the token be unwrapped and restored as required by the user.

KeeperDAO

Native Token: ROOK

Price: 164.07USDT

Market Value: 950 million USDT

KeeperDAO aims to encourage token holders to participate in the liquidity pool through economic incentive strategies to coordinate liquidation and rebalancing in margin trading, lending, exchanges, and other applications.

KeeperDAO allows users to concentrate their funds on Ethereum smart contracts and gain common benefits through on-chain arbitrage and liquidation opportunities. To maximize the use of idle funds, all assets in the pool will continue to lend to Compound, dYdX, and others. In addition, KeeperDAO participants do not need to build their own infrastructure and bots, design payment-first strategies, and others. This lowers the entry thresholds.

KeeperDAO eliminates MEV by sealing transactions/debts through specialized smart contracts.

When a transaction happens and the trader submits it to KeeperDAO, the KeeperDAO analyzes whether there is an arbitrage opportunity (by front-running or back-running transactions). If there is an arbitrage opportunity, KeeperDAO takes priority in earning its profits. After the transaction is completed, KeeperDAO mints a new ROOK to reward the trader (keeper_Fee) for compensating for the loss caused by the slippage. After rewarding the trader with profits, the Guardian’s profit is reduced, but the loss is still less than that of the “Gas War” during the competition in PGAs.

The Guardian provides trading strategies for KeeperDAO and returns all profits to KeeperDAO. Then, according to the total profit in the pool, ROOK is rewarded according to the Guardian’s proportion of return.

BackRunMe

BackRunMe is supported by bloXroute, which allows users to safely submit private transactions (such as protecting users from front-running and sandwich attacks), while allowing searchers to roll back transactions via MEV (if an arbitrage profit is generated), while BackRunMe returns a portion of the extra profit to users. Simply put, if a transaction does not create a rollback opportunity, it will be treated as a normal, private transaction. If the transaction still generates an arbitrage profit, the user sending the transaction, the miner, the discoverer of the arbitrage opportunity (also known as a searcher, usually a bot), and BackRunMe will share the profit.

Generally speaking, a rush attack involves three parties — the victim of the rush attack, the trading bot, and the miner digging out the block containing the rush attack. BackRunMe uses these participants to provide services that benefit ordinary users.

Users submit private transactions to bloXroute; bloXroute sends metadata and the arbitrage finder proposes to roll back the transaction bloXroute checks if the arbitrage opportunity finder’s response is procedural; through private communication, bloXroute sends the most efficient and beneficial bundle of MEV transactions to the pool for execution.