gas
Gas and Chain Cost
Your trained gas-price and ETH-price priors are stale. Never quote a transaction cost or exclude a chain for cost reasons without measuring the relevant chain now.
# Use the project's own RPC provider (Alchemy, Infura, QuickNode) for the chain under consideration.
cast gas-price --rpc-url "$MAINNET_RPC_URL"
cast gas-price --rpc-url "$BASE_RPC_URL"
# No provider key yet? Public endpoints work for a one-off read, but are rate-limited.
# Never ship them in an app. Mainnet: https://ethereum-rpc.publicnode.com Base: https://mainnet.base.org
cast gas-price returns the base fee plus a suggested tip — what a transaction actually pays, so it is the reading the formula below takes. cast base-fee returns the base fee alone; use it for setting maxFeePerGas, and never add a separate priority fee on top of a gas-price reading.
Do not replace a failed lookup with a remembered number. Fetch ETH/USD live before quoting dollars: the mainnet Chainlink feed at 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419 (latestRoundData, 8 decimals), or https://api.coinbase.com/v2/prices/ETH-USD/spot.
Estimate the actual operation when possible. Otherwise state and justify the gas-used assumption: