比特幣(Bitcoin) RPC Blockchain API中getblockstats的用法及代碼示例。
用法:
getblockstats hash_or_height ( stats )
計算給定窗口的每塊統計信息。所有數量均以聰計。
修剪無法在某些高度工作。
如果沒有-txindex,則無法獲得utxo_size_inc的* fee或* feerate統計信息。
參數1 - hash_or_height
類型:字符串或數字,必填
目標塊的塊哈希或高度
參數2 - stats
類型:json數組,可選,默認=所有值
要繪製的值(請參見下麵的結果)
[
"height", (string) Selected statistic
"time", (string) Selected statistic
...
]
返回結果
{ (json object)
"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)
"feerate_percentiles": [ (array of numeric) Feerates at the 10th, 25th, 50th, 75th, and 90th percentile weight unit (in satoshis per virtual byte)
"10th_percentile_feerate", (numeric) The 10th percentile feerate
"25th_percentile_feerate", (numeric) The 25th percentile feerate
"50th_percentile_feerate", (numeric) The 50th percentile feerate
"75th_percentile_feerate", (numeric) The 75th percentile feerate
"90th_percentile_feerate", (numeric) The 90th percentile feerate
],
"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
"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)
}
示例
bitcoin-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:8332/
相關用法
- Bitcoin getbestblockhash用法及代碼示例
- Bitcoin getblock用法及代碼示例
- Bitcoin getblockchaininfo用法及代碼示例
- Bitcoin getblockcount用法及代碼示例
- Bitcoin getblockhash用法及代碼示例
- Bitcoin getblockheader用法及代碼示例
- Bitcoin getchaintips用法及代碼示例
- Bitcoin getchaintxstats用法及代碼示例
- Bitcoin getdifficulty用法及代碼示例
- Bitcoin getmempoolancestors用法及代碼示例
- Bitcoin getmempooldescendants用法及代碼示例
- Bitcoin getmempoolentry用法及代碼示例
- Bitcoin getmempoolinfo用法及代碼示例
- Bitcoin getrawmempool用法及代碼示例
- Bitcoin gettxout用法及代碼示例
- Bitcoin gettxoutproof用法及代碼示例
- Bitcoin gettxoutsetinfo用法及代碼示例
- Bitcoin preciousblock用法及代碼示例
- Bitcoin pruneblockchain用法及代碼示例
- Bitcoin savemempool用法及代碼示例
- Bitcoin scantxoutset用法及代碼示例
- Bitcoin verifychain用法及代碼示例
注:本文由純淨天空篩選整理自bitcoin.org大神的英文原創作品 Bitcoin getblockstats。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。