Maximal Extractable Value: How to take advantage—and how to protect from it

MEV. Maximal Extractable Value. In the world of Web3, this phrase became well-known among crypto traders, Web3 developers, and security experts, and each has their own opinion on how to use this approach and whether it should be used at all.
Recently, our RPC node provider GetBlock added MEV-protection to its most used nodes, so it’s time to explore this topic deeper. For everybody who wants to try it out—just sign up, select the most suitable subscription plan, and create the appropriate Solana, Ethereum, BSC, or Base endpoint. But now, let’s focus on MEV!
Originally known as miner extractable value, it refers to a value that can be earned due to utilizing changes in network states, be it price fluctuations or changes in transaction order. The problem with MEV is that it’s very double-edged. Some of its activities are at most controversial, while others are openly malicious.
Thus, we have three essential theses:
- MEV may be both harmful and beneficial for crypto users
- MEV activities include numerous strategies, from malicious to benevolent
- MEV-awareness is a huge advantage (and a necessity) for modern Web3 apps
But what exactly is the maximal extractable value in different cases? Which activities can be utilized, and how ethical are they? What are all these mempools, transaction orders, and price fluctuations? How much value can be extracted from each of these activities? And, eventually, how can I, a crypto user, benefit from it—and, in the same moment, be protected from it?
Here you are to answer these questions. Let’s read about it.
What is MEV?
Being supported by nothing more than powerful cryptography and user trust, cryptocurrency is a highly volatile asset. While their market price can be relatively stable, some fluctuations are always present, and they’re much larger than those for fiat currency.
As there are hundreds of different centralized and decentralized exchanges where crypto is traded, the asset’s local prices can differ from the market price. It’s not uncommon to buy an Ethereum token on Uniswap and sell it on 1inch with a price difference enough to get a profit, even including all transaction-related fees.
In addition, all existing transactions are recorded to a specific location called the mempool (memory pool) before being assigned to validators and fulfilled. Some networks, including Solana, don’t use mempools and always assign transactions directly, but it’s still possible to track them and see when they will be fulfilled.
Thus, MEV searchers can look for transactions that potentially influence asset prices and then use these fluctuations to extract their value. Hence is the term, Maximal Extractable Value.
Source: matcha
The extractable value is the profit one can get by buying an asset for a lower price and selling it for a higher price elsewhere, including all gas and commission fees. All MEV activities (or just MEVs) are based on this principle, no matter how different and complex they are.
Of course, each of these activities can be automated using MEV bots of various types. Their main destination is to monitor asset prices on different exchanges, track large transactions, and execute their own transactions at the right moment.
Decentralized exchange activities
Arguably, it’s the largest activity field for MEV searchers. The usual algorithm of the price arbitration on DEXs is as follows, and it’s usually automated using bots.
- Find the asset that has a different price on several decentralized platforms
- Check whether the combined price difference exceeds network and platform fees
- Buy an asset for the lowest price and sell it for the highest price
Another popular strategies are sandwich trading and front-running, which are similar. They include performing quick, automated, and numerous small transactions before and/or after large, profitable transactions to earn from resulting price fluctuations.
- Searchers look for large transactions that can influence the asset price, using memepools, DEX analytics tools, or validator trackers
- They perform automated transactions before and after the transactions. In case of front-running, it’s just performed before the profitable transaction
- As the asset value changes due to the transaction, front-runners and sandwich traders extract value along with traders, usually to their detriment
Source: CoW Swap
Sandwich trades and front-running are considered unethical, as they lead to network congestion and result in trader losses. They are often called sandwich attacks. No wonder that numerous services protect users from them.
DeFi protocol liquidations
This is a more complicated way to extract value, but it may be much more profitable. In addition, it’s beneficial for lending protocols and their users, as it helps liquidate bad loans, which otherwise would lead to losses.
The general algorithm for MEV liquidators is the following.
- Find a loan with a collateralized asset that has experienced a price drop
- Liquidate the loan and return the asset to the lender
- Receive the part of the liquidation fee from the protocol
This is an example of benevolent MEV, unlike our next example.
Miner and validator machinations
The most shady and unethical way to extract value is changing transaction or smart contract execution orders to benefit from resulting asset price fluctuations. A miner or a validator has the privilege of fulfilling transactions, and they can use this privilege for their benefit—and, usually, for others’ detriment.
For example, it’s possible to include asset buy transactions before large sell transactions, and vice versa, extracting value from price fluctuations directly to the validator’s account. They can be especially large in the case of NFTs, which can double or halve their prices in minutes.
Source: CoW Swap
But remember, it’s very unethical. It’s the manipulation of user trust with your privileges, which compromises the blockchain principle of a decentralized, trustless market.
Don’t even try to do it.
How to take advantage?
Maybe you think that MEV activities are too bad, and you’re above those shady practices.
That’s true: they can cause user losses, network congestions, and other, even less pleasurable consequences. Sandwich attacks, front-running, and validator machinations are absolutely unethical, and users must be protected from them.
However, MEVs as a fact are just a byproduct of the decentralized blockchain economy and its free market. They can be used to stabilize market prices and provide additional benefits for users. It would be unreasonable to stop using them completely.
Potential MEV advantages are:
- Protecting user assets on lending protocols
- Aligning asset prices on various services
- Returning potentially lost value back to users
Now, step by step.
Liquidation bots
It’s the obvious way for DeFi lending protocols to deploy their own MEV bots for order liquidation, protecting user assets, and cutting potential losses. When the asset price changes, it’s always time to liquidate unhealthy loans, so users can still get their profits when the price stabilizes.
Guided price arbitration
Uncontrolled MEV activities make markets chaotic and unstable. If guided in the right direction, however, they can align prices among various DEXs and make markets more stable.
Here are two examples of this practice.
- Some services reward MEV searchers who trade between different DEXs and align asset prices
- DEX aggregators use their tracking services to locate the best prices for asset sales or purchases.
As a result, users can operate in much more predictable and secure environments, while those engaged in MEV strategies act benevolently and earn fair rewards.
Some services intentionally utilize sandwich and front-running strategies to extract value, and then return it to the users who would lose this value otherwise. As a result, they win users’ trust while protecting their protocols from actual malefactors. An example is Balancer, which uses the Smart Order Routing (SOR) system to handle price fluctuations.
How to protect?
We still have outright malicious and abusive MEV practices, such as messing with validation and sandwich attacks. Fortunately, some services secure transactions from them. A general solution is to have a dedicated RPC node that directs blockchain requests to secure validators.
Sending transactions to validators directly
When using a custom RPC node or ordering it from a trusted node provider, it’s possible to make it send transactions only to trusted validators. Services that employ this approach include Merkle and Kolibrio, while trusted validators that ensure secure transaction processing receive additional rewards.
Batch transactions
A robust method of eliminating front-runners and sandwich traders is grouping trader transactions and sending them to the blockchain together. As a result, it becomes impossible to front-run or sandwich an individual trader.
Source: CoW Swap
Among DEXs, CoW Swap and Matcha employ this method in their protocols. They also track price fluctuations before and after each batch, and return the surplus directly to users, so they deploy benevolent value extractions as well.
Combining both options
You might notice that taking advantage of MEV and protecting from it are interconnected activities. For example, batching transactions and benevolent value extraction often complement each other. Let’s conclude with a notion on what Web3 devs can actually do with it.
Build MEV-aware services
People are eager to earn money, and it is no wonder that MEV is one of the primary driving forces in the cryptocurrency market. Greed is bad if it’s too intense, as it leads to one profiting at the expense of others, but moderate. After all, trading is always a game with winners and losers.
Services mentioned here use various strategies to protect users from malicious MEVs while maximizing potential benefits. But now, as crypto users try to extract maximal value from everything that is possible, MEV-awareness is more of a necessity than a privilege.
Otherwise, a Web3 app risks becoming obsolete and losing all its security advantages.
…or just choose the right node provider!
If you don’t mind, you can relax and just order the required RPC node from a provider that has already established the best security protocols. Then, customize it as you wish with the dedicated service team, which isn’t very different from setting up your own node, but saves your time, money, and nerves.
And of course, we have one for you—GetBlock. It partners with Merkle and protects all transactions sent via its nodes, so no malicious transactions are possible with its shared and dedicated nodes. Let us know if you have additional questions regarding the MEV topic, and let’s settle them!