Elements侧链RPC API文档

在线工具推荐: Three.js AI纹理开发包 - YOLO合成数据生成器 - GLTF/GLB在线编辑 - 3D模型格式在线转换 - 可编程3D场景编辑器

getblockstats - 获取区块统计数据

getblockstats调用根据指定的窗口计算区块统计数据。所有的金额单位 都是satoshi。该调用不可用于被剪枝的区块高度。

调用参数

  • hash_or_height:要统计区块的哈希或高度,数值表示高度,16进制字符串表示哈希。 如果使用高度,那么负值表示从当前链头(tip)反查
  • stats:要统计的数据,数组,可先,默认计算所有统计数据

返回结果

getblockstats调用返回指定区块的统计信息。

示例代码

请求:

~$ elements-cli getblockstats 1000 '["avgfee", "maxfee", "txs"]'

响应结果:

{
  "avgfee": xxxxx,          (numeric) Average fee in the block"
  "avgfeerate": xxxxx,      (numeric) Average feerate (in satoshis per virtual 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 satoshis per virtual byte)"
  "maxtxsize": xxxxx,       (numeric) Maximum transaction size"
  "medianfee": xxxxx,       (numeric) Truncated median fee in the block"
  "medianfeerate": xxxxx,   (numeric) Truncated median feerate (in satoshis per virtual 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 satoshis per virtual byte)"
  "mintxsize": xxxxx,       (numeric) Minimum transaction size"
  "outs": xxxxx,            (numeric) The number of outputs"
  "subsidy": xxxxx,         (numeric) The block subsidy"
  "swtotal_size": xxxxx,    (numeric) Total size of all segwit transactions"
  "swtotal_weight": xxxxx,  (numeric) Total weight of all segwit transactions divided by segwit scale factor (4)"
  "swtxs": xxxxx,           (numeric) The number of segwit transactions"
  "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"
  "total_weight": xxxxx,    (numeric) Total weight of all non-coinbase transactions divided by segwit scale factor (4)"
  "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)"
}