Simulate the execution of an EVM transaction and get a full debug trace and resulting event logs
Introduction
Transaction simulation is an essential dev tool for smart contract development, and for security applications (wallets, custody providers, etc).
In essence, it consists of taking an unsigned transaction object, and running it through a simulator to get the full trace of what would happen if the transaction executed.
At Noves, we employ simulation as part of our flagship security product: Foresight.
Foresight is like transaction simulation on steroids. It tells you what the transaction is about to do in plain English terms ("You're about to stake 200 USDC" or "You're about to claim 10 OP in rewards"). By contrast, a traditional simulation gives you raw technical data that you have to interpret manually to reach that same conclusion.
Foresight is a paid product, however, and it's not designed for highly-technical users who also want to get all of the raw execution data of the simulation.
That's where our free (and soon to be open-source) Simulator comes in.
How it works
This tool allows you to simulate the execution of an EVM transaction, and return the full execution data (in raw form).
The returned data consists of two major components:
- Full debug traces (every internal call that happened between contracts over the course of the transaction)
- Resulting event logs (from here it'd be possible to extract ERC transfers and more).
The input data needed to run the simulation is the exact same as our Foresight Preview endpoint. It's an Ethers-formatted JSON object with the raw unsigned transaction. The required fields are:
From
: the address executing the transaction.To
: the address of the contract being executed, or the recipient's wallet.Input
: the input data being sent on the transaction (i.e. the hash of the function being called and any additional parameters passed to that function).
Additionally, you can specify a Value
if the transaction sends some native coin, Gas
and Gas Price
, and also a Block Number
if you wish to simulate the transaction against the state of the blockchain on a specific block.
How to use
The Simulator can be called via API or through a frontend application, where you can browse through the results in a friendlier format than raw JSON.
At present time, we only offer this free tool in partnership with select chains. See below for a list of current deployments available: