basiliskawakens.xyz

What is MEV and how can you see if your trade was front-run?

MEV, or Maximal Extractable Value, refers to the profit that block proposers (validators or miners) or other participants can extract by reordering, including, or excluding transactions within a block. When your trade is front-run, a third party spots your pending transaction and places their own buy order ahead of yours, causing you to buy at a higher price, or sells ahead of your sell, causing you to sell at a lower price. You can check whether your trade was front-run by comparing the transaction’s execution price to the market price at the time, examining the transaction’s position in the block, and tracing related transactions from the same block.

Understanding MEV in practice

MEV arises because transactions are not executed instantly. When you submit a trade to a decentralized exchange, it enters the mempool - a waiting area where pending transactions are visible to anyone running a node. Bots, validators, and searchers monitor the mempool for opportunities. They can:

These actions are not illegal on permissionless blockchains, but they can cost you real money. A front-run trade typically results in you receiving fewer tokens than expected or paying more than the market price.

How to Spot a Front-Run Using a Block Explorer

You will need a block explorer such as Etherscan, BscScan, or a chain-specific equivalent. Follow these steps:

Step 1: find your transaction

Open your wallet’s history or the block explorer and locate the transaction hash of the trade you suspect was front-run. Click into the data/simulate-transaction-before-signing/">transaction details page.

Step 2: Check the Block Number and Transaction Index

Look for the Block number (e.g., Block 12345678) and the Transaction Index (often labeled "Position in Block" or "Txn Index"). This tells you the order your transaction was included relative to others. A low index number (e.g., 2 or 3) means it was early in the block. If your trade is a swap on a DEX like Uniswap, and you see a similar swap from an unknown wallet with a lower index in the same block, that wallet likely front-ran you.

Step 3: Compare the Execution Price to the Market Price

On the transaction page, look for the Token Transfers section (or use the "Logs" tab). Note the amount of token A you sent and token B you received. Calculate the effective price (e.g., 100 USDC for 1 ETH means you paid 100 USDC per ETH). Then, using a DEX aggregator or the pool’s page on the explorer, check the prevailing price in that pool just before your transaction. If your effective price is significantly worse - for example, 5% or more above the pre-trade price - a front-run or sandwich attack is likely.

Step 4: Trace Related Transactions in the Same Block

Return to the block explorer’s page for that specific block. Look at the list of transactions sorted by index. Identify any transactions that interact with the same DEX pool or token contract as yours, especially those that:

If you find such a pair, click into each. Check the "From" address. If the addresses are unfamiliar and the transactions are timed within seconds of yours, you have strong evidence of a sandwich attack.

Step 5: Use an MEV Detection Tool (Optional)

Several free tools can automate this process. For example, EigenPhi or MEV Watch allow you to paste a transaction hash and see whether it was part of an MEV extraction. These tools highlight the front-run and back-run transactions directly. On Etherscan, you may also see a "MEV" label on some transactions, though not all front-runs are flagged.

What to do if you were front-run

Front-running is not reversible, but you can reduce your risk in future trades:

A note on detection limits

Not all front-runs are obvious. A bot might front-run your trade by only a few basis points, and the price impact may be hidden within normal market volatility. The steps above detect the most common sandwich attacks but will not catch every instance. If you trade large amounts or use high slippage, you are a more likely target. Checking your trade’s position in the block and comparing execution prices remains the most reliable manual method.

Not financial advice. basiliskawakens.xyz publishes market data and general information about digital assets. Crypto assets are volatile and you can lose everything you put in. Nothing here is a recommendation to buy, sell or hold, and we make no price predictions.

Prices are sourced from third parties and may be delayed or wrong. Verify anything you intend to act on against a primary source.

Back to on-chain data