Skip to main content

getblockstats

Command#

pacprotocol-cli getblockstats hash_or_height ( stats )

Compute per block statistics for a given window. All amounts are in duffs. It won't work for some heights with pruning. It won't work without -txindex for utxo_size_inc, fee or feerate stats.

Arguments#

hash_or_height *#

(string or numeric, required)

The block hash or height of the target block

stats#

(array,optional)

Values to plot, by default all values (see result below)

[
"height", (string, optional) Selected statistic
"time", (string, optional) Selected statistic
,...
]

Examples#

pacprotocol-cli getblockstats 1000 '["minfeerate","avgfeerate"]'
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockstats", "params": [1000 '["minfeerate","avgfeerate"]'] }' -H 'content-type: text/plain;' http://127.0.0.1:1111/

Result#

{ #(json object)
"avgfee": xxxxx, #(numeric) Average fee in the block
"avgfeerate": xxxxx, #(numeric) Average feerate #(in duffs per byte)
"avgtxsize": xxxxx, #(numeric) Average transaction size
"blockhash": xxxxx, #(string) The block hash #(to check for potential reorgs)
"height": xxxxx, #(numeric) The height of the block
"ins": xxxxx, #(numeric) The number of inputs #(excluding coinbase)
"maxfee": xxxxx, #(numeric) Maximum fee in the block
"maxfeerate": xxxxx, #(numeric) Maximum feerate #(in duffs per byte)
"maxtxsize": xxxxx, #(numeric) Maximum transaction size
"medianfee": xxxxx, #(numeric) Truncated median fee in the block
"medianfeerate": xxxxx, #(numeric) Truncated median feerate #(in duffs per byte)
"mediantime": xxxxx, #(numeric) The block median time past
"mediantxsize": xxxxx, #(numeric) Truncated median transaction size
"minfee": xxxxx, #(numeric) Minimum fee in the block
"minfeerate": xxxxx, #(numeric) Minimum feerate #(in duffs per byte)
"mintxsize": xxxxx, #(numeric) Minimum transaction size
"outs": xxxxx, #(numeric) The number of outputs
"subsidy": xxxxx, #(numeric) The block subsidy
"time": xxxxx, #(numeric) The block time
"total_out": xxxxx, #(numeric) Total amount in all outputs #(excluding coinbase and thus reward [ie subsidy + totalfee])
"total_size": xxxxx, #(numeric) Total size of all non-coinbase transactions
"totalfee": xxxxx, #(numeric) The fee total
"txs": xxxxx, #(numeric) The number of transactions #(excluding coinbase)
"utxo_increase": xxxxx, #(numeric) The increase/decrease in the number of unspent outputs
"utxo_size_inc": xxxxx, #(numeric) The increase/decrease in size for the utxo index #(not discounting op_return and similar)
}

Running following help command

pacprotocol-cli help getblockstats

Will produce following output:

getblockstats hash_or_height ( stats )
Compute per block statistics for a given window. All amounts are in duffs.
It won't work for some heights with pruning.
It won't work without -txindex for utxo_size_inc, *fee or *feerate stats.
Arguments:
1. "hash_or_height" (string or numeric, required) The block hash or height of the target block
2. "stats" (array, optional) Values to plot, by default all values (see result below)
[
"height", (string, optional) Selected statistic
"time", (string, optional) Selected statistic
,...
]
Result:
{ (json object)
"avgfee": xxxxx, (numeric) Average fee in the block
"avgfeerate": xxxxx, (numeric) Average feerate (in duffs per byte)
"avgtxsize": xxxxx, (numeric) Average transaction size
"blockhash": xxxxx, (string) The block hash (to check for potential reorgs)
"height": xxxxx, (numeric) The height of the block
"ins": xxxxx, (numeric) The number of inputs (excluding coinbase)
"maxfee": xxxxx, (numeric) Maximum fee in the block
"maxfeerate": xxxxx, (numeric) Maximum feerate (in duffs per byte)
"maxtxsize": xxxxx, (numeric) Maximum transaction size
"medianfee": xxxxx, (numeric) Truncated median fee in the block
"medianfeerate": xxxxx, (numeric) Truncated median feerate (in duffs per byte)
"mediantime": xxxxx, (numeric) The block median time past
"mediantxsize": xxxxx, (numeric) Truncated median transaction size
"minfee": xxxxx, (numeric) Minimum fee in the block
"minfeerate": xxxxx, (numeric) Minimum feerate (in duffs per byte)
"mintxsize": xxxxx, (numeric) Minimum transaction size
"outs": xxxxx, (numeric) The number of outputs
"subsidy": xxxxx, (numeric) The block subsidy
"time": xxxxx, (numeric) The block time
"total_out": xxxxx, (numeric) Total amount in all outputs (excluding coinbase and thus reward [ie subsidy + totalfee])
"total_size": xxxxx, (numeric) Total size of all non-coinbase transactions
"totalfee": xxxxx, (numeric) The fee total
"txs": xxxxx, (numeric) The number of transactions (excluding coinbase)
"utxo_increase": xxxxx, (numeric) The increase/decrease in the number of unspent outputs
"utxo_size_inc": xxxxx, (numeric) The increase/decrease in size for the utxo index (not discounting op_return and similar)
}
Examples:
> pacprotocol-cli getblockstats 1000 '["minfeerate","avgfeerate"]'
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockstats", "params": [1000 '["minfeerate","avgfeerate"]'] }' -H 'content-type: text/plain;' http://127.0.0.1:1111/