POST
https://aurora-mainnet.core.chainstack.com
/
6df1a1b3061097e66349993a96b8e535
curl --request POST \
  --url https://aurora-mainnet.core.chainstack.com/6df1a1b3061097e66349993a96b8e535 \
  --header 'Content-Type: application/json' \
  --data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "net_peerCount",
  "params": []
}'
{
  "jsonrpc": "<string>",
  "id": 123,
  "result": "<string>"
}

Aurora API method that returns the number of peers connected to the node. This method can be useful for developers who want to monitor their node’s connectivity and ensure it functions as expected. By checking the number of connected peers, developers can verify that their node receives updates and is properly synchronized with the network.

Get you own node endpoint today

Start 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

  • quantity — an integer value indicating the current number of peers connected to the node

net_peerCount code examples

const { Web3 } = require("web3");

const NODE_URL = "CHAINSTACK_NODE_URL";

const web3 = new Web3(NODE_URL);



async function getPeers() {

  const peers = await web3.eth.net.getPeerCount()

  console.log(peers);

}



getPeers();

Use case

One practical use case for the net_peerCount method is to monitor the number of peers connected to a node and take some action if the number drops below a certain threshold. For example, a developer might want to send a notification to check the node if the peer count is low for more than 10 minutes.

Body

application/json

Response

200 - application/json

The number of peers connected to the client.

The response is of type object.