当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Bitcoin getmininginfo用法及代码示例


比特币(Bitcoin) RPC Mining API中getmininginfo的用法及代码示例。

用法:

getmininginfo

返回包含mining-related信息的json对象。

返回结果

{
  "blocks": nnn,             (numeric) The current block
  "currentblockweight": nnn, (numeric, optional) The block weight of the last assembled block (only present if a block was ever assembled)
  "currentblocktx": nnn,     (numeric, optional) The number of block transactions of the last assembled block (only present if a block was ever assembled)
  "difficulty": xxx.xxxxx    (numeric) The current difficulty
  "networkhashps": nnn,      (numeric) The network hashes per second
  "pooledtx": n              (numeric) The size of the mempool
  "chain": "xxxx",           (string) current network name as defined in BIP70 (main, test, regtest)
  "warnings": "..."          (string) any network and blockchain warnings
}

示例

bitcoin-cli getmininginfo
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getmininginfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/

相关用法


注:本文由纯净天空筛选整理自bitcoin.org大神的英文原创作品 Bitcoin getmininginfo。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。