For AI agents: a documentation index is available at /llms.txt. Markdown versions of pages are available by appending .md to any documentation URL.
Skip to main content

Fee market methods

These methods query gas price and fee market information, including the base fee, blob base fee, fee history, and priority fees.

eth_baseFee

Returns the base fee per gas for the next block in wei.

Parameters

  • None

Returns

  • Hexadecimal integer representing the base fee per gas for the next block in wei, or null if the network does not support EIP-1559.

Example

curl -X POST http://127.0.0.1:8545/ \
-H "Content-Type: application/json" \
--data '{
"jsonrpc": "2.0",
"method": "eth_baseFee",
"params": [],
"id": 51
}'

eth_blobBaseFee

Returns the base fee per blob gas in wei.

info

Shard blob transactions enable scaling Ethereum by allowing blobs of data to be stored temporarily by consensus clients.

Parameters

  • None

Returns

  • Hexadecimal integer representing the base fee per blob gas.

Example

curl -X POST http://127.0.0.1:8545/ \
-H "Content-Type: application/json" \
--data '{
"jsonrpc": "2.0",
"method": "eth_blobBaseFee",
"params": [],
"id": 51
}'

eth_feeHistory

Returns base fee per gas and transaction effective priority fee per gas history for the requested block range, allowing you to track trends over time.

As of EIP-4844, this method tracks transaction blob gas fees as well.

Parameters

  • blockCount: integer or string - Number of blocks in the requested range. Between 1 and 1024 blocks can be requested in a single query. If blocks in the specified block range are not available, then only the fee history for available blocks is returned. Accepts hexadecimal or integer values.

  • newestBlock: string - Hexadecimal integer representing the highest number block of the requested range, or one of the string tags latest, earliest, pending, finalized, or safe, as described in block parameter.

    note

    pending returns the same value as latest.

  • array of integers - (optional) A monotonically increasing list of percentile values to sample from each block's effective priority fees per gas in ascending order, weighted by gas used.

Returns

  • Fee history results object.

    • oldestBlock: quantity, integer - Lowest number block of the returned range.

    • baseFeePerGas: array - Array of block base fees per gas, including an extra block value. The extra value is the next block after the newest block in the returned range. Returns zeroes for blocks created before EIP-1559.

    • baseFeePerBlobGas: array - Array of base fees per blob gas. Returns zeroes for blocks created before EIP-4844.

    • gasUsedRatio: array - Array of block gas used ratios. These are calculated as the ratio of gasUsed and gasLimit.

    • blobGasUsedRatio: array - Array of blob gas used ratios. These are calculated as the ratio of blobGasUsed and the max blob gas per block.

    • reward: array - Array of effective priority fee per gas data points from a single block. All zeroes are returned if the block is empty.

Example

curl -X POST http://127.0.0.1:8545/ \
-H "Content-Type: application/json" \
--data '{
"jsonrpc": "2.0",
"method": "eth_feeHistory",
"params": [
"0x5",
"latest",
[
20,
30
]
],
"id": 1
}'

eth_gasPrice

Returns a percentile gas unit price for the most recent blocks, in wei. By default, the last 100 blocks are examined and the 50th percentile gas unit price (that is, the median value) is returned.

If there are no blocks, the value for --min-gas-price is returned. The value returned is restricted to values between --min-gas-price and --api-gas-price-max. By default, 1000 wei and 500 gwei.

Use the --api-gas-price-blocks, --api-gas-price-percentile , and --api-gas-price-max command line options to configure the eth_gasPrice default values.

Parameters

  • None

Returns

  • Percentile gas unit price for the most recent blocks, in wei, as a hexadecimal value.

Example

curl -X POST http://127.0.0.1:8545/ \
-H "Content-Type: application/json" \
--data '{
"jsonrpc": "2.0",
"method": "eth_gasPrice",
"params": [],
"id": 53
}'

eth_maxPriorityFeePerGas

Returns an estimate of how much priority fee, in wei, you can pay to get a transaction included in the current block.

Parameters

  • None

Returns

  • Hexadecimal value in wei.

Example

curl -X POST http://127.0.0.1:8545/ \
-H "Content-Type: application/json" \
--data '{
"jsonrpc": "2.0",
"method": "eth_maxPriorityFeePerGas",
"params": [],
"id": 1
}'