Math Show Series #030 — How to protect yourself from MEV front-running & sandwiching bots

MathWallet Official
7 min readOct 24, 2023

Host:

Today, we are happy to introduce Blocknative to all of you.

We invite Blocknative Head of Business Development Chen Shen to talk about How to protect yourself from MEV front-running & sandwiching bots. Shen, tell us a bit about Blocknative.

Shen | Blocknative:

Sure! Blocknative was founded in U.S more than 5 years ago, backed by top VCs such as Blockchain Capital, Coinbase Ventures and Fenbushi. We’re known for providing some of the best real-time transaction observation and MEV infrastructures, including mempool explorer, gas estimator, wallet library, MEV relay and more importantly private transaction aggregator, which we’re going to focus on today.

Host:

Good to know it. MEV is a popular concept in the current Web3 world, could you tell us what is MEV ?

Shen | Blocknative:

MEV stands for Maximum Extractable Value (formerly known as Miner Extractable Value before the ETH Merge) and is the value derived from transaction inclusion and ordering. MEV occurs in web3 due to the necessity for transactions to be ordered and included in a block before being committed on-chain. Specialized actors, called MEV searchers, monitor the flow of transactions and identify arbitrage opportunities that they can profit off of by including transactions before (frontrunning), after (backrunning), or both (sandwiching).

Let’s dive into an example. Let’s say someone swaps 100 ETH for USDT on Uniswap. This trade can create price movement on other liquidity pools and exchanges that this person isn’t aware of. If a sophisticated trader (MEV searcher) sees this transaction when it’s still pending, they can try to seize the arbitrage opportunities created by inserting their transactions before and after the target transaction (sandwiching). If that searcher is successful this results in negative slippage for the end user.

There are good and bad types of MEV. The way to tell is simple: you see a good MEV when your transaction gets its expected settlement (backrunning). When you see worse than expected slippage, that’s most likely the result of bad MEV where someone tries to frontrun or sandwich your transactions. MEV has a value chain which consists of MEV searchers (usually traders), block builders (creating MEV blocks), relays (distributing MEV blocks) and validators (putting MEV blocks on-chain). MEV isn’t actually unique to the blockchain because you can find it in all kinds of trading activities.

Host:

What is a private transaction?

Shen | Blocknative:

To understand private transactions you first need to understand the concept of the mempool. The MEV opportunities we talked about in the previous question occur in public mempools. When you submit a transaction on ETH mainnet your transaction gets publicly and globally broadcast to a network of nodes. Each of these nodes have a memory pool, or mempool (each mempool may not see all the transactions at the same time due to network latency), where the transaction sits until it is picked up by block builder to land on-chain (every 12 seconds a block of transactions is added on-chain). This info is public so that everyone can see it in realtime (for example, by using Blocknative’s Mempool Explorer).

Since everyone can see the public mempool, including people looking for MEV opportunities, if your transaction results in a high liquidity event, you have a high chance of being targeted by a MEV searcher and suffering negative slippage because of this. In order to avoid being exposed to MEV searchers, you can send your transactions to a private mempool run by a block builder, who’s responsible for creating MEV blocks including transactions from both public and private mempools. In this way your pending transactions will only be seen by the builders who receive them and are incentivized to keep them private for you. Private transaction is a mature solution and currently being considered the best approach to avoid bad types of MEVs. That’s why its volume has grown dramatically from less than 1% to 15%+ of total confirmed ETH transactions within the last couple months.

Host:

What are the benefits/guarantees of sending a transaction privately?

Shen | Blocknative:

The biggest benefit of sending a transaction privately is avoiding MEV front-running and sandwiching searchers and therefore minimizing your chances of negative slippage. Some private transaction services also offer MEV rebate opportunities. These services have specific agreements with searchers to only allow backrunning (capturing the good type of MEV) on your behalf and split the profit with you.

Host:

How do you send a transaction privately?

Shen | Blocknative:

