admin_nodeInfo

描述:查询节点信息

parameter

return

节点对象

字段名称 数据类型 备注
id String 唯一节点标识
name Number 节点名称
enode String 远程节点的 enode 的链接
enr String 节点记录
ip String 节点地址
ports String 包含两个端口,discovery 和 listener
listenAddr String 监听地址
protocols String 服务端包含的协议信息

ports 结构如下:

字段名称 数据类型 备注
discovery Number UDP 发现协议监听的端口
listener Number RLPx 加密通讯的监听端口 TCP

example

Request:

curl -X POST \
  http://127.0.0.1:8283 \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc": "2.0", "id": 1, "method": "admin_nodeInfo", "params": []}'

Response:

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "id": "460546d06169b1114f26f837ffb59a67b0bd1c5f1c0c8faef6639f7ac74e4310",
        "name": "YouChain/darwin-amd64/go1.14",
        "enode": "enode://4e7936c6c561c18e8d620bffaf81bd3f2e260277094b408074d23d59c81241ef81d292da31a62e2eae0549d62679828e36c0d1359a5f03916232998adcc4779f@127.0.0.1:3109",
        "enr": "0xf896b840129b49d2deb7a0bab3178da23f83ee6af82d6d9bf7f837141286518ba186590a7553cfbe703ffd5b9c62220b290a0f34b30a7e9c6a450d4d98d4aabbe1fe7af00c83636170c6c583796f7508826964827634826970847f00000189736563703235366b31a1034e7936c6c561c18e8d620bffaf81bd3f2e260277094b408074d23d59c81241ef83746370820c2583756470820c25",
        "ip": "127.0.0.1",
        "ports": {
            "discovery": 3109,
            "listener": 3109
        },
        "listenAddr": "[::]:3109",
        "protocols": {
            "you": {
                "network": 2,
                "genesis": "0x5bf413093afeef7f0ec1f425dd110d175550825fc254a5546fdc0b3f56e009ea",
                "config": {
                    "networkId": 2
                },
                "head": "0xea23bf8115af29ebda4320121d3c70dcfdfe8e0e254ebdffcd650309e0de251e"
            }
        }
    }
}