MEV and Sandwich Attacks on EVM: A Definitive Guide to Security

,

“Frontrunning on EVM is the practice of watching blockchain transactions in order to gain an advantage. It occurs when someone watches a transaction being broadcast to the network, and then quickly submits their own transaction before the original is mined, thus allowing them to benefit from the original transaction.” - In other words, MEV bots use your maximum slippage to their benefit, and slurp your money.

How to protect yourself from this?

Use an anti-MEV RPC so your transactions are not visible in the mempool, thus preventing your TX from getting sandwiched. Some generic best practices:

  • Minimizing the slippage can help prevent MEV from profiting off your transactions.
  • If you swap large amounts, you can use CowSwap - why?
  • Try to use DEX aggregators
  • :warning: Use a private MEV RPC

Anti-MEV RPC providers

:brain: Here are some alternative, private RPCs you could (should) use.

Flashbots

Simply use the fast one below or configure your custom RPC.

https://rpc.flashbots.net/fast

LlamaNodes

https://eth.llamarpc.com

MEVblocker

From the CowSwap team.

https://rpc.mevblocker.io
https://rpc.mevblocker.io/noreverts
https://rpc.mevblocker.io/fullprivacy

Eden Network

RPC Frontrunning Protection Transaction Speed
Eden RPC Guaranteed :white_check_mark: Fast :racing_car:
Eden Rocket RPC Best Effort :muscle: Faster :rocket:
https://api.edennetwork.io/v1/rpc 
https://api.edennetwork.io/v1/rocket

Which do I choose?

It really does not matter a lot… read the documentation of the RPC’s as in some cases you need to pick between speed or privacy. Tools to check your ping to several RPC servers.

Trading Bots

Most trading bots like BananaGun, Maestro and Photon have built-in MEV protection.

Why is MEV’ing possible?

This is possible on the Ethereum blockchain because the network is open and all transactions are publicly visible. This practice can be used to manipulate the market by taking advantage of the opportunity to gain profits or prevent losses before other market participants."

I want to know more!

Medium article: Flashbots: Frontrunning the MEV crisis | Flashbots