Skip to main content
Standard Ethereum JSON-RPC API

eth_estimateGas

Returns an estimate of gas needed to execute a transaction. The transaction is not sent.

note

For more accurate gas estimation on Linea, use linea_estimateGas instead. It returns the gas limit, base fee per gas, and priority fee per gas in a single call, accounting for Linea's L1 data-submission costs.

Parameters​

  • transaction: [required] Transaction call object (same fields as eth_call).
  • blockParameter: [optional] Hexadecimal block number, or latest.

Returns​

Hexadecimal value of the estimated gas.

Example​

Request​

curl https://rpc.linea.build \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_estimateGas",
"params": [
{
"to": "0x176211869ca2b568f2a7d4ee941e073a821ee1ff",
"data": "0x70a08231000000000000000000000000d8da6bf26964af9d7eed9e03e53415d37aa96045"
}
],
"id": 1
}'

Response​

{
"jsonrpc": "2.0",
"id": 1,
"result": "0x7b17"
}

Was this page helpful?