v2

latestOpenAPI 3.1.0Apache 2.02026-07-31441011.7 MB
Simulator

Simulate transaction

Call the simulate endpoint to preview the outcomes a single transaction before sending it to the live network. You can simulate transactions with custom parameters on 105+ supported networks. The output provides detailed insights into emitted events, state changes, asset and balance changes, among other things.

Learn about single transaction simulations.

The response returns the following objects:

transaction: Contains data related to the transaction, including its hash, block number, origin and destination addresses, gas details, input data, nonce, and other transaction details, like the status, timestamp, and involved contract addresses.

simulation: Contains data about the simulated transaction. It provides details related to the ID of the simulation, project and owner IDs, block number where the transaction was included, gas used, method invoked, simulation status, and other metadata.

contracts: Contains data about the contract(s) involved in the transaction, including the contract's ID, network ID, balance, verification status, associated standards (like ERC20), token-specific data if the contract is a token, compiler version, and even the source code of the contract in some cases.

generated_access_list: Contains a list of addresses and storage keys that the transaction will access, enabling certain gas cost optimizations. The access list is a feature introduced in Ethereum's EIP-2930.

post/v1/account/{accountSlug}/project/{projectSlug}/simulate

Path parameters

accountSlugstring required

Account slug of the user

projectSlugstring required

Project slug of the account

Request body

network_idstring required

ID of the network on which the simulation is being run.

fromstring required

Address initiating the transaction.

tostring required

The recipient address of the transaction.

inputstring required

Encoded contract method call data.

gasnumber

Amount of gas provided for the simulation.

block_numbernumber

Number of the block to be used for the simulation.

transaction_indexnumber

Index of the transaction within the block.

gas_pricestring

String representation of a number that represents price of the gas in Wei.

max_fee_per_gasstring

Maximum fee per gas for EIP-1559 transactions. String representation of a number in Wei.

max_priority_fee_per_gasstring

Maximum priority fee (tip) per gas for EIP-1559 transactions. String representation of a number in Wei.

noncenumber

Transaction nonce override. If not specified, the nonce is automatically determined from the sender's current state.

estimate_gasboolean

Flag that enables precise gas estimation.

valuestring

Amount of Ether (in Wei) sent along with the transaction.

generate_access_listboolean

Flag that enables returning the access list in a response.

saveboolean

Flag indicating whether to save the simulation in dashboard UI.

save_if_failsboolean

Flag indicating whether to save failed simulation in dashboard UI.

simulation_type'full' | 'quick' | 'abi'

Opt for quick, abi, or full simulation API mode.

block_headerobject

Overrides for specific block header.

state_objectsStateOverride
l1_block_numbernumber

The latest L1 block number known to L2. It applies for the Optimism transactions.

l1_timestampnumber

The timestamp of the latest L1 block. It applies for the Optimism transactions.

l1_message_senderstring

The address of the sender of the latest message from L1 to L2. It applies for the Optimism transactions.

deposit_txboolean

Indicates if the transaction is a deposit from L1 to L2. It applies for the Optimism Bedrock transactions.

system_txboolean

Indicates if the transaction is a system-level operation within L2. It applies for the Optimism Bedrock transactions.

mintnumber

The amount of a specific token minted within L2. It applies for the Optimism Bedrock transactions.

amount_to_mintstring

The desired amount to be minted in the next operation. It applies for the Optimism Bedrock transactions.

Example request

