Skip to main content

getblockstats

Overview

The 'getblockstats' RPC method allows you to calculate statistics for a specified block within a given window.

Request

wget --no-check-certificate --quiet \
--method POST \
--timeout=0 \
--header 'Content-Type: application/json' \
--header 'accept: application/json' \
--header 'X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY' \
--body-data '{
"jsonrpc": "1.0",
"id": "1",
"method": "getblockstats",
"params": []
}' \'https://bitcoin-mainnet.node.coinapi.io'

Request Parameters

'hash_or_height'

  • Type: string/numeric
  • Requirement: Mandatory
  • Description: The hash or height of the block you wish to target.

'stats'

  • Type: JSON Array
  • Requirement: Optional
  • Description: A JSON array that contains the values to be filtered from the statistics.

Response

{
"avgfee": 0.00012345,
"avgfeerate": 12.34,
"avgtxsize": 250,
"blockhash": "00000000000000000007d0f98d9ec3b757a2774e667e9b0d6437a1a9d70c1303",
"feerate_percentiles": [5.67, 8.9, 12.34, 15.67, 19.01],
"height": 680255,
"ins": 1234,
"maxfee": 0.00123456,
"maxfeerate": 45.67,
"maxtxsize": 800,
"medianfee": 0.00009876,
"mediantime": 1678391234,
"mediantxsize": 225,
"minfee": 0.00001234,
"minfeerate": 4.56,
"mintxsize": 150,
"outs": 5678,
"subsidy": 6.25,
"swtotal_size": 1234567,
"swtotal_weight": 12345678,
"swtxs": 123,
"time": 1678391234,
"total_out": 123.45678901,
"total_size": 1234567,
"total_weight": 12345678,
"totalfee": 0.01234567,
"txs": 234,
"utxo_increase": 123,
"utxo_size_inc": 12345
}

The method returns a JSON object with the following properties:

  • avgfee: The average fee present in the block.
  • avgfeerate: The average fee rate in the block.
  • avgtxsize: The average transaction size in the block.
  • blockhash: The hash identifier of the block.
  • feerate_percentiles: A JSON array that contains the fee rates at the 10th, 25th, 50th, 75th, and 90th percentile weight units.
  • height: The height of the block in the blockchain.
  • ins: The total number of inputs in the block.
  • maxfee: The maximum fee found in the block.
  • maxfeerate: The maximum fee rate in the block.
  • maxtxsize: The maximum transaction size found in the block.
  • medianfee: The truncated median fee in the block.
  • mediantime: The median time past of the block.
  • mediantxsize: The truncated median transaction size in the block.
  • minfee: The minimum fee found in the block.
  • minfeerate: The minimum fee rate in the block.
  • mintxsize: The minimum transaction size in the block.
  • outs: The total number of outputs in the block.
  • subsidy: The subsidy of the block.
  • swtotal_size: The total size of all SegWit transactions in the block.
  • swtotal_weight: The total weight of all SegWit transactions in the block.
  • swtxs: The total number of SegWit transactions in the block.
  • time: The timestamp of the block.
  • total_out: The total amount in all outputs, excluding the coinbase and thus the reward (i.e., subsidy + total fee).
  • total_size: The total size of all non-coinbase transactions in the block.
  • total_weight: The total weight of all non-coinbase transactions in the block.
  • totalfee: The total fee accumulated in the block.
  • txs: The total number of transactions in the block.
  • utxo_increase: The increase or decrease in the number of unspent outputs.
  • utxo_size_inc: The increase or decrease in the size of the UTXO index.