Risk & Security
MEV
Maximal Extractable Value is the profit block producers can earn by strategically ordering transactions within a block.
Front-running is the act of placing a transaction ahead of a known pending trade to profit from its expected price impact.
Front-running in crypto is the practice of observing a pending transaction in the mempool and placing a competing transaction ahead of it to profit from the anticipated price movement. On public blockchains, every unconfirmed transaction is visible to anyone monitoring the network, creating a transparent environment that sophisticated actors can exploit. In traditional finance, front-running is illegal insider trading. In decentralized markets, it emerges as a structural consequence of how blockchains process transactions.
Front-running is one of the most common forms of MEV (maximal extractable value) extraction and affects anyone interacting with decentralized exchanges, lending protocols, and other on-chain applications.
When a user submits a transaction to a blockchain, it first enters the mempool — a holding area for unconfirmed transactions waiting to be included in the next block. Automated bots continuously scan the mempool for profitable opportunities. When they detect a large swap, a liquidation trigger, or another transaction that will move a market price, they spring into action.
The front-runner submits an identical or similar transaction with a higher gas fee to incentivize validators to include their transaction first. Because validators typically order transactions by fee priority (or can arrange them for maximum profit), the front-runner's transaction gets processed before the original user's transaction.
For example, if a user submits a large buy order for a token on a decentralized exchange, a front-running bot might:
This sequence happens in milliseconds, and the user ends up paying a worse price than they would have without the front-runner's interference.
Front-running takes several forms in DeFi:
Front-running impacts virtually all DeFi participants. Traders on decentralized exchanges receive worse execution prices. Borrowers attempting liquidations find the opportunity snatched away. Even governance votes and NFT mints can be front-run. Research estimates that MEV extraction, including front-running, costs Ethereum users hundreds of millions of dollars annually.
The effect is particularly damaging for larger transactions, where the price impact is more predictable and the profit opportunity for bots is greater.
The DeFi ecosystem has developed several approaches to combat front-running:
Front-running remains one of the most debated issues in blockchain design. It represents a fundamental tension between the transparency that makes blockchains trustworthy and the privacy that users need for fair execution. As the ecosystem matures, solutions like encrypted mempools and MEV-aware block building may significantly reduce the problem, but it is unlikely to be fully eliminated as long as public blockchains maintain open transaction ordering.
Related Terms
Risk & Security
Maximal Extractable Value is the profit block producers can earn by strategically ordering transactions within a block.
Risk & Security
A sandwich attack exploits a pending DEX trade by placing buy and sell orders around it to extract profit from the price movement.
DeFi Fundamentals
The difference between the expected price of a crypto trade and the actual execution price, caused by liquidity constraints or market movement.
Blockchain & Networks
A gas fee is the transaction cost paid to validators for processing and confirming operations on a blockchain network.