klay_gasPriceAt

Returns different values based on the condition described below. The unit of the return value is peb.

  • If baseFee is undefined in the header, it returns the unit price from the governance parameter
  • If the block is a pending block, it returns the gas price of the txpool.
  • Otherwise, it returns the base fee of the given block.

📘

Supported on Klaytn (mainnet) only.

Parameters

Request

TypeDescription
NUMBERBlock number. If omitted, latest unit price will be returned.

Result

TypeDescription
QUANTITYInteger of the current gas price in peb.

API Endpoint

The format of a Klaytn API endpoint is
https://open-platform.nodereal.io/{{apiKey}}/klaytn/

Here is an example:
https://open-platform.nodereal.io/4c0a1c23661a4e26bcbcwed461e34ea9/klaytn/

Example

// Request
curl https://open-platform.nodereal.io/{{apiKey}}/klaytn/ \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"klay_gasPriceAt","params":["0x64"],"id":1}' 

// Result
{
  "jsonrpc": "2.0",
  "id":1,
  "result": "0xAE9F7BCC00" // 250,000,000,000 peb = 250 ston
}