當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。