Decentralized finance, or DeFi, has opened up new ways to make money with crypto. But there are also advanced strategies that can affect trading. One of these is called Miner Extractable Value, or MEV. This guide explains how MEV works, focusing on sandwich attacks and front-running.

What is MEV?
MEV is the profit that block producers, like miners or validators, can make by choosing which transactions to include in a block and in what order. Because blockchain transactions are public before they are confirmed, people can see them and try to profit from them.
Front-Running Explained
Front-running is a common MEV strategy. Imagine you see a large buy order for a token about to be processed on a decentralized exchange (DEX). A front-runner would quickly place their own buy order for the same token just before the large order goes through. This pushes the price up slightly.
Then, the large buy order is executed at the slightly higher price. Finally, the front-runner sells the token they just bought at a small profit. They used the information about the pending large trade to their advantage.
Sandwich Attacks
A sandwich attack is a more advanced form of front-running. It involves two transactions placed around a victim’s transaction.
- First Bite: The attacker buys a token just before the victim’s large buy order.
- The Victim’s Trade: The victim’s large buy order is processed. This pushes the price of the token up significantly.
- Second Bite: The attacker immediately sells the token they bought earlier, profiting from the price increase caused by the victim’s trade.
The victim’s transaction is essentially ‘sandwiched’ between the attacker’s two transactions. This results in the victim paying a worse price than they expected.
How Blockchains Handle MEV
Blockchains like Ethereum are working on ways to manage MEV. Some networks are trying to make MEV more transparent or redistribute the profits more fairly. For example, some newer blockchain designs focus on intent-centric architecture, which could potentially change how transactions are ordered and processed.
For regular users, understanding MEV is important. It helps explain why sometimes the price you see on a DEX might be different from the final price you get. While you can’t easily perform these attacks yourself without specialized tools and knowledge, knowing they exist helps you understand the DeFi trading environment better. For those looking to boost their crypto earnings in other ways, learning about DeFi yields is a good starting point.