Skip to main content
Skill — Copyable reference implementation. Use as-is or customize. See Skills Philosophy.

Overview

Transaction simulation lets you execute contract calls and estimate gas without broadcasting to the network. This catches errors early, prevents wasted gas on reverted transactions, and enables building safer dApps.

Using eth_call to Simulate

eth_call executes a transaction locally against the current blockchain state without creating an on-chain transaction.

Simulating Against Different Blocks

Estimating Gas

eth_estimateGas returns the gas needed for a transaction to succeed. Always add a buffer for production.

Estimate with Value Transfer

Estimate Contract Deployment

Detecting Revert Reasons

When a call reverts, the RPC returns an error with the revert data. Voltaire provides RevertReason to decode it.

Common Panic Codes

Decoding Custom Errors

Simulating State Changes

Combine eth_call with state overrides to simulate how a transaction would affect balances and storage.

Check Balance After Transfer

Using Access Lists for Optimization

eth_createAccessList generates an access list showing which addresses and storage slots a transaction will touch.

Complete Simulation Example