Skip to main content
The RPC API enables you to query the gas price for a specific block or hash.

Quick Reference

ParameterTypeDescription
block_heightnumberSpecific block height to query gas price for
block_hashstringSpecific block hash to query gas price for
nullnullReturns gas price for the latest block

Gas Price

Returns gas price for a specific block_height or block_hash. Using [null] will return the most recent block’s gas price.
method
string
required
gas_price
params
array
required
[block_height], ["block_hash"], or [null]

Query latest gas price

{
  "jsonrpc": "2.0",
  "id": "dontcare",
  "method": "gas_price",
  "params": [null]
}

Query by block height

{
  "jsonrpc": "2.0",
  "id": "dontcare",
  "method": "gas_price",
  "params": [187310138]
}

Query by block hash

{
  "jsonrpc": "2.0",
  "id": "dontcare",
  "method": "gas_price",
  "params": ["6RWmTYhXCzjMjoY3Mz1rfFcnBm8E6XeDDbFEPUA4sv1w"]
}
{
  "jsonrpc": "2.0",
  "id": "dontcare",
  "result": {
    "gas_price": "100000000"
  }
}
For error handling information, see the RPC Errors documentation.

Build docs developers (and LLMs) love