Gas Operations
resource: gas — estimate, price, fee history, and a recommended-fee helper
estimate
| Field | Type | Required | Description |
|---|---|---|---|
to | text | ✓ Yes | Target address of the call to estimate. |
value | text | No | ETH to send, in wei. |
data | text | No | Calldata hex, for a contract call. |
from | text | No | Caller address to estimate as. |
{ "success": true, "gasUnits": "51302" }
price
Legacy eth_gasPrice. No operation-specific fields.
{ "success": true, "gasPriceWei": "30000000000", "gasPriceGwei": 30.0 }
feeHistory
| Field | Type | Required | Description |
|---|---|---|---|
blockCount | number | ✓ Yes | Number of recent blocks to fetch fee data for. Must be positive. |
newestBlock | text | No (default "latest") | Block number/tag to end the range at. |
rewardPercentiles | text (JSON array of numbers) | No | Percentiles (e.g. [10,50,90]) to sample priority-fee rewards at, per block. |
{
"success": true,
"oldestBlock": 19383921,
"blocks": [
{ "blockNumber": 19383921, "baseFeePerGasWei": "18500000000", "gasUsedRatio": 0.62, "rewardsWei": ["1000000000","2000000000","5000000000"] }
]
}
priorityFee
eth_maxPriorityFeePerGas — a non-standard-but-widely-supported RPC method. No operation-specific fields.
{ "success": true, "priorityFeeWei": "1500000000", "priorityFeeGwei": 1.5 }
optimize
A composite feature, not a raw RPC primitive — combines gas.price,
gas.feeHistory, and gas.priorityFee into a single recommended EIP-1559 fee
pair for a chosen risk strategy.
| Field | Type | Required | Description |
|---|---|---|---|
strategy | select | No (default "standard") | safe | standard | fast. |
operations | text (JSON array) | No | Pending call descriptions ({"to","value","data","from"}) to also estimate gas units and total cost for. |
{
"success": true,
"strategy": "standard",
"baseFeePerGasWei": "18500000000",
"maxPriorityFeePerGasWei": "1500000000",
"maxFeePerGasWei": "38500000000",
"estimatedGasUnits": "51302",
"estimatedTotalCostWei": "1975642700000000"
}
Heuristic, not empirically validated: the per-strategy fee multipliers are clearly
labeled in code as a reasonable heuristic, not a rigorously tuned or empirically validated model.
Treat
gas.optimize's output as a starting point, especially for fast during
volatile fee markets — re-check with gas.price/gas.feeHistory directly if a
transaction is time-sensitive.