1

As we know we cannot use admin, which works on geth, on Parity.

For example I want to retrieve information such as enode-id, ip-address, used port of each connected peer.

parity_netPeers (https://github.com/paritytech/parity/wiki/JSONRPC-parity-module#parity_netpeers) returns some information without newline, it become difficult see detect the peers connected.

curl --data '{"method":"parity_netPeers","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545

Example:

Here there is actually 2 connected peers but it returns many more information.

{"jsonrpc":"2.0","result":{"active":2,"connected":2,"max":25,"peers":[{"caps":[],"id":"575bbc154d3c37c35d5f91a42813641fef4389bc288c0e50cf2ab1cbbde014287b93d3748336ff02c99a11e7d58ab54868933c7a9804c36a071078cb9a586ca8","name":"","network":{"localAddress":"77.23.7.15:39741","remoteAddress":"Handshake"},"protocols":{"eth":null,"les":null}},{"caps":["eth/63","eth/62"],"id":"4d331051d8fb471c87a9351b36ffb72bf445a9337727d229e03c668f99897264bf11e1b897b1561f5889825e2211b06858139fa469fdf73c64d43a567ea72479","name":"Geth/v1.5.9-stable-a07539fb/linux/go1.7.1","network":{"localAddress":"77.13.17.145:35507","remoteAddress":"13.40.17.95:3000"},"protocols":{"eth":{"difficulty":null,"head":"3060e08b5cd0b90adb3c464342f6df13482361e8ef09724d7525cae48abbaf59","version":63},"les":null}},{"caps":[],"id":"13d6cc66f445072d2e389c5d47d1557543ec9f96237576a38072a5b76b67ba445050641219e1f42c1443a7287fab6cb3f4c078fa886520cbf3577ac23f5e0cad","name":"","network":{"localAddress":"77.13.17.15:44079","remoteAddress":"Handshake"},"protocols":{"eth":null,"les":null}},{"caps":[],"id":null,"name":"","network":{"lo ...`

  • In the Wallet on the Status tab :) – Afr Sep 20 '17 at 13:42
  • How? Which wallet? On parity’s gui page? @5chdn – alper Sep 20 '17 at 13:45
  • Yes, on the status tab. – Afr Sep 20 '17 at 14:36
  • Well I am not a gui person. Parity works on a node that I access via ssh. It does not have any GUI :( @5chdn. – alper Sep 21 '17 at 6:29
  • 1
    If you are not a gui person, JSON must be perfect for you :) – Afr Sep 21 '17 at 6:44
2

Install JQ, a command-line JSON processor. It's like sed for JSON.

Run this

curl -s --data '{"method":"parity_netPeers","params":[],"id":1,"jsonrpc":"2.0"}' \
-H "Content-Type: application/json" -X POST localhost:8545 \
| jq '.result.peers[] | .id, .network'

Add the name of the key preceded by a comma after .network and before the single quote to add anything else to the output.

-3

You can use net.peerCount at geth console to get the count of peers currently there in the network. admin.peers is another way by which you can get detailed information about the peers in the network.

  • 1
    I need enode information of the peers. admin.peers does not work at Parity. > admin.peers ReferenceError: 'admin' is not defined at <anonymous>:1:1 @Anchit Seth – alper Sep 19 '17 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.