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

**URL:** https://talk.markets/t/mev-and-sandwich-attacks-on-evm-a-definitive-guide-to-security/879
**Category:** Crypto & DeFi
**Tags:** cp, evm
**Created:** [1 March 2023 16:54 UTC](https://talk.markets/t/mev-and-sandwich-attacks-on-evm-a-definitive-guide-to-security/879 "2023-03-01T16:54:44Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Lux](https://talk.markets/user_avatar/talk.markets/lux/32/15251_2.png) [@Lux](https://talk.markets/u/Lux)
#### Post date: [1 March 2023 16:54 UTC](https://talk.markets/t/mev-and-sandwich-attacks-on-evm-a-definitive-guide-to-security/879/1 "2023-03-01T16:54:44Z")

</div>

_“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](https://swap.cow.fi/#/1/swap/WETH) - [why?](https://swap.cow.fi/#/faq#how-am-i-protected-from-mev-arbitrage-front-running-sandwiching-with-cowswap)
- Try to use DEX [aggregators](https://talk.markets/t/bridges-in-defi-aggregators-cross-chain-swaps/380)
- ⚠ **Use a private MEV RPC**

# Anti-MEV RPC providers

🧠 Here are some alternative, private RPCs you could (_should_) use.

## Flashbots

Simply use the fast one below or [configure your custom RPC](https://protect.flashbots.net/start?hint=default_logs&fast=true).

```plaintext
https://rpc.flashbots.net/fast

```

> **[Quick Start | Flashbots Docs](https://docs.flashbots.net/flashbots-protect/quick-start)**
>
> Key Considerations

## [LlamaNodes](https://medium.com/llamanodes/llamanodes-launches-mev-boost-mev-protect-rpc-4edb57c8cf00)

```plaintext
https://eth.llamarpc.com

```

```plaintext
https://binance.llamarpc.com

```

> **[LlamaNodes](https://llamanodes.com/)**
>
> LlamaNodes provides public and premium RPCs with industry leading features, crypto payments, and no contracts.

## MEVblocker

From the CowSwap team.

```plaintext
https://rpc.mevblocker.io

```

```plaintext
https://rpc.mevblocker.io/noreverts

```

```plaintext
https://rpc.mevblocker.io/fullprivacy

```

> **[MEV Blocker](https://mevblocker.io/#rpc)**
>
> MEV Blocker is a fast and free RPC endpoint that protects users from frontrunning and sandwich attacks on a wide range of Ethereum transactions.

## Eden Network

| RPC | Frontrunning Protection | Transaction Speed |
| --- | --- | --- |
| Eden RPC | Guaranteed ✅ | Fast 🏎 |
| Eden Rocket RPC | Best Effort 💪 | Faster 🚀 |

```plaintext
https://api.edennetwork.io/v1/rpc 

```

```plaintext
https://api.edennetwork.io/v1/rocket

```

> **[Eden RPC | Eden Docs](https://docs.edennetwork.io/eden-rpc/overview/)**
>
> Eden RPC makes it easy for everyday users and developers to use Eden for frontrunning protection. It's as simple as adding a URL to your MetaMask.

# 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.](https://talk.markets/t/what-to-do-when-rpc-is-slow-not-connecting/385)

# Trading Bots

Most trading bots like [BananaGun](https://t.me/BananaGunSniper_bot?start=ref_RickSanchez), [Maestro](https://t.me/maestro?start=r-rickburpbot) and [Photon](https://photon-sol.tinyastro.io/@RickBurpBot) have built-in MEV protection.

# Why is MEV’ing possible?

This is possible on the [Ethereum](https://talk.markets/t/ethereum-erc-20-cheatsheet/270?silent=true) 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](https://medium.com/flashbots/frontrunning-the-mev-crisis-40629a613752)

> **[Escaping the Dark Forest](https://samczsun.com/escaping-the-dark-forest/)**
>
> On September 15, 2020, a small group of people worked through the night to rescue over 9.6MM USD from a vulnerable smart contract. This is our story.

> **[Ethereum is a Dark Forest](https://www.paradigm.xyz/2020/08/ethereum-is-a-dark-forest)**
>
> It’s no secret that the Ethereum blockchain is a highly adversarial environment. If a smart contract can be exploited for profit, it eventually will be. But this unforgiving environment pales in comparison to the mempool. If the chain itself is a...

[![](https://talk.markets/uploads/default/original/2X/1/127f7baab7ae8015e912026df9513c35a62f9efc.jpeg "How To Get Front-Run on Ethereum mainnet") ](https://www.youtube.com/watch?v=UZ-NNd6yjFM)
