On this page

latest contributor to this doc

Last Edit:

@gcharang

Add Node to Version Stat

API-v2add_node_to_version_stat

The add_node_to_version_stat method adds a node's name, IP address, and PeerID to a local database to track which version of KDF it is running. The name parameter is an arbitrary identifying string, such as seed_alpha or dragonhound_DEV. The address parameter is the node's IP address or domain name. The Peer ID can be found in the KDF log file after a connection has been initiated, and looks like the below:

07 09:33:58, atomicdex_behaviour:610] INFO Local peer id: PeerId("12D3KooWReXsTVCKGAna1tzrD1jaUttTSs17ULFuvvzoGD9bqmmA")

To allow collection of version stats, added nodes must open ports 42845 (tcp) and 42855 (ws).

Parameter* = requiredTypeDescription
address*
string
The IP address of the node
name*
string
The name assigned to the node
peer_id*
string
The node's unique Peer ID

Parameter* = requiredTypeDescription
result*
string
The outcome of the request.

Add Node to Version Stat

POST
add_node_to_version_stat
{
  "mmrpc": "2.0",
  "method": "add_node_to_version_stat",
  "userpass": "RPC_UserP@SSW0RD",
  "params": {
    "name": "seed1",
    "address": "168.119.236.241",
    "peer_id": "12D3KooWEsuiKcQaBaKEzuMtT6uFjs89P1E8MK3wGRZbeuCbCw6P"
  }
}

{
    "mmrpc": "2.0",
    "result": "success",
    "id": null
}

Parameter* = requiredTypeDescription
DatabaseError
string
Optional. Database constraint error occurred.
PeerIdParseError
string
Optional. The provided peer ID format is invalid.

{
    "mmrpc": "2.0",
    "error": "Database error: UNIQUE constraint failed: nodes.peer_id",
    "error_path": "lp_stats",
    "error_trace": "lp_stats:124]",
    "error_type": "DatabaseError",
    "error_data": "UNIQUE constraint failed: nodes.peer_id",
    "id": null
}
{
    "mmrpc": "2.0",
    "error": "Database error: UNIQUE constraint failed: nodes.name",
    "error_path": "lp_stats",
    "error_trace": "lp_stats:124]",
    "error_type": "DatabaseError",
    "error_data": "UNIQUE constraint failed: nodes.name",
    "id": null
}
{
    "mmrpc": "2.0",
    "error": "Error on parse peer id 12D3RsaaWRmXsJsCKGAD5FJSsd7CSbbdrsd: decoding multihash failed",
    "error_path": "lp_stats",
    "error_trace": "lp_stats:121]",
    "error_type": "PeerIdParseError",
    "error_data": [
        "12D3RsaaWRmXsJsCKGAD5FJSsd7CSbbdrsd",
        "decoding multihash failed"
    ],
    "id": null
}