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


Bitcoin getnodeaddresses用法及代碼示例

比特幣(Bitcoin) RPC Network API中getnodeaddresses的用法及代碼示例。

用法:

getnodeaddresses ( count )

返回已知地址,可用於在網絡中查找新節點

參數1 - count

類型:數字,可選,默認值= 1

返回多少個地址。限於2500個較小的地址或所有已知地址的23%。

返回結果

[
  {
    "time": ttt,                (numeric) Timestamp in seconds since epoch (Jan 1 1970 GMT) keeping track of when the node was last seen
    "services": n,              (numeric) The services offered
    "address": "host",          (string) The address of the node
    "port": n                   (numeric) The port of the node
  }
  ,....
]

示例

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

相關用法


注:本文由純淨天空篩選整理自bitcoin.org大神的英文原創作品 Bitcoin getnodeaddresses。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。