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


Bitcoin getnettotals用法及代码示例


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

用法:

getnettotals

返回有关网络流量的信息,包括字节输入,字节输出和当前时间。

返回结果

{
  "totalbytesrecv": n,   (numeric) Total bytes received
  "totalbytessent": n,   (numeric) Total bytes sent
  "timemillis": t,       (numeric) Current UNIX time in milliseconds
  "uploadtarget":
  {
    "timeframe": n,                         (numeric) Length of the measuring timeframe in seconds
    "target": n,                            (numeric) Target in bytes
    "target_reached": true|false,           (boolean) True if target is reached
    "serve_historical_blocks": true|false,  (boolean) True if serving historical blocks
    "bytes_left_in_cycle": t,               (numeric) Bytes left in current time cycle
    "time_left_in_cycle": t                 (numeric) Seconds left in current time cycle
  }
}

示例

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

相关用法


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