Peers

The peers resource allows you to retrieve information about the peers connected to the network. This includes details such as their IP address, port, version, and other relevant metadata. You can use this information to inspect the network and understand the distribution of nodes.

Properties

  • Name
    ip
    Type
    string
    Description

    The IP address of the peer.

  • Name
    port
    Type
    integer
    Description

    The port number on which the peer is listening.

  • Name
    version
    Type
    string
    Description

    The version of the software that the peer is running.

  • Name
    height
    Type
    integer
    Description

    The current block height that the peer has reached.

  • Name
    latency
    Type
    integer
    Description

    The latency (in milliseconds) of the peer.

  • Name
    plugins
    Type
    object
    Description

    A list of plugins that the peer has enabled, along with their configurations.


GET/peers

List All Peers

This endpoint retrieves a list of all peers known by the node. These peers are the nodes that are connected to the network, providing critical information about their current state and configuration.

Query Parameters

  • Name
    page
    Type
    integer
    Description

    The number of the page that will be returned.

  • Name
    limit
    Type
    integer
    Description

    The number of resources per page.

  • Name
    orderBy
    Type
    string
    Description

    The column by which the resources will be sorted.

  • Name
    version
    Type
    string
    Description

    The node version by which the resources will be filtered.

Request

GET
/peers
curl https://testnet.mainsailhq.com/api/peers?limit=100&page=1

Response

{
  "meta": {
    "totalCountIsEstimate": false,
    "count": 1,
    "first": "/peers?transform=true&limit=100&page=1",
    "last": "/peers?transform=true&limit=100&page=1",
    "next": null,
    "pageCount": 1,
    "previous": null,
    "self": "/peers?transform=true&limit=100&page=1",
    "totalCount": 1
  },
  "data": [
    {
      "height": 30969,
      "ip": "91.107.217.90",
      "latency": 48,
      "plugins": {
        "@mainsail/webhooks": {
          "port": 4004,
          "enabled": false,
          "estimateTotalCount": false
        },
        "@mainsail/api-development": {
          "port": 4006,
          "enabled": true,
          "estimateTotalCount": false
        }
      },
      "port": 4000,
      "ports": {
        "@mainsail/webhooks": -1,
        "@mainsail/api-development": 4006
      },
      "version": "0.0.1-evm.2"
    }
  ]
}

GET/peers/{ip}

Retrieve a Peer by IP

This endpoint retrieves detailed information about a specific peer identified by its IP address. The response includes information such as the peer's current block height, latency, version, and the plugins it has enabled.

Path Parameters

  • Name
    ip
    Type
    string
    Description

    The IP address of the peer to be retrieved.

Request

GET
/peers/{ip}
curl https://testnet.mainsailhq.com/api/peers/91.107.217.90

Response

{
  "data": {
    "height": 30969,
    "ip": "91.107.217.90",
    "latency": 48,
    "plugins": {
      "@mainsail/webhooks": {
        "port": 4004,
        "enabled": false,
        "estimateTotalCount": false
      },
      "@mainsail/api-development": {
        "port": 4006,
        "enabled": true,
        "estimateTotalCount": false
      }
    },
    "port": 4000,
    "ports": {
      "@mainsail/webhooks": -1,
      "@mainsail/api-development": 4006
    },
    "version": "0.0.1-evm.2"
  }
}