How to Set Up MEV Guard on PancakeSwap to Prevent MEV Attacks
2 min read · · Korean original
MEV attacks have become increasingly common in the Web3 market. An MEV (Maximal Extractable Value) attack detects a transaction on a blockchain network before it is confirmed, then quickly places orders right before and after it to cause damage. The most common types of MEV are front-running and sandwich attacks.

What Is an MEV Attack?
If you're a Web3 user who uses DeFi or DEXs, understanding MEV attacks is a must. MEV can be described as 'an attack that intercepts a user's block, inflicts damage, and steals the profit.'
For example, a front-running MEV attack is a strategy that 1) sets a higher transaction gas fee than the user, 2) buys the coin at a low price, and 3) sells it again once the user buys that coin afterward.
Meanwhile, a sandwich attack manipulates the price by quickly placing buy and sell orders right before and after the user's transaction. As a result, if your slippage is set high, the swap can go through at an absurd price and you can suffer a big loss.
How to Set Up MEV Protection
To prevent these attacks, PancakeSwap offers a feature called MEV Guard. MEV Guard protects users' transactions from front-running and sandwich attacks.
To use MEV Guard, you need to set up a special RPC endpoint, which makes it harder for attackers to detect your transactions. Here's how to set it up.
First, connect your wallet to the official PancakeSwap website. You can activate MEV Guard there, but one-click activation may not work with MetaMask or OKX Web3 Wallet. In that case, just enter the values below manually in your wallet settings.
| Network Name | PancakeSwap MEV Guard |
|---|---|
| RPC URL | https://bscrpc.pancakeswap.finance |
| Chain ID | 56 |
| Currency Symbol | BNB |
| Block Explorer URL | https://bscscan.com |
Final Thoughts
There are a few things to keep in mind to avoid losses from MEV attacks. First, always set up MEV Guard on the official PancakeSwap website. Some phishing sites and fake links try to trick you into changing your RPC settings, so it's important to always check the URL.
Also, be careful if a site asks for excessive permissions when you connect your wallet. Granting the wrong permissions can let a malicious smart contract steal your funds. So when connecting your wallet, review approval requests carefully and never grant more permissions than necessary.