Glossary · F
Front-Running
Key takeaway
In DeFi, front-running occurs when a bot detects a profitable pending transaction in the mempool and submits an identical or similar transaction with a higher gas fee to execute first and capture the profit. Classic front-running copies an arbitrage opportunity discovered by another trader. Sandwich attacks are a related form of front-running specific to large DEX swaps. MEV-protected RPCs (Flashbots Protect) help prevent front-running.
Last updated
How Front-Running works in practice
Front-running means seeing a pending transaction and placing your own ahead of it to profit from its effect. On a public blockchain every pending transaction is visible before it is included, which makes this structurally possible rather than exceptional.
Worked example
A searcher spots a large pending buy, submits an identical buy with a higher priority fee so it is ordered first, and sells into the price move the victim's trade creates.
Figures are illustrative and chosen to be checkable, not live market data.
The mistake that costs people money
Any transaction in a public mempool is visible to everyone. Large trades benefit from private relays or intent-based routing; small ones are usually not worth attacking, which is the only protection they have.
Related guides & comparisons
Front-Running: common questions
What is Front-Running?
Which DeFi concepts are most closely linked to Front-Running?
What is the main risk or misconception around Front-Running?
Which guide covers Front-Running in practice?
Related DeFi glossary terms
- Sandwich Attack An MEV attack where a bot detects a large pending DEX swap, places a buy order immediately before it (frontrun — pushing the price up), lets the victim's trade execute at the worse price, then immediately sells (backrun — pocketing the price impact). The victim receives fewer tokens than expected; the bot profits from the spread. Protection: use MEV-resistant RPCs (Flashbots Protect), tight slippage tolerance, or intent-based protocols like CoW Protocol.
- Arbitrage The practice of exploiting price differences for the same asset across different markets. In DeFi, arbitrage bots constantly scan DEXs for price discrepancies and execute trades to profit from the difference, simultaneously normalising prices across platforms.
- Intent-Based Trading A trading model where users sign a desired outcome (an intent) — e.g. “swap X for at least Y” — and solvers compete to fill it optimally. Also searched as intent trading or intent settlement. Protocols such as CoW Protocol use intents to reduce MEV versus sending a raw swap straight to the public mempool.
- Nonce A sequentially incrementing integer assigned to each transaction sent from an Ethereum address. The nonce ensures transactions are processed in the correct order — a transaction with nonce 5 cannot be processed before nonce 4. If you submit a transaction with a higher gas price and the same nonce as a stuck transaction, you can replace the stuck transaction (known as a 'speed up' or 'cancel' in wallet interfaces).
- Price Impact The change in token price caused by your own trade on an AMM. Large trades deplete one side of the pool reserve, driving the price up for buyers and down for sellers. Price impact is deterministic and calculable before executing — DEX interfaces show estimated price impact as a percentage. Price impact is distinct from slippage (which also includes price movement from other traders). Larger trades in shallower pools have higher price impact.
- Timelock A mandatory delay between when a governance proposal passes and when it executes on-chain — typically 24-72 hours. Timelocks give users time to review approved proposals and exit the protocol if they disagree with a decision. They are a critical security mechanism: without a timelock, a compromised or malicious governance vote could drain a protocol's funds before users can react. Most reputable DeFi protocols have timelocks on all admin actions.