Private Mempools: Stop MEV Sandwich Attacks Without Losing Control
Using a private RPC shields your trades from predatory front-running bots, but it quietly shifts network power to a small group of dominant block builders.
Key takeaways
- →Public mempools leak your trade details to automated bots that execute front-running and sandwich attacks.
- →Private RPC endpoints route your transactions directly to block builders, bypassing public visibility.
- →Relying on private mempools concentrates transaction execution into the hands of two or three dominant builders.
- →If major block builders enforce regulatory filters, private transaction routing creates invisible censorship risks.
When you push a transaction to Ethereum, it doesn't land in a block instantly. It sits in a waiting room called the mempool. Anyone can look inside this room, including automated searcher bots hunting for easy profits. Spot your market order swapping tokens on a DEX? A bot will pay higher gas to jump in front of you, pump the price, let your order fill at a worse rate, and dump immediately for free cash. That's a sandwich attack. It costs traders hundreds of millions of dollars every year.
Private mempools were built to stop this. Send your trade through a private Remote Procedure Call (RPC) endpoint, and you skip the public waiting room entirely. Your order goes straight to block builders, completely hidden from bots. But protection isn't free. By hiding transactions from the public, users hand control over to a small group of block builders who decide what gets on-chain and what gets blocked.
The Public Mempool is a Dark Forest
To see why private mempools exist, you have to understand transaction ordering under Ethereum's Proposer-Builder Separation (PBS) architecture. PBS splits block creation into three distinct roles:
- Searchers: Sophisticated bots scanning the mempool 24/7 for profit opportunities, known as Maximal Extractable Value (MEV).
- Builders: Specialized entities collecting trades from searchers and regular users, organizing them into optimized blocks for maximum profit.
- Validators (Proposers): Network nodes randomly chosen to sign and propose the winning block crafted by a builder.
Usually, your Web3 wallet hooks up to a public RPC provider like Infura or Alchemy. Confirm a trade on Uniswap, and the RPC broadcasts your raw transaction to the peer-to-peer network. It sits out in the open for a few seconds before a builder grabs it.
Searcher bots love this window. They read your transaction parameters—specifically your set slippage tolerance. Slippage is the worst price change you'll accept. Set 2% slippage on a $50,000 swap? You're telling the network you'll take a deal 2% worse than current rates. To a bot, that's an open invite.
How Private RPCs Shield Your Trades
A private mempool swaps the public broadcast for a direct line to builders. Instead of shouting your trade to the entire peer-to-peer network, your transaction moves over an encrypted HTTPS connection straight to a private endpoint like Flashbots Protect or MEV-Blocker.
The private RPC holds your order in a non-public queue and hands it directly to participating builders in private bundles. Public bots never see it. No visibility, no front-running buy trade, no sandwich attack.
It changes failed trades too. On a public mempool, if prices swing before execution, your trade reverts on-chain and you still pay gas to the validator. Private RPCs test transactions off-chain first. If your swap would fail, the builder drops it. No execution, no wasted gas.
The Centralization Crisis: Who Controls the Builders?

