The universe is a dark forest. Every civilization is an armed hunter stalking through the trees like a ghost, gently pushing aside branches that block the path and trying to tread without sound. Even breathing is done with care. The hunter has to be careful because everywhere in the forest are stealthy hunters like him. If he finds another life, there’s only one thing he can do: open fire and eliminate them. In this forest, hell is other people. An eternal threat that any life that exposes its own existence will be swiftly wiped out. — Cixin Liu, The Dark Forest
In The Dark Forest, Cixin Liu presented a universe surrounded by dangers: As you walk in the dark forest, any small sound might expose your position, and you will be met with an icy bullet. In the blockchain community, Ethereum is also a dark forest. This concept was first proposed in an article titled Ethereum Is A Dark Forest co-authored by Dan Robinson and Georgios Konstantopoulos, who described the adversarial environment of Ethereum as a “dark forest”.
Ethereum is indeed a law of the jungle world. However, this world is bright as opposed to dark. This is the case because the ETH network has to be transparent, and all transaction information is open. In such a trading environment, each block, before being packaged, enters a virtual pool called mempool, which acts as a cache of unconﬁrmed transactions and reserves them for a certain period (on Ethereum, it takes each block about 13 seconds to be packaged on average). Additionally, as the transactions between memory pools are shared with other validators, mempool is also a fully transparent. For example, on https://explorer.blocknative.com/, a mempool explorer, users can check the transactions waiting to be packaged in the memory pool.
You can randomly select one of the transactions to be packaged in Uniswap V2 and view the basic information of this transaction.
Here, the status is pending. In addition, you can also check the from address, to address, value, and the Gas amount.
This is like a beacon in the dark forest of Ethereum. Once other hunters smell profits, they will pull the trigger without any hesitation. Unlike the cosmic dark forest, exposed Ethereum users will not face lethal consequences; instead, they will suffer losses from a robbery unconsciously. Hunters have a sharp eye for the potential arbitrage opportunities in the memory pool. Armed with trading bots, a hunter uses the predetermined trading strategies to launch decisive attacks and leaves without any trace once the prey is pinned down.
Next, let’s talk about one common trading strategy: front running.
Ethereum features a mechanism called Priority Gas Auction (PGAs), which allows users to bid with gas fees, and the transaction with the highest gas fee will be executed first. This mechanism leaves much room for front-running bots. The robots first scan the transactions waiting to be packaged in the memory pool and execute the transaction ahead of the user by setting a higher gas fee. This depiction might be too abstract. In the following paragraphs, we will illustrate the sandwich strategy, a frequent trading strategy in front running, through the common AMM trading models on DEXs. As the name suggests, a sandwich attack involves frontrunning the victim trade with a trade buying the same asset. The gained tokens are sold again after (back running) the victim trade.
Hypothetically, the trading pair X/Y exists in an AMM pool. In AMM transactions, the product of the pool assets is a constant, i.e. X*Y=a. Let us assume that the initial liquidity X=100, Y=100, A=10,000;
Excluding the gas fee:
A learned about B’s plan to buy Y with 10X. A then launches a sandwich attack:
A buys Y first, X=100+10=110, Y=10,000/110=90.9; therefore, A receives 100–90.9=9.1Y;
B also buys Y, X=110+10=120, Y=10,000/120=83.33; therefore, B receives 90.9–83.33=7.57Y;
After B executes the transaction, A sells Y. Now, in this pool:
Y=83.33+9.1=92.43, X=10,000/92.43=108.19; therefore, A received 120–108.19=11.81X;
A pays 10X and receives 11.81X, making an arbitrage of 1.81X.
B could have used 10X to buy 9.1Y, but now B only has 7.57Y, suffering a loss of 1.53Y.
From the above results, bot A received profit from arbitrage while trader B suffered a loss. Of course, in a real-world scenario, A will also have to pay gas fees for front running and the transaction fee, so the final profit will not be that high. Are bots the shortcut to huge profits? The reality is far more disappointing than the ideal. With better performance and greater hashing power, larger bots will front-run small bots. In the dark forest, shooting exposes your position, and eventually, you will become the prey of other hunters.
Is there an apex predator in the dark forest? The answer is yes. As both the referee and the player, miners are the absolute alphas. In the article titled Ethereum Reorgs After the Merge, Phil Daian and Vitalik Buterin first proposed the concept of MEV (Miner Extractable Value), which was used to describe the front running of Ethereum DEXs. Through their packaging privileges, miners can reorder the transactions (e.g. insert or advance a transaction) for more profits. The Block explains it as below: In short, it’s possible for a miner who sees a lucrative transaction in a new block to go back in the chain to the point before the transaction occurred and create a new sequence — one that replaces the original transaction with one in which the miner takes the profits for themselves. It’s also called a “time bandit attack” because it’s like blockchain time travel.
Compared with the slaughters in the dark forest, MEV is far worse. Like gods from an epic civilization at a higher dimension, miners can easily annihilate players at lower dimensions and destroy their civilization in one strike. As such, MEV threatens the survival of Ethereum and undermines users’ confidence in the security and the resistance to censorship of Ethereum. At the same time, it dampens the motivation to march into the crypto community for large assets.
One day, the dark forest of Ethereum will usher into the dawn. In the open and decentralized era of blockchain, everyone and every community can make suggestions for the development of blockchain. Right now, there are three types of mainstream MEV solutions:
- Privacy Transactions: The principle of a private transaction is to bypass the public mempool and put the transaction in a private mempool waiting for the miner to package it so that it cannot be broadcast to other nodes. Current providers of privacy transactions include 1inch Stealth Transactions, Taichi Network, and bloXroute.
- MEV Auction: As the name suggests, MEV Auction splits miners’ rights of transaction choosing and ordering. In MEV Auction, the miner only has the right to choose transactions, and the right to sort transactions is assigned to Sequencer, which is elected through staking and bidding. MEV Auction is also quite problematic, as the Sequencer may collude with miners in a pump and dump scam.
- As a popular solution to MEV, FaaS (Function-as-a-Service) extracts MEV and then redistributes profits. Flashbots, for instance, is one type of FaaS. This solution allows the average users to tap into MEV and provides the developers in the ecosystem with publicly accessible MEV infrastructure and mining pool support.
Looking ahead, as Ethereum ushers into the 2.0 era, will there still be MEV?
Essentially, ETH2 is two chains merged into one; therefore, its client consists of two sub-clients, one of which is used for the execution of engines, and the other for consensus. It is noteworthy that the current PoW Ethereum client will persist in ETH2 and will be run together with the beacon client with shared responsibilities. Since the transaction ordering process in ETH2 will be the same as that of PoW Ethereum, it is reasonable to think that MEV opportunities will still exist as we know them today. The difference lies in who has ultimate control over the ordering, namely validators rather than miners, who have been selected to propose a beacon block.
In other words, MEV distribution mechanisms like Flashbots’ MEV-geth will persist on ETH2.0.
While MEV is notoriously hard to measure, Pintail did an interesting data analysis (for those of you who are interested, click the jupyter and python files at the end of the article to check out the source code), where Flashbots data was used as a lower bound of the minimum additional revenue from MEV that block proposers stand to make. This is a lower bound because only a fraction of MEV activity is on Flashbots.
In reality, validators will smooth out the variance from block-proposal luck and REV distribution by pooling their resources in validator pools. While Ethereum PoS was designed in a way that validators get sizeable near-constant rewards for valid proofs (as opposed to PoW where they can get rewards only when they propose a block), the introduction of MEV in validator rewards could be a centralizing force by discouraging the operation of a solo validator and making it more financially attractive to join a pool for predictable and earlier liquidity.