P2P
P2P network RPC interface¶
Set or query network status
1. p2p_getPeers¶
- Usage:
Get currently connected nodes
- Params:
null
-
Return:P2P peer-to-peer information connecting with local
-
Example:
shell:
curl http://127.0.0.1:10085 -X POST --data '{"jsonrpc":"2.0","method":"p2p_getPeers","params":"", "id": 3}' -H "Content-Type:application/json"
cli:
drep-cli 127.0.0.1:10085 p2p_getPeers 3
- Response:
{
"jsonrpc": "2.0",
"id": 3,
"result": [
"385c49f05a235115515d5581485be6cd66bbcaf2dbace93d641b5e4c87c20255@39.98.39.224",
"9296c4f6e4ceaaea24d0416f49bf7624e920d1f71f7a51877a5d0ed156e35ac5@39.99.44.60"
]
}
2. p2p_addPeer¶
- Usage:
Add peer node
- Params:
null
-
Return:nil
-
Example:
shell:
curl http://127.0.0.1:10085 -X POST --data '{"jsonrpc":"2.0","method":"p2p_addPeer","params":["enode://e1b2f83b7b0f5845cc74ca12bb40152e520842bbd0597b7770cb459bd40f109178811ebddd6d640100cdb9b661a3a43a9811d9fdc63770032a3f2524257fb62d@192.168.74.1:55555"], "id": 3}' -H "Content-Type:application/json"
cli:
drep-cli 127.0.0.1:10085 p2p_addPeer "enode://e1b2f83b7b0f5845cc74ca12bb40152e520842bbd0597b7770cb459bd40f109178811ebddd6d640100cdb9b661a3a43a9811d9fdc63770032a3f2524257fb62d@192.168.74.1:55555" 3
- Response:
{"jsonrpc": "2.0", "id": 3, "result": None}
3. p2p_removePeer¶
- Usage:
remove peer node
- Params:
null
-
Return:nil
-
Example:
shell:
curl http://127.0.0.1:10085 -X POST --data '{"jsonrpc":"2.0","method":"p2p_removePeer","params":["enode://e1b2f83b7b0f5845cc74ca12bb40152e520842bbd0597b7770cb459bd40f109178811ebddd6d640100cdb9b661a3a43a9811d9fdc63770032a3f2524257fb62d@192.168.74.1:55555"], "id": 3}' -H "Content-Type:application/json"
cli:
drep-cli 127.0.0.1:10085 p2p_removePeer "enode://e1b2f83b7b0f5845cc74ca12bb40152e520842bbd0597b7770cb459bd40f109178811ebddd6d640100cdb9b661a3a43a9811d9fdc63770032a3f2524257fb62d@192.168.74.1:55555" 3
- Response:
{"jsonrpc": "2.0", "id": 3, "result": None}
4. p2p_localNode¶
- Usage:
Need to get local eNode for P2P link
- Params:
null
-
Return:local enode
-
Example:
shell:
curl http://127.0.0.1:10085 -X POST --data '{"jsonrpc":"2.0","method":"p2p_localNode","params":[""], "id": 3}' -H "Content-Type:application/json"
cli:
drep-cli 127.0.0.1:10085 p2p_localNode 3
- Response:
{"enode://9064107749f41ffffd9177f27af7bb854d702d930462c4be2d91d1772b3f03f3@192.168.31.63:10086}