While private RPCs keep bots off your back, they create a massive structural problem for open blockchains. They pull transaction flow away from a decentralized peer-to-peer network and dump it into a centralized pipeline run by a few corporate entities.
Building blocks takes heavy computing power and massive liquidity connections. Because barriers are high, just two or three builder entities regularly construct over 80% of all Ethereum blocks. Use a private RPC, and you're relying entirely on those specific builders to bundle and broadcast your trade.
| Metric / Feature | Public Mempool | Private RPC (Private Mempool) |
|---|---|---|
| Visibility | Public to all nodes and searcher bots | Hidden; visible only to the RPC provider and selected builders |
| Sandwich Attack Risk | High (vulnerable to MEV bots) | Zero (bots cannot observe pending trade parameters) |
| Failed Tx Gas Costs | Yes (reverted transactions consume gas on-chain) | No (failing trades are dropped off-chain without fee cost) |
| Routing Infrastructure | Decentralized peer-to-peer network | Centralized RPC servers and dominant block builders |
| Censorship Risk | Low (any node can propagate transactions) | Moderate to High (builders can filter by compliance lists) |
This setup opens the door to silent censorship. In August 2022, the US Department of the Treasury's Office of Foreign Assets Control (OFAC) sanctioned specific smart contract addresses linked to Tornado Cash. Because dominant block builders operate registered companies in jurisdictions like the United States, several big builders started filtering out any bundle containing trades tied to sanctioned addresses.
If your trade is in the public mempool, a non-censoring builder will pick it up eventually, even if it takes a few extra seconds. But if you route exclusively through a private RPC tied to regulated builders, they can drop your order without saying a word. You dodge MEV bots, but you gain institutional censorship.
Worked Example: Public Mempool vs. Private RPC
Let me show you the real dollar impact using a simple trade. Bob wants to buy a new token on a DEX using ETH.
Trade Parameters:
- Asset Pair: ETH / TOKEN
- Trade Size: 100 ETH
- Current Pool Rate: 1 ETH = 1,000 TOKEN
- Expected Output: 100,000 TOKEN
- Slippage Setting: 3%
Scenario A: Public Mempool (Sandwich Attack)
- Bob sends his trade through a standard public RPC. It lands in the public mempool.
- A searcher bot catches the order and notes his 3% max slippage limit.
- Front-Run (Tx 1): The bot jumps ahead with a 50 ETH buy order and a higher priority fee. The builder puts it right before Bob's trade. TOKEN jumps 2.8%.
- Victim Trade (Tx 2): Bob's 100 ETH trade executes at the higher price. Since it's under his 3% limit, it completes. He gets 97,276 TOKEN instead of 100,000 TOKEN.
- Back-Run (Tx 3): The bot dumps its tokens back into the liquidity pool right after Bob's trade, making roughly 1.3 ETH in net profit after gas.
- Outcome: Bob loses over $3,000 worth of tokens compared to the spot price when he hit send.
Scenario B: Private RPC (Protected Execution)
- Bob routes the exact same trade through a private RPC.
- The transaction moves directly to partner builders through a private side-channel. It never touches the public mempool.
- Searcher bots see zero activity in the queue, so they can't sandwich him.
- The builder puts Bob's 100 ETH trade into the block at prevailing market rates.
- Outcome: Bob gets his 100,000 TOKEN (minus standard pool impact). He loses zero to bots and pays no extra priority tips.
How to Switch to a Private RPC Endpoint
Setting up a private RPC in your wallet takes under two minutes. Here's how to do it on Ethereum Mainnet using Rabby or MetaMask.
- Select a reputable private RPC provider: Pick one with clear privacy policies, like MEV-Blocker (
https://rpc.mevblocker.io) or Flashbots Protect (https://rpc.flashbots.net). - Open your Web3 wallet settings: Head to settings and find the Networks or Custom RPC tab.
- Add a new network configuration: Click Add Network or Add Custom RPC. Fill out these exact details:
- Network Name: Ethereum (MEV-Protected)
- New RPC URL: Paste your provider's URL (like
https://rpc.mevblocker.io) - Chain ID: 1
- Currency Symbol: ETH
- Block Explorer URL:
https://etherscan.io
- Save and activate the network: Save it and set it as your active connection.
- Execute a test transaction: Make a small swap. Paste your transaction hash into Etherscan. Notice how it doesn't show up in public mempool trackers before block inclusion—it only appears on-chain once finalized.
Common Mistakes When Using Private Mempools
Private RPCs are great tools, but using them blindly leads to simple mistakes.
1. Leaving High Slippage Limits Intact
Traders often think private RPCs make them bulletproof against price slippage, leaving 5% or 10% settings on. While a private RPC keeps your trade out of the public mempool, it can't save you if your transaction routes through on-chain DEX aggregators that leak slippage to arbitrage bots across multi-hop paths. Keep slippage tight (0.1% to 0.5% for liquid pools).
2. Expecting Instant Execution During Network Congestion
Any validator or builder on Earth can pick up a public mempool trade. Private RPC trades can only be built by builders subscribing to that specific private feed. If network gas fees spike or those specific builders miss consecutive winning blocks, your trade can hang longer than a public one. Need to execute immediately? You might have to jump back to a public RPC and pay higher gas.
3. Ignoring IP Address and Wallet Privacy Risks
Every time you send a trade to an RPC server, it sees your public wallet address and your IP address. Use a shady private RPC, and they can tie your real-world identity to your wallet. Stick to vetted infrastructure providers, and use a VPN for sensitive trades.
4. Assuming Private Means Anonymous
Private mempools hide your trade *before* it gets placed in a block. Once a builder puts it on-chain, your details are 100% public, permanent, and traceable. Private RPCs give you execution privacy, not anonymity.
Frequently Asked Questions
Does using a private RPC cost extra gas fees?
No. Private RPCs don't mark up standard base gas fees. Many actually save you money by refunding a slice of back-running MEV value back to your wallet. Plus, you never pay gas for failed transactions.
Can a private RPC provider steal my tokens or private keys?
No. An RPC endpoint is just a relay. It handles transactions already signed cryptographically by your private key inside your wallet software. An RPC can't alter your trade parameters, change recipient addresses, or touch your funds. The worst a bad RPC can do is drop your transaction, delay it, or log your IP address.
What happens if the block builders connected to my private RPC go offline?
If partner builders go offline or lose market share, your transaction will sit unconfirmed in the RPC queue. If it gets stuck, cancel it in your wallet or temporarily switch back to a public RPC (like Infura or Alchemy) to broadcast across the peer-to-peer network.
The Road Ahead for Transaction Privacy
The battle between MEV protection and decentralization remains one of Web3's toughest technical hurdles. Relying on centralized RPCs is a band-aid, not a long-term cure for front-running. As long as traders have to choose between better execution and network neutrality, Ethereum's block-building pipeline will remain prone to centralization.
Engineers are working on protocol-level fixes. Encrypted mempools using zero-knowledge cryptography and Secure Enclaves (SGX) aim to let users broadcast encrypted trades to the entire network. Builders will order transactions without knowing what's inside, revealing details only after the order is locked in. Until those tools mature, every trader has to decide where they stand on dodging sandwich bots versus keeping execution permissionless.