---
title: "Front-Running — definition | Nuri Glossary"
description: "Using knowledge of a pending trade to trade ahead of it and profit from its price impact."
lang: "en"
type: "glossary-term"
canonical: "https://nuri.com/glossary/front-running"
---

# Front-Running

Using knowledge of a pending trade to trade ahead of it and profit from its price impact.

## Basically

Front-running means seeing a trade before it is confirmed and placing your own trade first to profit from it. It is common in decentralised finance and on decentralised exchanges.

## Key Takeaways

- Front-running exploits transaction ordering. An attacker watches pending transactions in a public mempool and inserts their own transaction ahead to profit from the predictable price impact. The practice is closely tied to oracle manipulation and liquidation cascades.
- Ethereum's MEV ecosystem has industrialised front-running. Specialised bots, searchers and block builders compete to extract value from transaction ordering, costing DeFi users billions in cumulative losses.
- Bitcoin and Lightning are largely resistant. Bitcoin's UTXO model lacks the stateful smart contracts that enable most front-running, and the Lightning Network's private routing removes the public mempool entirely.

## What Is Front-Running?

Front-running uses advance knowledge of a pending transaction to place your own transaction ahead of it and profit from the predictable market impact. The term comes from traditional finance, where a broker might trade ahead of a large client order, but crypto has turned it into a far more systematic and automated practice.
Public mempools make every pending transaction visible before confirmation. The transparency needed for decentralisation creates an information asymmetry: anyone watching the mempool can see which trades are about to execute and position themselves to profit. On networks like Ethereum, where smart contract interactions produce deterministic price changes, front-running has grown into an entire extractive economy called Maximal Extractable Value (MEV).
The core mechanic is simple. An attacker observes a profitable pending transaction, submits their own transaction with a higher gas fee to have it confirmed first, and captures the value the original transaction would have produced. The victim's trade still executes, but at a worse price.

## How It Works

Front-running relies on two properties of most blockchain networks. These are a public mempool where unconfirmed transactions are visible and a fee-based priority system where higher-paying transactions get confirmed first. The attack follows a general pattern based on these properties.
Bitcoin's Replace-by-Fee (RBF) mechanism lets transactions be replaced with higher-fee versions, which could theoretically aid front-running. Bitcoin's limited scripting capabilities mean there are far fewer exploitable patterns than on Ethereum, however.

## Pure Front-Running

Pure front-running is the simplest form: a bot sees a large pending swap on a decentralised exchange and submits the same trade first. If you buy a large amount of Token X on a DEX, the front-runner buys Token X first and drives the price up. Your trade then executes at the higher price, and the front-runner sells Token X at the inflated price for a profit.

## Sandwich Attacks

A sandwich attack is a more sophisticated variant that places your transaction between two attacker transactions, one before and one after. The front-running transaction moves the price in one direction, your trade pushes it further, and the back-running transaction captures the profit by trading in the opposite direction.
Sandwich attacks work particularly well against automated market makers (AMMs) because the bonding curve makes each trade's price impact mathematically predictable. The attacker can calculate the exact profit before executing.

## Liquidation Front-Running

Lending protocols make positions eligible for liquidation when they fall below their collateral threshold. Liquidators earn a bonus, typically 5-10% of the collateral, for closing these positions. Front-runners watch the mempool for liquidation transactions and submit their own liquidation calls with higher fees, stealing the liquidation reward from the original liquidator.
Competing liquidations create a cascading effect. When markets drop sharply, a rush of liquidation transactions drives up gas fees, which can trigger further liquidation cascades as maintaining positions becomes more expensive. During Ethereum's "Black Thursday" in March 2020, liquidation front-running contributed to cascading failures across DeFi lending protocols.

## Ethereum and the MEV Ecosystem

Ethereum's account-based model and Turing-complete smart contracts make it the primary battleground for front-running. Its MEV ecosystem has evolved into a sophisticated supply chain.
Projects like Flashbots emerged to democratise MEV extraction and reduce its negative externalities. Flashbots introduced a sealed-bid auction where searchers submit bundles directly to miners (now validators) through a private channel instead of competing in gas price wars that congest the network. The auction reduced on-chain spam but did not eliminate the underlying extraction from users.

## Bitcoin's Limited Exposure

Bitcoin's exposure to front-running is far more limited. Its UTXO model and Bitcoin Script's restricted capabilities mean no AMMs, lending protocols or complex DeFi applications run natively on the base layer. Without stateful smart contracts, far fewer transactions have outcomes that can be profitably predicted and front-run.
Bitcoin is not entirely immune, however. Its fee market dynamics create some front-running vectors.

## Lightning Network's Protection

The Lightning Network is inherently resistant to front-running for several structural reasons. Payments travel through encrypted onion-routed channels, so no single node other than the sender knows the full payment path. There is no public mempool: payments are negotiated directly between channel partners and propagate through the network in encrypted hops.
Lightning's architecture removes the two prerequisites for front-running: transaction visibility and fee-based ordering. A routing node can see that it is forwarding a payment, but it cannot determine the payment's origin, destination or purpose, so even if it wanted to front-run, it would not know what transaction to construct. Research on onion routing and Lightning privacy examines these properties in more depth.
Blinded paths also obscure the receiver's identity further. PTLCs, once widely adopted, will prevent correlation of payments across hops and make any form of payment-level analysis even more difficult. The move towards PTLCs is the next step in Lightning's privacy guarantees.

## Mitigations and Defenses

Various approaches attempt to reduce front-running across different blockchain ecosystems. The defences vary by ecosystem and operate at different levels.

## Layer 2 Advantages

Layer 2 solutions reduce the front-running surface area by design. On Lightning, the lack of a public mempool and encrypted routing make front-running structurally impossible for payment transactions, while Spark's architecture processes transactions off-chain without exposing them to a public ordering queue. The Bitcoin Layer 2 comparison shows how different Layer 2 approaches handle transaction privacy.

## Systemic Impact on DeFi

Front-running imposes a hidden tax on DeFi users. Every sandwich attack or liquidation front-run transfers value from regular users to sophisticated extractors. Estimates suggest cumulative MEV extraction on Ethereum has exceeded several billion dollars, with the cost spread across millions of individual transactions as slightly worse execution prices.

## Centralisation Pressures

The MEV supply chain concentrates power among a small number of sophisticated builders and searchers. Block building has become increasingly centralised, with a handful of builders producing most Ethereum blocks. Such concentration creates censorship risks and weakens the decentralisation that public blockchains aim to provide.

## Arms Race Dynamics

Front-running defences often trigger new attack vectors. Flashbots reduced gas price wars but created a new centralised infrastructure layer, while encrypted mempools may prevent mempool observation but could add latency or complexity. Each mitigation reshapes the system rather than eliminating the underlying incentive to extract value from transaction ordering.

## Cross-Domain MEV

Cross-domain MEV is emerging as more value moves across chains and layers, extracting value from transaction ordering across multiple networks at once. For example, an attacker might observe a large trade on one chain and front-run the corresponding price update on another. The expanding attack surface shows why protocol designs that reduce public transaction visibility, like Lightning's onion routing, are increasingly important.
The glossary entry is for information only and does not constitute financial or investment advice. Always do your own research before using any protocol or technology.
Part of the [Nuri glossary](https://nuri.com/glossary), which defines 1876 Bitcoin, Lightning, wallet, stablecoin and payment terms.
