Skip to main content
Transaction simulations are supported on Virtual Environments. You can simulate transactions from the Dashboard UI or programmatically using RPC.

Simulator UI

Simulation RPC

Bundle Simulation RPC

Simulation API on Virtual Environments

Simulate from the Dashboard

To simulate a transaction from the Dashboard, open your Virtual Environment and click Simulator in the sidebar, or open the menu next to Send in the header and select Simulate. The Simulator has two modes:
  • Simulate transaction: runs the transaction against the Virtual Environment’s current state and leaves the state untouched.
  • Send transaction: executes the transaction on the Virtual Environment. Its state changes persist, as they would on mainnet. Send in the header opens the Simulator in this mode.
Virtual Environment Simulator with the network set to Mainnet at block 25265709, and two mode cards: Send transaction (real execution on the VNet, state and gas persist like mainnet) and Simulate transaction (tests outcomes and reverts before running, leaving state untouched)

The two Simulator modes in a Virtual Environment.

To load an existing transaction into the Simulator, click Re-Simulate on its transaction page. Simulated transactions appear only in the Virtual Environment dashboard, not in the Public Explorer. You can use the Simulator in the following ways:
  • Debug smart contracts errors, using Edit Source to check your bugfix.
  • Call contracts to get a sense of states without persisting transactions to the network.
  • Set up desired contract states using State Overrides, to evaluate the execution under conditions that aren’t and shouldn’t be present on the chain.
  • Build proof of concept transactions to validate testing scenarios.

Simulate via RPC

Transactions on Virtual Environments can also be simulated using our the RPC methods tenderly_simulate and tenderly_simulateBundle.
We recommend integrating the Simulation RPC, but it’s possible to use Simulation REST API.
The example code below runs a simulation that uses state overrides to mint DAI.
  • Sender address: 0xe2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2.
  • DAI contract address: 0x6b175474e89094c44da98b954eedeac495271d0f
  • State override arguments: DAI(0x6b175474e89094c44da98b954eedeac495271d0f).wards[0xe2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2] = 1
Explore this guide to learn more about simulating with state overrides.
showLineNumbers

Simulate transactions via client libraries

To simulate transactions via Ethers and Viem, check out the following example:

Simulating with Viem