Crypto ·English

Someone Can See Your Crypto Trade Before It Happens — And Profit From It

When you click Swap on a decentralized exchange, your transaction sits in a public mempool before block inclusion. Here is how specialized bots, transaction ordering auctions, and MEV-Boost turn your slippage setting into a multi-million dollar market.

Conceptual illustration of transaction ordering and mempool execution on Ethereum.

You open your wallet, choose two tokens, and click Swap.

A few seconds later, the balance updates. Done.

That is what the interface shows you. What it does not show is the short interval in between — after your wallet has announced what you want to do, but before Ethereum has decided where your transaction will sit inside a block.

For some trades, that tiny gap matters. A lot.

Specialized bots can watch pending transactions, estimate how a swap will move a price, and decide whether there is money to be made by placing another transaction just before or just after yours. Nothing has been hacked. Your private key is still private. The smart contract can behave exactly as written.

The opportunity exists because transaction order itself is valuable.

Your Trade Has a Waiting Room

An Ethereum transaction does not normally jump straight from your wallet into a finalized block. Your node broadcasts the signed transaction across the peer-to-peer network, where it can wait with thousands of other pending transactions in what is commonly called the mempool — short for memory pool [1].

Think of it less like handing a sealed order to a cashier and more like announcing your order in a crowded room before the cashier decides which requests to process first.

Anyone listening to that room can inspect the transaction. They can see which address sent it, which contract it calls, what function is being used, how much gas is offered, and enough information to simulate what the transaction is likely to do.

For a decentralized exchange, that can reveal something economically useful: someone is about to buy Token X, and the trade is large enough to move the pool price.

That is where the game starts.

The Small Setting That Gives the Game Some Room

Many decentralized exchanges use automated market makers rather than a traditional order book. In a simple liquidity pool, buying one asset changes the balance between the two assets in the pool. A sufficiently large trade therefore moves the price as it executes.

But your wallet cannot know the exact pool price several seconds into the future. Other trades may land first. So the interface asks you to tolerate some movement through a slippage setting.

If your tolerance is 1%, you are effectively saying: I still want this swap if the final execution price is a little worse than the one I see now, but not more than this limit.

For you, that margin prevents ordinary price movement from making every trade fail. For a searcher watching the mempool, it also defines how much room may exist before your transaction stops being valid.

That does not mean the full 1% is automatically available as profit. Liquidity, fees, trade size, gas costs, competition and the exact AMM curve all matter. But it gives the bot a boundary to calculate against.

How a Sandwich Is Built

Suppose your pending swap is large enough to push Token X upward.

A searcher spots it and runs a simulation. If the numbers work, the searcher tries to arrange three trades in a particular order: its own buy, your buy, then its own sell .

First, the bot buys Token X before you. That moves the pool price slightly higher. Your transaction then executes against this less favorable price, as long as the result still falls inside your slippage limit. Immediately afterward, the bot sells the tokens it bought moments earlier into the price movement that your trade helped create.

Bot buy. Your trade. Bot sell.

Your transaction has become the filling in the sandwich.

The important part is not that the bot somehow changed the rules. It used the rules. Your transaction was valid, the AMM formula worked, and the blockchain executed the transactions deterministically.

The bot simply cared very much about which valid transaction came first.

It also cannot push forever. If the price moves beyond the limit you allowed, your transaction reverts. And many trades are not worth sandwiching at all. Small trades in deep pools may leave too little profit once fees and competition are included.

Sandwiches Are Only the Obvious Part

This wider contest over transaction ordering is usually discussed under the term Maximal Extractable Value, or MEV. The older name was Miner Extractable Value, from Ethereum's proof-of-work era .

MEV is much broader than attacking a user's swap. If the same token is temporarily cheaper on one exchange than another, an arbitrage bot can buy on one side and sell on the other. That tends to pull the two prices back together.

Lending protocols create another opportunity. When a borrower's collateral falls below a required threshold, someone has to trigger the liquidation. Bots compete to do it because the protocol rewards whoever gets there first.

So MEV is not a neat synonym for theft. Some strategies clearly worsen a user's execution. Others perform jobs that DeFi protocols depend on.

