A sandwich attack is an MEV bot attack that places a buy right before your swap and a sell right after it, so you buy at a worse price and the bot pockets the difference. It happens on networks with a public mempool or a watchable transaction flow (Ethereum, BNB Chain, Solana); you avoid it with tight slippage and by sending transactions privately through Flashbots Protect, MEV Guard or Jito bundles.
← All articles · Baca dalam Bahasa Indonesia
What Is a Sandwich Attack? How to Avoid It on Ethereum, BNB & Solana
November 11, 2026

A sandwich attack is an MEV bot sandwiching your swap. How it works, which networks are most exposed, and how to avoid it: slippage, Flashbots Protect, MEV Guard and Jito.

A sandwich attack is an MEV bot attack that "sandwiches" your swap: the bot buys right before your swap so the price rises, then sells right after and pockets the difference. You still receive tokens, but at the worst price your slippage allows. This guide explains how a sandwich attack works, which networks are most exposed, and how to avoid it — including private RPCs for Ethereum and BNB Chain and Jito for Solana, both available on BaniPool.

How a sandwich attack works
- You send a swap of 10 ETH → token X with 3% slippage.
- The transaction waits in the public mempool — a bot sees it.
- The bot buys token X with higher gas (front-run) so it executes first; X's price rises.
- Your swap executes at a worse price — still within 3% slippage.
- The bot sells token X right after you (back-run) and takes the profit.
The looser your slippage and the thinner the pool, the more a bot can extract.
Which networks are exposed?
| Network | Public mempool? | Sandwich risk | Protection on BaniPool |
|---|---|---|---|
| Ethereum | Yes | High | Private RPC: Flashbots Protect, MEV Blocker |
| BNB Smart Chain | Yes | Very high | Private RPC: PancakeSwap MEV Guard, BlockRazor |
| Solana | No, but visible to leaders | High for small tokens | Jito (bundle / bundleOnly) |
| Polygon, Avalanche | Yes | Medium | Tight slippage (no public private RPC yet) |
| Base, Arbitrum, OP, Robinhood Chain | No (sequencer) | Low | Not needed |
| Arc | Limited validator set | Low | Tight slippage |
How to avoid sandwich attacks
1. Use tight slippage
0.5–1% for liquid pairs. Slippage above 5% on BaniPool requires Expert Mode.
2. Install a private RPC (Ethereum & BNB Chain)
On EVM, your wallet broadcasts the transaction. A private RPC forwards it straight to block builders without the public mempool:
- Ethereum: Flashbots Protect
https://rpc.flashbots.net/fast, MEV Blockerhttps://rpc.mevblocker.io - BNB Chain: PancakeSwap MEV Guard
https://bscrpc.pancakeswap.finance, BlockRazorhttps://bsc.blockrazor.xyz
On BaniPool: open ⚙ in a transaction dialog → Private mempool (RPC) → Add to wallet. If your wallet refuses (MetaMask for Ethereum Mainnet), copy the URL and add it manually: Settings → Networks → choose the network → add RPC → make it the default. All are free.
3. Use Jito on Solana
Turn on Private mempool (Jito) in ⚙ — details in Solana private mempool.
4. Use liquid pools and split large trades
Small price impact = little room for bot profit.
5. Let the keeper work privately
BaniPool's automated actions (rebalance, compound) on Ethereum and BNB Chain are automatically sent through private RPCs, in parallel to all endpoints, with a public RPC fallback if all fail.
Limits of private RPCs
- They hide transactions before they land; afterwards they are public.
- The receiving builder still sees the transaction — you trust the RPC provider.
- Inclusion can take a few more blocks.
- Do not switch RPCs in your wallet before a transaction confirms; the wallet may resend it through a public RPC.
FAQ
How do I know if I was sandwiched?
Open your transaction on a block explorer: if swaps from the same address on the same pool sit right before and after yours, you were very likely sandwiched.
Is low slippage alone enough?
It limits the loss, but swaps can fail when the market moves. Sensible slippage + a private RPC is most effective.
Do private RPCs cost money?
No. Flashbots Protect, MEV Blocker, PancakeSwap MEV Guard and BlockRazor are free; you only pay normal gas.

