Skip to main content
Before broadcasting, you can simulate the transaction to estimate how much gas it will consume. This prevents out-of-gas failures.

Automatic Simulation with "auto"

The simplest approach — pass "auto" as the fee and the client simulates internally:
Behind the scenes, the client:
  1. Sends the transaction to the chain’s Simulate endpoint (without actually executing it)
  2. Receives the estimated gasUsed
  3. Multiplies by a safety buffer (default 1.4x) to get the gas limit
  4. Calculates the fee from the gas limit and the configured gasPrice
You can override the multiplier by passing a number instead of "auto":

Manual Simulation

For more control, call simulate directly and build the fee yourself:

Explicit Fee (No Simulation)

When you know the gas cost ahead of time, skip simulation entirely by passing a StdFee:
Simulation is an estimate. If chain state changes between simulation and broadcast (e.g. many concurrent transactions), actual gas may differ. The safety multiplier accounts for this, but high-contention scenarios may need a larger buffer (1.5–2.0x).

Next Steps

Gas & Fees

Understand gas pricing, fee calculation, and dynamic fee markets in depth.

Signing & Broadcasting

Sign and send your transaction to the chain.