{
  "network_id": "1",
  "from": "0x3f41a1cfd3c8b8d9c162de0f42307a0095a6e5df",
  "to": "0xdef171fe48cf0115b1d80b88dc8eab59176fee57",
  "input": "0xa94e78ef000000000000000000000000000000000000000000000000000000000000002000000000000000000000000068037790a0229e9ce6eaa8a99ea92964106c470300000000000000000000000000000000000000000000010f0cf064dd592000000000000000000000000000000000000000000000000000000000000145dc1b2e00000000000000000000000000000000000000000000000000000001477f4d7d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000007800000000000000000000000000000000000000000000000000000000064d281e65c9438a5a99c4bccb1035296d5d2d8d200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000320000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000009be264469ef954c139da4a45cf76cbcc5e3a6a73000000000000000000000000000000000000000000000000000000000000271000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000006000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564000000000000000000000000000000000000000000000000000000000000271000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000064db6806000000000000000000000000000000000000000000000000000000000000002b68037790a0229e9ce6eaa8a99ea92964106c47030001f4a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000009be264469ef954c139da4a45cf76cbcc5e3a6a730000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000060000000000000000000000001b81d678ffb9c0263b24a97847620c99d213eb14000000000000000000000000000000000000000000000000000000000000271000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000064db6806000000000000000000000000000000000000000000000000000000000000002ba0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000064dac17f958d2ee523a2206206994597c13d831ec70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "gas": 648318,
  "block_number": 17884583,
  "gas_price": "18312000018",
  "max_fee_per_gas": "20000000000",
  "max_priority_fee_per_gas": "1000000000",
  "value": "0",
  "access_list": [
    {
      "address": "0x3f41a1cfd3c8b8d9c162de0f42307a0095a6e5df",
      "storage_keys": []
    }
  ],
  "save": true,
  "save_if_fails": true,
  "simulation_type": "full",
  "block_header": {
    "number": "0x110ace7",
    "hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "stateRoot": "0xef53217576746e2df5a5acb6993b629e548592008c22e5eb0c543ab0e597102f",
    "parentHash": "0x0cf8a2db87cf124e1c8fceffd12c325e07fb51736c7dce9d0f945913616cb40a",
    "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
    "transactionsRoot": "0xb29cef267cf8e4b1a629f2aaeff8e3b4faf79195efcb63a08e4823070ee85f21",
    "receiptsRoot": "0x9290b9bda89e8bc6173f17fab6b94ef7ffb1d33770e5d0fc9e21039ef936c777",
    "logsBloom": "0x40330cb14709a3aa3021ae29e85c20249ba3bc0c08bf9c7422cf48124a121120853709b6c20d1261603531d2b8b6810feeb920399c23eb1d8601f14e157921f9ac4b55994f4c3e686a0242ae56ea70ed84fb0b04d6ea1eed11e356cd85609fc3bf310367723a6c1b08453ceecc22d8df13f30504822865610bca1197895e7156a9bfd2756614028c1f5cf5e87bd6a43795c61841abc4d01c6475eae29ad813520b0223401451e9a3fe836ad63e967557cc99030243ad151927d4255e93b7391ed6d29882497108c2044092a24cc68291279b70a7f404ba1139210d5e1c25b40beaf2f48cc341d4c38787169830215105c1f014db5b98ccee22a94d3ba0663c1a",
    "timestamp": "0x64d22deb",
    "difficulty": "0x0",
    "gasLimit": "0x1c9c380",
    "gasUsed": "0x1c9b51a",
    "baseFeePerGas": "0x3d5200956",
    "miner": "0xcda9d71bdfae59b89cee131ed3079f8ac4c77062",
    "extraData": "0xd883010c00846765746888676f312e32302e34856c696e7578",
    "mixHash": "0x9096c8da5df4b9bb771f91a81c3bd954d2a9c39c1bf05502877d057b1f76fb04",
    "nonce": "0x0000000000000000",
    "size": "0x0",
    "totalDifficulty": "0x0",
    "transactions": null,
    "uncles": null
  },
  "l1_block_number": 100004000,
  "l1_timestamp": 1686124292,
  "l1_message_sender": "0x0000000000000000000000000000000000000000",
  "amount_to_mint": "0"
}

Response

A successful response.

Example response

{
  "transaction": {
    "hash": "0x8bb054967340f08827e1943ad34e2a448357e72ad1adee7397c577a716530a0f",
    "block_number": 17884583,
    "from": "0x3f41a1cfd3c8b8d9c162de0f42307a0095a6e5df",
    "gas": 648318,
    "gas_used": 45065,
    "nonce": 1094,
    "to": "0xdef171fe48cf0115b1d80b88dc8eab59176fee57",
    "value": "0x",
    "network_id": "1",
    "timestamp": "2023-08-10T12:48:11Z",
    "transaction_info": {
      "contract_id": "eth:1:0xdef171fe48cf0115b1d80b88dc8eab59176fee57",
      "method": "multiSwap"
    }
  },
  "simulation": {
    "id": "1c08db12-8f6b-4377-95ef-2c0b99298de8",
    "project_id": "dfdc391a-a15d-4590-9aef-8691259c7df4",
    "owner_id": "7d5e8b1f-8bf8-4eae-a70f-fb7d354b1cc2",
    "network_id": "1",
    "block_number": 17884583,
    "from": "0x3f41a1cfd3c8b8d9c162de0f42307a0095a6e5df",
    "to": "0xdef171fe48cf0115b1d80b88dc8eab59176fee57",
    "gas": 648318,
    "gas_price": "0",
    "gas_used": 45065,
    "value": "0",
    "method": "multiSwap",
    "error_message": "Deadline breached",
    "nonce": 1094,
    "created_at": "2023-12-20T14:03:57.3212051Z"
  },
  "contracts": [
    {
      "id": "eth:1:0xbd7b550d2e7571383d84acf597a00d341e5c406e",
      "network_id": "1",
      "public": true,
      "verified_by": "etherscan",
      "address": "0xbd7b550d2e7571383d84acf597a00d341e5c406e",
      "contract_name": "MultiPath",
      "type": "contract",
      "compiler_version": "v0.7.5+commit.eb77ed08"
    }
  ]
}