How to Simulate a Transaction

If you ever used the JSON-RPC, you've probably stumbled upon eth_call. If you haven't, it returns you the output of a Smart Contract function, without submitting an on-chain transaction. This can be useful in some cases, but it is quite limited.
With the Simulate tool, you can provide the data for a transaction and see what would happen if you submitted the transaction right now. So you get all of the tools we already offer for on-chain transactions for the pending block.
Not only that, but you can even pick a specific block height, transaction index and get the output of the transaction as if it happened at that specific point in time.
Tenderly now automatically simulates the (expected) outcome of pending transactions when you paste the tx hash into the search bar, both in your Dashboard and in our Public Explorer.
This feature is available to all users, even if they are not logged in. That means that you can now simulate live pending transactions in this way even from our Explorer page without having an account - but you really should make one (it's free) so you can use the full power of our Simulations and Forks 🚀
Read more about it here.

Starting a New Simulation

You can simulate any transaction on Tenderly in several ways. One of the easiest and probably most used ones would be to choose a desired on-chain transaction from the Transactions tab in the left navigation pane:
In the top right you can see an option to Re-Simulate the transaction, which will launch the Simulator and allow you to change any and all transaction parameters before running the simulation:
You can also start the simulation by going to the Simulator tab in the left navigation pane and clicking on New Simulation in the top right, making it possible to run completely custom simulations:

Simulating a Transaction

So let's start up a new simulation with a public contract:
The simulated transaction will fail due to insufficient Dai balance:
You can immediately jump into the debugger and get to the line of code that caused the transaction to fail:
You can also change your contract source-code by clicking on Re-Simulate and then on Edit Contract Source (read more about this here):
The transaction failed again in a different place which was expected since we deleted a part of the code:
Clicking the back arrow or clicking on the Simulator tab in the left navigation pane brings you (back) to the historical list of all simulations:
You can modify various parameters in any Simulation, such as General Simulation Parameters, State Override and Optional Access List.