Skip to main content
POST
net_peerCount
curl --request POST \
  --url https://tempo-moderato.core.chainstack.com/a25a421add2280d53fdbc23417055501/ \
  --header 'Content-Type: application/json' \
  --data '
{
  "jsonrpc": "2.0",
  "method": "net_peerCount",
  "params": [],
  "id": 1
}
'
{
  "jsonrpc": "<string>",
  "id": 123,
  "result": "<string>"
}
Tempo API method that returns the number of peers currently connected to the client.
Get you own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.

Parameters

None.

Response

  • result — the number of connected peers encoded as hexadecimal

net_peerCount code examples

const ethers = require('ethers');
const NODE_URL = "CHAINSTACK_NODE_URL";
const provider = new ethers.JsonRpcProvider(NODE_URL);

const getPeerCount = async () => {
    const peerCount = await provider.send("net_peerCount", []);
    console.log(`Connected peers: ${parseInt(peerCount, 16)}`);
  };

getPeerCount();

Body

application/json
jsonrpc
string
default:2.0
method
string
default:net_peerCount
params
any[]
id
integer
default:1

Response

200 - application/json

The peer count

jsonrpc
string
id
integer
result
string

Number of connected peers encoded as hexadecimal

Last modified on January 28, 2026