eth_feeHistory - BSC

Example code for the eth_feeHistory JSON RPC method. Сomplete guide on how to use eth_feeHistory JSON RPC in GetBlock Web3 documentation.

This method returns historical gas information for fee estimation on BSC.

circle-info

Note: BSC uses legacy gas pricing and does not fully implement EIP-1559, so this method may have limited functionality compared to Ethereum.

Parameters

Parameter
Type
Required
Description

blockCount

string

Yes

Number of blocks to return (hex)

newestBlock

string

Yes

Newest block ("latest" or block number)

rewardPercentiles

array

No

Percentile values for priority fees

Request Example

cURL
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "eth_feeHistory",
    "params": ["0x5", "latest", [25, 50, 75]],
    "id": "getblock.io"
}'

Response Example

Response Parameters

Parameter
Type
Description

baseFeePerGas

array

Base fees (typically 0 on BSC)

gasUsedRatio

array

Ratio of gas used per block

oldestBlock

string

Starting block number

reward

array

Priority fee percentiles

Use Cases

  • Analyze historical gas usage patterns

  • Monitor network congestion trends

  • Build gas price prediction models

  • Optimize transaction timing

Error Handling

Error Code
Description

-32602

Invalid params - invalid block count or range

-32603

Internal error - node processing issues

SDK Integration

Last updated

Was this helpful?