Installation and usage of the platform

REST API: blockchain peers

https://img.shields.io/badge/auth-required-orange.svg

A group of peers methods is provided to work with blockchain peer nodes:

POST /peers/connect

The method is designed to connect a new participant node to your node.

Query example:

POST /peers/connect:
{
    "host":"127.0.0.1",
    "port":"9084"
}

Response example:

POST /peers/connect:
{
  "hostname": "localhost",
  "status": "Trying to connect"
}

GET /peers/connected

The method returns a list of connected nodes.

Response example:

GET /peers/connected:
{
  "peers": [
    {
      "address": "52.51.92.182/52.51.92.182:6863",
      "declaredAddress": "N/A",
      "peerName": "zx 182",
      "peerNonce": 183759
    },
    {
      "address": "ec2-52-28-66-217.eu-central-1.compute.amazonaws.com/52.28.66.217:6863",
      "declaredAddress": "N/A",
      "peerName": "zx 217",
      "peerNonce": 1021800
    }
  ]
}

GET /peers/all

The method returns a list of all known nodes.

Response example:

GET /peers/all:
{
  "peers": [
    {
      "address": "/13.80.103.153:6864",
      "lastSeen": 1544704874714
    }
  ]
}

GET /peers/suspended

The method returns a list of suspended nodes.

Response example:

GET /peers/suspended:
[
  {
    "hostname": "/13.80.103.153",
    "timestamp": 1544704754619
  }
]

POST /peers/identity

The method returns the public key of the node to which your node is connected for confidential data transfer.

The following parameters are passed in the request:

  • address - blockchain address that corresponds to the privacy.owner-address parameter in the node configuration file;

  • signature - digital signature from the value of the address field.

Query example:

POST /peers/identity:
{
  "address": "3NBVqYXrapgJP9atQccdBPAgJPwHDKkh6A8",
  "signature": "6RwMUQcwrxtKDgM4ANes9Amu5EJgyfF9Bo6nTpXyD89ZKMAcpCM97igbWf2MmLXLdqNxdsUc68fd5TyRBEB6nqf"
}

The method response contains the publicKey parameter - the public key of the node associated with the privacy.owner-address parameter in its configuration file. If the handshakes check mode is disabled, the publicKey parameter is not shown.

Response example:

POST /peers/identity:
{
  "publicKey": "3NBVqYXrapgJP9atQccdBPAgJPwHDKkh6A8"
}

GET /peers/hostname/{address}

The method receives the blockchain address (owner-address) and, if there is such an address among the peers, the method returns the corresponding hostname and IP address of the node.

Response example:

GET /peers/hostname/{address}:
{
  "hostname": "node1.we.io",
  "ip": "10.0.0.1"
}

GET /peers/allowedNodes

Obtaining the current list of allowed network members at the time of the request.

GET /peers/allowedNodes:
{
  "allowedNodes": [
    {
      "address": "3JNLQYuHYSHZiHr5KjJ89wwFJpDMdrAEJpj",
      "publicKey": "Gt3o1ghh2M2TS65UrHZCTJ82LLcMcBrxuaJyrgsLk5VY"
    },
    {
      "address": "3JLp8wt7rEUdn4Cca5Hp9jZ7w8T5XDAKicd",
      "publicKey": "J3ffCciVu3sustgb5vxmEHczACMR89Vty5ZBLbPn9xyg"
    },
    {
      "address": "3JRY1cp7atRMBd8QQoswRpH7DLawM5Pnk3L",
      "publicKey": "5vn4UcB9En1XgY6w2N6e9W7bqFshG4SL2RLFqEWEbWxG"
    }
  ],
  "timestamp": 1558697649489
}
See also