> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainstack.com/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.chainstack.com/feedback

```json
{
  "path": "/reference/fantom-peercount",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# net_peerCount | Fantom

Fantom 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.

<Check>
  **Get your own node endpoint today**

  [Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required.

  You can sign up with your GitHub, X, Google, or Microsoft account.
</Check>

## Parameters

* `none`

## Response

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

## `net_peerCount` code examples

<CodeGroup>
  ```javascript web3.js theme={"system"}
  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();
  ```

  ```javascript ethers.js theme={"system"}
  const ethers = require('ethers');
  const NODE_URL = "CHAINSTACK_NODE_URL";
  const provider = new ethers.JsonRpcProvider(NODE_URL);

  const peersCount = async () => {
    const peers = await provider.send("net_peerCount");
    console.log(`Peers connected: ${peers}`);
  }

  peersCount()
  ```

  ```python web3.py theme={"system"}
  from web3 import Web3  
  node_url = "CHAINSTACK_NODE_URL"
  web3 = Web3.HTTPProvider(node_url)

  peers = web3.provider.make_request('net_peerCount', [])
  print(peers)
  ```
</CodeGroup>

## 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.


## OpenAPI

````yaml /openapi/fantom_node_api/net_peerCount.json POST /4ab982aa70a7baead515ffdb5915df3f
openapi: 3.0.0
info:
  title: Fantom Node API
  version: 1.0.0
  description: This is an API for interacting with a Fantom node.
servers:
  - url: https://fantom-mainnet.core.chainstack.com
security: []
paths:
  /4ab982aa70a7baead515ffdb5915df3f:
    post:
      tags:
        - Update
      summary: net_peerCount
      operationId: peerCount
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                id:
                  type: integer
                  default: 1
                jsonrpc:
                  type: string
                  default: '2.0'
                method:
                  type: string
                  default: net_peerCount
                params:
                  type: array
                  default: []
      responses:
        '200':
          description: The number of peers connected to the client.
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                  id:
                    type: integer
                  result:
                    type: string

````