All you need to do is update the RPC endpoint that your transaction is sent through. There are two types of RPC endpoints — public and private. Public RPC endpoints (e.g. Infura) will send your transactions to public mempools while the private ones will send it to private mempools. It sounds complicated but Math Wallet makes it very simple. In your wallet go to settings → node setting → Ethereum → Blocknative Tx-Boost. In other wallets you may have to add a custom RPC endpoint to your wallet. You can find the different private RPC endpoint URLs for specific providers on various documentation websites. Blocknative’s private RPC endpoint is https://rpc.blocknative.com/boost

Host:
How should a user decide on which private transaction service to use?

Shen | Blocknative:

There are many providers of private RPC endpoints but they aren’t all made the same. Things to note:

Execution speed

Private PRCs are operated by block builders and each builder can only put a certain percentage of their blocks on-chain within any given period of time. Right now the number 1 builder put about 30% of their blocks on-chain within the last 24 hours. That means if you only submit your private transactions to this builder, there’s a 70% chance that your transaction won’t be confirmed in the next block. Luckily we’ve created a solution that makes it so you don’t have to choose between all the private RPC endpoints. Blocknative’s Tx-Boost is a private RPC aggregator that sends your private transaction to all the private RPC endpoints to maximize your chances of landing on-chain. Moreover, our recent research found ways to further improve the execution. We’re building a solution for it. Stay tuned!

Observability

When you send a transaction to a public mempool you are able to observe its status in real time by using tools like Blocknative’s Mempool Explorer or receiving status updates from your wallet. This observability lets you react in real-time and make changes, such as transaction replacements, before landing on-chain. But, when it comes to private transactions, this observability isn’t guaranteed. In fact, Blocknative is the first to introduce real-time observability for private transactions. When you use Blocknative’s Tx-Boost you can monitor which private RPC endpoints have received your transaction by entering the transaction hash of the transaction sent by Blocknative’s Tx-Boost in this dashboard: https://www.blocknative.com/transaction-boost-explorer

We’re also working with wallet partners like Math Wallet to create a better user experience by embedding more of these features into the wallet’s UI. Our goal is to make the transition from public transaction to private transaction seamless.

Host:

Thank you.

The next part will be the questions from community members.

Could you compare the difference between Blocknative and other MEV projects?

Shen | Blocknative:

MEV ecosystem is much more complex today than a year ago and still expanding everyday. The MEV projects can be divided into three categories based on their activities: MEV searchers, block building service providers, data providers & researchers. Blocknative is all of them except MEV searchers. That’s why we call ourselves a credibly neutral actor and are seen as an ideal partner in this space. Strategically, we’re one of the few MEV projects that focus on building the bridge between wallets and the MEV ecosystem with a goal to level the playing field for regular DeFi traders like many of you. Moreover, we have a broader portfolio that isn’t limited to MEV on ETH, such as a wallet library (called Web3OnBoard) for all EVM chains and a multi-chain Mempool Explorer focused on transparency and visibility.

Host:

The current MEV project almost only stays on Ethereum, but in the current multi-chain world, will you expand the project to other public chains?

Shen | Blocknative:

MEV first went viral on ETH but also exists on other chains. We’ve seen growing MEV activities on Polygon, BNB and Cosmos. The reason why most MEV projects still mainly focus on ETH today is because ETH has the most comprehensive MEV infrastructure which makes it easier for projects to participate. But no doubt multi-chain MEV would be the future and Blocknative is preparing for that.

Host:

Vitalik mentioned zk private protocol, will you use this protocol to do some new projects?

Shen | Blocknative:

We’re now looking into all the L2s including ZK. The first step would be adding more L2 support in our Mempool Explorer. We’re looking forward to building partnerships with ZK and others to create the best-in-class transaction observation and MEV infrastructure for their users.

Host:
Cool. Happy to know lots of MEV and Blocknative today.

Thank you.

Shen | Blocknative:

Thanks a lot again for the invite! Hope y’all enjoy the sharing. Blocknative has been doing a lot of public education about MEV and look forward to doing more with Math in the future!

Host:

Thank you for everyone. today. With the time goes by, I think MEV will be more important for everyone.

--

--