Automatic Simulation with "auto"
The simplest approach — pass "auto" as the fee and the client simulates internally:
- Sends the transaction to the chain’s
Simulateendpoint (without actually executing it) - Receives the estimated
gasUsed - Multiplies by a safety buffer (default 1.4x) to get the gas limit
- Calculates the fee from the gas limit and the configured
gasPrice
"auto":
Manual Simulation
For more control, callsimulate directly and build the fee yourself:
Explicit Fee (No Simulation)
When you know the gas cost ahead of time, skip simulation entirely by passing aStdFee:
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.