Understanding ETH Simulation Bundles and When to Use Them

Blocknative Merge Ethereum

Blocknative recently added bundle support for simulating transactions on Ethereum Mainnet. This capability enables users to fully harness the power of the Ethereum mempool, our network of Ethereum nodes, and our existing decoding and transaction lifecycle knowledge to accurately simulate their transactions.

By adding support for simulation bundles, Blocknative has enhanced the ability of wallets, protocols, and traders to preview net-balance changes and smart contract calls, reduce failed transactions, and optimize arbitrage opportunities. 

But how?

To answer this, we first must go over the basics of how transaction simulations work on EVM-based chains.


Simulation Basics

From a birds-eye view, Ethereum is a transaction-based distributed ‘world’ computer. One way to know how your transaction affects that computer is to have your transaction included in a block. But, at that point, there’s no turning back and the state-change is on-chain and permanent.

However, if you are unsure about whether or not you want your transaction processed, you can “fork” the computer and run your transaction on top of it as if it were the real network—this is a transaction simulation. Forking creates a temporary copy of the chain state upon which transactions can be applied without impacting the true chain. Depending on the speed of your set-up, you can quickly simulate scenarios on the most current state of the chain.

When a transaction itself is the outcome of the smart contracts, just knowing the end-state of the transaction is not enough as key details about the transaction can be lost by the time the transaction makes it on-chain. These missing steps are known as internal transactions

Internal transactions aren’t stored on-chain, making them invisible to anyone that isn’t collecting this data in-flight. This is why, in addition to simulating your transaction through the Ethereum Virtual Machine (EVM), Blocknative also attaches a logger so users can see all the steps in-between submission and execution. As such, Blocknative is able to provide users with a list of decoded internal transactions on top of accurate slippage, net-balance changes and smart contract calls before authorizing transactions.

Simple transactions such as wallet-to-wallet transfers or an NFT mint can be done with a single simulation, Transacting with more complicated protocols, such as initiating a swap on a DEX or executing an arbitrage, will typically require simulating multiple transactions in one bundle. 


What Makes Simulating Bundles Different Than Simulating Single Transactions

Because we need to fork the chain, there is a large infrastructure requirement to simulate at scale. Furthermore, the stock version of the most popular Ethereum client, go-ethereum, does not include the ability to simulate more than one transaction on top of this new forked Ethereum state. 

In order to simulate more than one transaction, we have added the ability to take the intermediate state that your initial simulation has created and feed it into the simulation of the next transaction. This allows for multiple transactions to be executed sequentially in the EVM, as well as collecting their internal transaction logs and accumulating the net balance changes of impacted accounts.


Simulation Bundles in Action

Transaction Preview comes in the form of a REST endpoint, to which users can send the details of one or more transactions. In return, the user will receive a payload describing the execution of the transaction(s) in the latest block height. A few examples of simulated bundles can be found below.


Simple bundle: approve and swap

One of the biggest limitations with single transaction simulations, as available via RPC on stock go-ethereum, is that they do not work well with contracts interacting with the ERC20 approve() pattern. This pattern can be seen in most decentralized exchanges. When using a DEX like Uniswap, the Uniswap router is the contract initiating the token transfers (via internal transactions), so the user must grant approval to that contract to transfer. In a single simulation, you will not be able to approve and swap, but now you can! To see an example, we are going to approve a transfer of Balancer tokens from Vitalik’s account, and we will then swap those tokens for ETH.


simple swap request


Please scroll to see the full code sample


Simple bundle response


Please scroll to see the full code sample


DEX arbitrage: approve, swap, approve, swap

Profiting from arbitrage and liquidation opportunities can be tricky, but using Blocknative’s simulation bundles you can simulate the entire path of your arbitrage. In this example, Vitalik will be approving Balancer, trading it for DAI on Uniswap, then approving DAI, and finally swapping on Sushiswap! Because DAI and BAL are heavily arbitraged pools already, in our example it looks like Vitalik did not make any profit from this trade. However, using Blocknative he has the tools to continuously tweak and re-simulate the transactions again and again until he does!


dex arb request


Please scroll to see the full code sample



dex arb response


Please scroll to see the full code sample


Rebase arbitrage: swap and trigger rebase

There is an entire class of MEV focused around taking advantage of rebases that have been demonstrated many times in the wild. The idea is to sandwich your transactions around a rebase to be the first person to take advantage of this new EVM state. With simulation bundling, users don’t have to wait for a live update to happen to test their strategy.  Instead, users can simultaneously submit the transaction to update the rebase and simulate their transaction against this state change to experiment with selling the token. In the example below, we will be arbitraging the rebasing token DIGG by buying the token before rebase and then triggering the rebase from the authorized account. From there you can experiment with selling the token.


rebase request


Please scroll to see the full code sample


rebase response


Please scroll to see the full code sample


Using Simulation Bundles for Advanced Arbitrage

MEV searchers can also use simulation bundles to assist with additional forms of advanced forms of arbitrage, such as oracle or JIT arbitrage. We will further discuss using simulations for advanced arbitrage in a future post.


How to Leverage Bundles in Transaction Preview Today

Web3 developers and traders can now go hands-on with bundled simulations using our Transaction Preview API to: 

  • Show accurate slippage, net balance changes, and contract calls across several transactions — to ensure you always get on-chain with confidence.
  • Enable better trade execution by varying inputs like gas limit, gas price, and transaction input to see how it changes the outputs. 
  • Get insights from the mempool to optimize development. 
  • And more.

You can begin prototyping today by creating a free account and reviewing the Transaction Preview API docs. Once you are ready to push to production, simply sign up for a commercial plan

Create an account today

As always, please join our Discord Community if you have questions, concerns, or recommendations.

Master the Mempool today.

Blocknative's proven & powerful enterprise-grade infrastructure makes it easy for builders and traders to work with mempool data.

Start for free

Want to keep reading?

Good choice! We have more articles.


Get Started With MEV-Boost & Blocknative Dreamboat

The Ethereum Merge was about more than moving the network to Proof-of-Stake. The upgrade also..


Blocknative MEV Relay Launches to Provide Trusted Block Transport

San Francisco, CA; September 14, 2022

The Merge

Will The Merge Lower Gas Fees?

The Ethereum Merge is almost upon us. It will usher in the era of Proof-of-Stake, lay the..

Connect with us. Build with us.

We love to connect with teams who are building with Blocknative. Tell us about your team and what you would like to learn.

"After first building our own infrastructure, we appreciate that mempool management is a difficult, expensive problem to solve at scale. That's why we partner with Blocknative to power the transaction notifications in our next-generation wallet."

Schedule a demo