Simulation API

Get started with Tenderly Simulation API to integrate Transaction Simulator into your project.
Simulation API allows you to understand a transaction's execution against any point in a network's history, including the latest block, without sending it to the blockchain. The API gives you access to a lightweight blockchain execution environment that delivers and persists detailed information about state changes, emitted events (logs), gas usage, and all calls that the transaction made.
You can then use Simulation API to introduce this information to your development, enrich your dapp decision-making process, or expose it to your dapp users. Since simulations don't run on an actual network, they're also a gas-free way to test "what-if" scenarios.

Simulation API use cases

By integrating with Simulation API, you can:

Getting started with Simulation API

Simulation API enables you to simulate transactions using a single REST endpoint. It supports two modes:
  • Full simulation mode: This mode gives you decoded simulation results, matched to smart contracts' code, for easier client-side interpretation. The decoded form contains information such as logs (emitted events), state changes, and function calls along the call trace.
  • Quick simulation mode: This mode gives you raw transaction results, with a faster response.
When using the full mode, you can easily get highly detailed simulation info and use it in your dapp. See the following example:

Simulation Bundles

Aside from using Simulation RPC and Simulation API to simulate single transactions, you can use them to simulate a sequence of interdependent transactions. You can achieve this using Simulation Bundle API:

Simulation state overrides

Use state overrides with Simulation API to set custom states for the contracts involved in a transaction before running a transaction simulation.