paint-brush
Why Is MEV Protection Crucial for RPC nodes?by@cryptobro
360 reads
360 reads

Why Is MEV Protection Crucial for RPC nodes?

by Crypto BroAugust 10th, 2024
Read on Terminal Reader
Read this story w/o Javascript

Too Long; Didn't Read

MEV (Maximal Extractable Value) is extracting value from a blockchain network by adding, removing, or reordering transactions included in a block.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail

Coins Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Why Is MEV Protection Crucial for RPC nodes?
Crypto Bro HackerNoon profile picture


MEV (Maximal Extractable Value) is extracting value from a blockchain network by adding, removing, or reordering transactions included in a block. This concept originated in the Ethereum community quite a long time ago (of course, if we count in crypto years). Still, MEV started to reach a new level of volumes with the growth of DeFi infrastructure, which opened more opportunities for servers.


In simple words, MEV's working principle is: "Hey, miner, put my transaction next to that one so I earn 1 ETH, and I'll give you half”.


Obviously, this is a win-win situation, both for the person who found the transaction (the servers) and for those who can change the order of the transaction when creating the block.


An important term when working with MEVs is mempool. In blockchain terminology, a mempool is a waiting pool for transactions that have not yet been added to the block and are still pending. Of course, anyone can see all the transactions that are in this pending state and understand how they can affect certain contract states.

What are People Looking for in Blockchain Today


At the time of writing, the most popular uses of MEV mechanics right now are.

DEX arbitrage and sandwich attacks

Mempool provides a unique opportunity for traders to anticipate prices on exchanges. Most decentralized exchanges work with market-making algorithms, which allow knowing the current state of pools (exchange contracts) and incoming transactions from the mempool to know the price state after each upcoming transaction in the block. This opens up the possibility of both normal arbitrage between different exchanges within one block and sandwich attacks— buying and selling around one transaction or vice versa. For example, a trader sees a big transaction in the mempool to buy a SAND token. Then he sends his 2 transactions to the miner: his purchase of SAND token right before the big transaction and instant sale after this transaction.

Liquidations

Lending protocols such as Maker, Compound, and Aave require users to deposit collateral (e.g., ETH). This deposited collateral is then used to extend credit to other users. Once this collateral has the potential risk of not securing the loan (the risk parameters for this are determined by the DAO community in advance), any network user can liquidate the debt by taking the collateral for themselves. In this case, for example, the debt could be $80k and its collateral $100k, thus the liquidator gets an instant profit.

NFT MEV

Having access to the general information of incoming transactions makes it possible to detect the completion of NFT auctions or their drops, which opens up opportunities to profit from them. For example, if there is a popular NFT drop and a trader wants a particular NFT or set of NFTs, he can set his transaction so that he is first in line to buy the NFT, or he can buy the entire set of NFTs at once.

MEV Infrastructure


The Flashbots community played a big role in the development of MEV infrastructure. They proposed the mev-boost infrastructure, which is essentially an improved geth client (i.e., the Ethereum node client). In this article, I will consider this infrastructure, as currently, most builders in the Ethereum network use it. However, the prevalence of Flashbots Builder has fallen dramatically in block production, although at its peak, it collected almost 80% of all Ethereum blocks.


Let's briefly walk through the "mining" process in Ethereum 2.0 after the merge. There are now 3 agents responsible for creating blocks:


  • Block builder. Block bidder receives transactions from servers and users who, in addition to paying for gas, express their preferred position in the block by bidding with a capped price. The job of the bidder is to build the most profitable block using various strategies.
  • Block relay. Block relay is an agent responsible for verifying blocks before they are passed to validators. The block relay protects the validators from spam by checking the builder blocks for validity and evaluating the value of each block associated with the MEV.
  • Block validator. A block validator in the mev-boost architecture is a Beacon Chain member selected to offer a block for a particular slot. The validator communicates with the relay to obtain the most profitable block header, which it validates by signing it with its public key via escrow.


Thus, network users can directly influence the collection of blocks through the mev-boost infrastructure. Bundles are used to organize transactions, which are an ordered set of transactions that the server sends to the builder via API.

Practical Example: The Consequences of No MEV Protection

Imagine Alice wants to swap a large amount of cryptocurrency on a decentralized exchange (DEX). She submits her transaction to the network, but before it gets included in a block, a malicious actor notices the pending transaction. The actor then submits a series of transactions to manipulate the price of the cryptocurrency, executing a front-running or sandwich attack.


Here’s a step-by-step breakdown of what happens:


  1. Alice’s transaction submission. Alice submits her transaction to swap 100 ETH for SAND on a DEX.
  2. Pending transaction visibility. Before Alice's transaction is included in a block, it appears in the pending transaction pool, visible to everyone, including malicious actors.
  3. Front-runner's transactions. A malicious actor sees Alice's large transaction and submits two transactions: one to buy ETH just before Alice's transaction (pushing the price up) and one to sell ETH right after (taking advantage of the increased price).
  4. Impact on Alice. By the time Alice's transaction is processed, the price of ETH has increased, meaning she receives fewer SAND for her 100 ETH. The malicious actor profits from the price difference.


Without MEV protection, these types of manipulations are more likely to occur, leading to a loss of trust in the blockchain ecosystem and financial harm to users.

MEV-Supported RPC Providers

Several providers offer RPC nodes with built-in MEV protection, ensuring a safer and fairer blockchain experience. Here are a couple of notable ones.

dRPC


dRPC provides RPC endpoints with robust MEV protection, prioritizing the fair ordering of transactions and reducing the risk of manipulation. Their services include:


  • Transaction bundling. Ensuring transactions are grouped and ordered in a way that minimizes the potential for MEV extraction.
  • Privacy features. Concealing pending transactions until they are confirmed, reducing the risk of front-running and sandwich attacks.
  • Real-time monitoring. Actively scanning for and mitigating potential MEV threats in real-time.


dRPC is a leading provider of decentralized blockchain APIs and RPC Nodes, serving clients like Instadapp, SushiSwap, Lido, Curve, and 500+ other web3 organizations.

Flashbots Protect


Flashbots is a research and development organization focused on mitigating the negative externalities of MEV. Flashbots Protect offers RPC endpoints that help prevent front-running and other MEV-related attacks, promoting a healthier blockchain environment. Their features include:


  • Sealed-bid auction mechanism. Transactions are submitted in a way that hides their details until they are confirmed, preventing pre-execution manipulation.
  • MEV-resistant mempool. Transactions are managed in a mempool that is designed to be resistant to MEV exploitation.
  • Collaboration with miners. Working closely with miners to ensure fair transaction ordering and reduce the incentives for MEV extraction.


Flashbots primary focus is to enable a permissionless, transparent, and sustainable ecosystem for MEV.

Conclusion

It is important to choose RPC providers that offer MEV protection. With dRPC and Flashbots Protect, users and developers can significantly reduce the risks associated with MEV and contribute to a more stable and trustworthy decentralized landscape.