TriportRPC

eth_gasPrice

Last updated:

eth_gasPrice returns the node's current best estimate of the gas price, encoded as a 0x-prefixed hexadecimal string in wei. It takes no parameters. The value is derived from recent block activity and represents what the node considers a competitive price for a legacy (pre-EIP-1559) transaction.

Use it when you need a single, simple gas-price figure — for example, when constructing a legacy type: 0x0 transaction that carries a flat gasPrice field, or for a quick fee-level readout in a dashboard.

Prefer eth_feeHistory on EIP-1559 chains. Ethereum mainnet uses the EIP-1559 fee market (a per-block baseFeePerGas plus a priority tip), so a single gasPrice value is a coarse approximation. For accurate fee estimation on EIP-1559 transactions (maxFeePerGas / maxPriorityFeePerGas), use eth_feeHistory and add a tip. eth_gasPrice remains useful for legacy transactions and for rough, human-readable estimates.

Parameters

This method takes no parameters.

Returns

eth_gasPrice return value
FieldType
resultobject

Examples

curl https://triport.io/eth \
  -X POST -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <api-key>' \
  -d '{"id":1,"method":"eth_gasPrice","params":[],"jsonrpc":"2.0"}'
const res = await fetch("https://triport.io/eth", {
  method: "POST",
  headers: { "Content-Type": "application/json", Authorization: "Bearer <api-key>" },
  body: JSON.stringify({
  "id": 1,
  "method": "eth_gasPrice",
  "params": [],
  "jsonrpc": "2.0"
}),
});
const data = await res.json();
import requests
resp = requests.post(
    "https://triport.io/eth",
    headers={"Authorization": "Bearer <api-key>"},
    json={"id":1,"method":"eth_gasPrice","params":[],"jsonrpc":"2.0"},
)
print(resp.json())
{
  "id": 1,
  "result": "0x14518a40",
  "jsonrpc": "2.0"
}

Usage

  1. Transport: HTTP (JSON-RPC).
  2. Networks: mainnet.
  3. Credit cost: 1 per call.

FAQ

What does eth_gasPrice do?
Returns the node's current estimate of the gas price, in wei, as a hex string.
How many credits does eth_gasPrice cost?
eth_gasPrice costs 1 credit(s) per call on Triport by default.
Is eth_gasPrice available over WebSocket?
eth_gasPrice is an HTTP JSON-RPC method.