eth_simulateV1 | Ethereum

Ethereum API method that enables simulation of complex transactions and state changes without modifying the blockchain. This method is particularly useful for testing and debugging smart contracts, estimating gas costs, and analyzing the potential outcomes of transactions before committing them to the network.

👍

Get your own node endpoint today

Start for free and get your app to production levels immediately. No credit card required.

You can sign up with your GitHub, X, Google, or Microsoft account.

Parameters

  • object — the simulation request object:
    • blockStateCalls — an array of block state call objects:
      • blockOverrides — (optional) an object to override block-level parameters:
        • baseFeePerGas — (optional) the base fee per gas for the block, encoded as hexadecimal.
      • stateOverrides — (optional) an object to override account states:
        • <address> — the address of the account to override:
          • balance — (optional) the balance to set for the account, encoded as hexadecimal.
      • calls — an array of transaction call objects:
        • from — the address from which the transaction is sent.
        • to — the address to which the transaction is directed.
        • maxFeePerGas — (optional) the maximum fee per gas the sender is willing to pay.
        • value — (optional) the value sent with the transaction, encoded as hexadecimal.
    • validation — (optional) a boolean indicating whether to perform validation checks.
    • traceTransfers — (optional) a boolean indicating whether to trace value transfers.
  • quantity or tag — the integer block number, or the string "latest", "earliest" or "pending".

Response

  • object — the simulation result:
    • blockResults — an array of block result objects:
      • blockNumber — the block number of the simulated block.
      • blockHash — the hash of the simulated block.
      • stateRoot — the state root of the simulated block.
      • receipts — an array of transaction receipt objects for each simulated transaction.
    • traces — (if traceTransfers is true) an array of transfer trace objects.

Use case

eth_simulateV1 is particularly useful for developers working on complex smart contracts or DApps. It allows for the simulation of intricate transaction sequences, including multiple contract interactions and state changes, without the need to deploy contracts or spend real gas. This can be invaluable for:

  • Debugging complex smart contract interactions
  • Estimating gas costs for multi-step transactions
  • Analyzing the potential outcomes of different transaction scenarios
  • Testing contract upgrades or migrations before deployment

Try the eth_simulateV1 RPC method yourself

Language
Click Try It! to start a request and see the response here!