All Products

Simulations
Simulation Modes

Simulation Modes

The simulation_type API parameter allows you to control the level of detail returned in the simulation result.

Types of simulations

  • full (default): Detailed raw and decoded information with call trace, function inputs and outputs, state diffs, etc.
  • quick: Minimal, raw values
  • abi: Minimal information with decoded inputs, outputs, and logs

Full simulations take more time, depending on the depth of the call trace. Use quick simulations when decoded information isn’t necessary.

Full simulation mode

  • The call trace containing the function name, position in the source file, caller’s address, and balance
  • Decoded function inputs and outputs, with soltype for all arguments. This applies to all function calls, including the direct call to the smart contract from EOA, internal calls between smart contracts, and function calls within each smart contract.
  • Decoded state diff (changes to the state) enriched with soltype for the modified fields
  • Decoded logs (events) consisting of the Solidity event that produced them and the event arguments’ value, enriched with type for each.
request.ts
import axios from 'axios';
import * as dotenv from 'dotenv';
 
dotenv.config();
 
const approveDai = async () => {
  // assuming environment variables TENDERLY_ACCOUNT_SLUG, TENDERLY_PROJECT_SLUG and TENDERLY_ACCESS_KEY are set
  // https://docs.tenderly.co/account/projects/account-project-slug
  // https://docs.tenderly.co/account/projects/how-to-generate-api-access-token
  const { TENDERLY_ACCOUNT_SLUG, TENDERLY_PROJECT_SLUG, TENDERLY_ACCESS_KEY } = process.env;
 
  console.time('Simulation');
 
  const resp = await axios.post(
    `https://api.tenderly.co/api/v1/account/${TENDERLY_ACCOUNT_SLUG}/project/${TENDERLY_PROJECT_SLUG}/simulate`,
    // the transaction
    {
      /* Simulation Configuration */
      save: false, // if true simulation is saved and shows up in the dashboard
      save_if_fails: false, // if true, reverting simulations show up in the dashboard
      simulation_type: 'full', // full, abi or quick (full is default)
      network_id: '1', // network to simulate on
      /* Standard EVM Transaction object */
      from: '0xdc6bdc37b2714ee601734cf55a05625c9e512461',
      to: '0x6b175474e89094c44da98b954eedeac495271d0f',
      input:
        '0x095ea7b3000000000000000000000000f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1000000000000000000000000000000000000000000000000000000000000012b',
      gas: 8000000,
      gas_price: 0,
      value: 0,
    },
    {
      headers: {
        'X-Access-Key': TENDERLY_ACCESS_KEY as string,
      },
    },
  );
  console.timeEnd('Simulation');
 
  const transaction = resp.data.transaction;
  console.log(JSON.stringify(transaction, null, 2));
};
 
approveDai();

Quick simulation mode

Offers raw data without additional decoding. This mode is best when you only need the fundamental details of a transaction.

request.ts
import axios from 'axios';
import * as dotenv from 'dotenv';
 
dotenv.config();
 
const approveDai = async () => {
  // assuming environment variables TENDERLY_ACCOUNT_SLUG, TENDERLY_PROJECT_SLUG and TENDERLY_ACCESS_KEY are set
  // https://docs.tenderly.co/account/projects/account-project-slug
  // https://docs.tenderly.co/account/projects/how-to-generate-api-access-token
  const { TENDERLY_ACCOUNT_SLUG, TENDERLY_PROJECT_SLUG, TENDERLY_ACCESS_KEY } = process.env;
 
  console.time('Simulation');
 
  const resp = await axios.post(
    `https://api.tenderly.co/api/v1/account/${TENDERLY_ACCOUNT_SLUG}/project/${TENDERLY_PROJECT_SLUG}/simulate`,
    // the transaction
    {
      /* Simulation Configuration */
      save: false, // if true simulation is saved and shows up in the dashboard
      save_if_fails: false, // if true, reverting simulations show up in the dashboard
      simulation_type: 'quick', // full, abi or quick (full is default)
      network_id: '1', // network to simulate on
      /* Standard EVM Transaction object */
      from: '0xdc6bdc37b2714ee601734cf55a05625c9e512461',
      to: '0x6b175474e89094c44da98b954eedeac495271d0f',
      input:
        '0x095ea7b3000000000000000000000000f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1000000000000000000000000000000000000000000000000000000000000012b',
      gas: 8000000,
      gas_price: 0,
      value: 0,
    },
    {
      headers: {
        'X-Access-Key': TENDERLY_ACCESS_KEY as string,
      },
    },
  );
  console.timeEnd('Simulation');
 
  const transaction = resp.data.transaction;
  console.log(JSON.stringify(transaction, null, 2));
};
 
approveDai();

ABI simulation mode

The call trace containing the function name, decoded input and output variables

Decoded logs (events) consisting of the Solidity event that produced them and the event arguments’ value, enriched with type description for each.

request.ts
import axios from 'axios';
import * as dotenv from 'dotenv';
 
dotenv.config();
 
const approveDai = async () => {
  // assuming environment variables TENDERLY_ACCOUNT_SLUG, TENDERLY_PROJECT_SLUG and TENDERLY_ACCESS_KEY are set
  // https://docs.tenderly.co/account/projects/account-project-slug
  // https://docs.tenderly.co/account/projects/how-to-generate-api-access-token
  const { TENDERLY_ACCOUNT_SLUG, TENDERLY_PROJECT_SLUG, TENDERLY_ACCESS_KEY } = process.env;
 
  console.time('Simulation');
 
  const resp = await axios.post(
    `https://api.tenderly.co/api/v1/account/${TENDERLY_ACCOUNT_SLUG}/project/${TENDERLY_PROJECT_SLUG}/simulate`,
    // the transaction
    {
      /* Simulation Configuration */
      save: false, // if true simulation is saved and shows up in the dashboard
      save_if_fails: false, // if true, reverting simulations show up in the dashboard
      simulation_type: 'abi', // full, abi or quick (full is default)
      network_id: '1', // network to simulate on
      /* Standard EVM Transaction object */
      from: '0xdc6bdc37b2714ee601734cf55a05625c9e512461',
      to: '0x6b175474e89094c44da98b954eedeac495271d0f',
      input:
        '0x095ea7b3000000000000000000000000f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1000000000000000000000000000000000000000000000000000000000000012b',
      gas: 8000000,
      gas_price: 0,
      value: 0,
    },
    {
      headers: {
        'X-Access-Key': TENDERLY_ACCESS_KEY as string,
      },
    },
  );
  console.timeEnd('Simulation');
 
  const transaction = resp.data.transaction;
  console.log(JSON.stringify(transaction, null, 2));
};
 
approveDai();