The common feature is simpler: there is money in being in the right place in the transaction order.

Then the Bots Started Competing With Each Other

Once people discovered that ordering was valuable, one obvious strategy was to pay more for priority.

Early Ethereum searchers often fought through Priority Gas Auctions. A bot would see an opportunity, another bot would see the same opportunity, and both would repeatedly raise their gas bids trying to land first. The result could be a strange machine-speed bidding war that created congestion and wasted block space .

But there was a deeper problem. If validators or miners could capture much more MEV than their competitors, block production itself could start rewarding scale, private information and specialized infrastructure. At the extreme, valuable past opportunities could even create incentives to reorganize blocks.

MEV was no longer just something a clever bot did to a trade.

It was becoming part of the economics of producing the blockchain.

The Block Before the Block

Modern Ethereum has developed a surprisingly specialized ecosystem around this problem.

Searchers hunt for profitable combinations of transactions. Builders take transactions and bundles from many sources and assemble candidate blocks. Relays help run the auction between builders and validators. The validator chosen to propose the next block can then select an attractive block bid rather than personally searching through every possible ordering.

In other words, the validator that signs the block and the entity that figures out the most profitable way to build it are often no longer the same actor.

This arrangement is commonly described as proposer-builder separation, or PBS [3].

There is an important technical wrinkle: Ethereum does not yet have native, protocol-level PBS built directly into its consensus rules. Much of today's separation happens through MEV-Boost, middleware developed by Flashbots that created an out-of-protocol market between builders and validators [4].

Recent MEV-Boost data show that this is not some obscure corner of Ethereum. A large majority of blocks are produced through this external builder market, and builder activity itself can be highly concentrated [4].

So the invisible competition around your swap eventually helped produce something much bigger: a market for building the block that will contain it.

The Weird Part: Privacy Comes Back

Public blockchains are built around transparency. Pending transactions, however, create an awkward version of transparency: sometimes revealing your intention before execution is exactly what makes you exploitable.

That has pushed part of Ethereum toward private order flow.

Services such as Flashbots Protect can route a transaction away from the public mempool and toward participating builders without first broadcasting it to every searcher watching the public network. A public-mempool sandwich bot cannot attack a transaction it never sees before inclusion.

That sounds like an obvious improvement — until you follow the incentives one step further.

If more valuable transactions move through private channels, access to those channels becomes valuable too. Builders with exclusive order flow can gain an advantage over builders that only see public transactions. A system trying to protect users from the consequences of public visibility can therefore create new concentration around private infrastructure.

The solution changes the problem.

What Actually Happened When You Clicked Swap?

From your wallet, almost nothing happened. You chose two tokens, approved a price range, and waited a few seconds.

Underneath that simple interaction sits a very different machine.

Your pending trade may become information. Information can become an opportunity. Opportunities attract searchers. Searchers compete for ordering. Their competition creates demand for specialized builders. Builders compete for blocks. Validators choose among those blocks. And once public visibility itself becomes dangerous, private routing emerges around the edges.

The strange thing about MEV is not that someone found a loophole in Ethereum.

It is that Ethereum can work exactly as designed and still produce an entire industry around one question the interface never shows you:

Who gets to go first?

References

  1. Ethereum.org. 'Maximal Extractable Value (MEV)'. Ethereum Developer Documentation, 2024.
  2. Daian, P., Goldfeder, S., Kell, T., Li, Z., Zhao, X., Bentov, I., Breidenbach, L., Juels, A. 'Flash Boys 2.0: Frontrunning, Transaction Reordering, and Consensus Instability in Decentralized Exchanges'. IEEE Symposium on Security and Privacy (SP 2020), 2019.
  3. Flashbots Docs. 'Proposer-Builder Separation & MEV-Boost Architecture'. Flashbots Research, 2022.
  4. Flashbots Data. 'MEV-Boost Transparency & Relay Market Statistics'. Flashbots Transparency Dashboard, 2024.
1reads
Helpful0 Comments 0 Tipped0
Written bymirex

· 7 min read

Conversation

Comments 0

No comments yet

Start the conversation.