Appearance
net_peerCount
served · same as reth
Returns the number of peers of the node.
When to use
Use it to check that the node has connections to the network.
Example
bash
curl -s -X POST -H 'Content-Type: application/json' \
--data '{"jsonrpc": "2.0", "id": 1, "method": "net_peerCount", "params": []}' \
http://127.0.0.1:8547json
{
"jsonrpc": "2.0",
"id": 1,
"method": "net_peerCount",
"params": []
}Response
Live mainnet, 2026-10-14. Checked against reth 2.7: equal.
json
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x27"
}The answer changes with time, so it is compared by shape (keys and types; for a list, its first item), not by value.
Parameters
None.
Returns
The number of peers as a hex number.
Notes and limits
- Without
--p2p, the node has no peers and returns0x0. The consensus client still gives it the new blocks.
Compared with reth
The live example above gives the same answer on Cinder and on reth 2.7.
Related methods
Schema (OpenRPC)
Result: Quantity
json
{
"title": "hex encoded unsigned integer",
"type": "string",
"pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
}