Front Running
In short: Front running is when someone who has information about a future transaction adds their own transaction to the queue ahead of it, aiming to profit from…
Front running is when someone who has information about a future transaction adds their own transaction to the queue ahead of it, aiming to profit from the price move that the pending transaction is likely to cause.
Why it matters
In traditional finance, a broker who trades ahead of a client's order commits a form of market abuse that is prohibited in many jurisdictions. On public blockchains, the "information" is often in plain sight. Pending transactions wait in a public waiting area called the mempool before they are added to a block, and automated bots watch it closely. When a bot sees a profitable pending trade, it sends its own transaction with a higher fee so that it is processed first. This is one of the main sources of miner extractable value (MEV), also called maximal extractable value. Users of decentralized exchanges can limit the damage with a tight slippage tolerance, which cancels a trade if the price moves too far, and some wallets offer private submission that keeps transactions out of the public mempool.
Example
A user submits a large order to buy a token on a decentralized exchange. A bot spots it in the mempool and buys the same token first by paying a higher fee, which pushes the price up. The user's order then fills at a worse price, and the bot sells right after at the higher price the user's purchase created. This pattern is known as a sandwich attack.