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


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。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。