Networking

From ArdorDocs
Jump to: navigation, search

Add Peer

Add a peer to the list of known peers and attempt to connect to it. Password protected like the Debug Operations. POST only. Javadoc

Request:

  • requestType is addPeer
  • peer is the IP address or domain name of the peer (plus optional port)

Response: refer to Get Peer

  • isNewlyAdded is true if the peer was not already known, omitted otherwise

Add Peer Example

http://localhost:27876/nxt?
  requestType=addPeer&
  peer=ardorrules.webice.ru
{
 "downloadedVolume": 155414,
 "address": "23.95.51.154",
 "weight": 19829,
 "uploadedVolume": 63532,
 "requestProcessingTime": 478,
 "version": "2.0.11",
 "platform": "webice.ru",
 "lastUpdated": 37014605,
 "blacklisted": false,
 "announcedAddress": "ardorrules.webice.ru",
 "application": "NRS",
 "state": 1,
 "shareAddress": true
}


Blacklist API Proxy Peer

Blacklist a remote node from the UI, so it won't be used when in roaming and light client modes. POST only. Javadoc

Request:

  • requestType is blacklistAPIProxyPeer
  • peer is the IP address or domain name of the peer (plus optional port)
  • adminPassword is a string with the admin password (optional)

Response:

  • done (B) is true if the peer is blacklisted
  • requestProcessingTime (N) is the API request processing time (in millisec)

Blacklist API Proxy Peer Example

http://localhost:27876/nxt?
  requestType=blacklistAPIProxyPeer&
  peer=52.0.72.67
{
 "requestProcessingTime": 24,
 "done": true
}


Blacklist Peer

Blacklist a peer for the default blacklisting period. Password protected like the Debug Operations. POST only. Javadoc

Request:

  • requestType is blacklistPeer
  • peer is the IP address or domain name of the peer (plus optional port)

Response:

  • done (B) is true if the peer is blacklisted
  • requestProcessingTime (N) is the API request processing time (in millisec)

Blacklist Peer Example

http://localhost:27876/nxt?
  requestType=blacklistPeer&
  peer=ardorrules.webice.ru
{
 "requestProcessingTime": 0,
 "done": true
}


Get My Info

Get hostname and address of the requesting node. Javadoc

Request:

  • requestType is getMyInfo

Response:

  • host (S) is the node hostname
  • address (S) is the node address
  • requestProcessingTime (N) is the API request processing time (in millisec)

Get My Info Example

http://localhost:27876/nxt?
  requestType=getMyInfo
{
 "address": "127.0.0.1",
 "host": "127.0.0.1",
 "requestProcessingTime": 1
}


Get Peer

Get information about a given peer. Javadoc

Request:

  • requestType is getPeer
  • peer is the IP address or domain name of the peer (plus optional port)

Response:

  • downloadedVolume (N) is the number of bytes downloaded by the peer
  • address (S) the IP address or DNS name of the peer
  • weight (N) is the peer's weight value
  • uploadedVolume (N) is the number of bytes uploaded by the peer
  • version (S) is the version of the software running on the peer
  • platform (S) is a string representing the peer's platform
  • lastUpdated (N) is the timestamp (in seconds since the genesis block) of the last peer status update
  • blacklisted (B) is true if the peer is blacklisted
  • services (A) is an array of strings with the services the node provides
  • blacklistingCause (S) is the cause of blacklisting (if blacklisted is true)
  • announcedAddress (S) is the name that the peer announced to the network (could be a DNS name, IP address, or any other string)
  • application (S) is the name of the software application, typically NRS
  • state (N) defines the state of the peer: 0 for NON_CONNECTED, 1 for CONNECTED, or 2 for DISCONNECTED
  • shareAddress (B) is true if the address is allowed to be shared with other peers
  • inbound (B) is true if the peer has made a request to this node
  • inboundWebSocket (B) is true if an inbound websocket has been established from this node
  • outboundWebSocket (B) is true if an outbound websocket has been established to this node
  • lastConnectAttempt (B) is the timestamp (in seconds since the genesis block) of the last connection attempt to the peer
  • requestProcessingTime (N) is the API request processing time (in millisec)

Get Peer Example

http://localhost:27876/nxt?
  requestType=getPeer&
  peer=ardorrules.ru
{
 "downloadedVolume": 0,
 "address": "78.22.240.88",
 "inbound": false,
 "blockchainState": "DOWNLOADING",
 "uploadedVolume": 0,
 "services": [
   "CORS"
 ],
 "requestProcessingTime": 0,
 "version": "2.0.14",
 "platform": "Windows 10 amd64",
 "lastUpdated": 21436422,
 "blacklisted": false,
 "announcedAddress": "78.22.240.88",
 "application": "Ardor",
 "port": 26874,
 "lastConnectAttempt": 21433598,
 "state": 2,
 "shareAddress": true
}


Get Peers

Get a list of peer IP addresses. Javadoc

Request:

  • requestType is getPeers
  • active is true for active (not NON_CONNECTED) peers only (optional, if true overrides state)
  • state is the state of the peers, one of NON_CONNECTED, CONNECTED, or DISCONNECTED (optional)
  • includePeerInfo is true to include peer detail as in Get Peer
  • service to filter on a specific service

Note: If neither active nor state is specified, all known peers are retrieved.

Response:

  • peers (A) is an array of peer addresses
  • requestProcessingTime (N) is the API request processing time (in millisec)

Get Peers Example

http://localhost:27876/nxt?
  requestType=getPeers&
  state=DISCONNECTED
{
 "peers": [
  "198.50.146.93",
  "213.46.57.77"
 ],
 "requestProcessingTime": 1
}


Set API Proxy Peer

Set the remote node to use when in roaming and light client modes. POST only. Javadoc

Request:

  • requestType is setAPIProxyPeer
  • peer is the IP address or domain name of the peer (plus optional port)
  • adminPassword is a string with the admin password (optional)

Response:

  • downloadedVolume (N) is the number of bytes downloaded by the peer
  • address (S) the IP address or DNS name of the peer
  • weight (N) is the peer's weight value
  • uploadedVolume (N) is the number of bytes uploaded by the peer
  • version (S) is the version of the software running on the peer
  • platform (S) is a string representing the peer's platform
  • blockchainState (S) is a string describing the state of the blockchain in the peer
  • lastUpdated (N) is the timestamp (in seconds since the genesis block) of the last peer status update
  • blacklisted (B) is true if the peer is blacklisted
  • services (A) is an array of strings with the services the node provides
  • apiPort (N) is the API access port of the peer
  • apiSSLPort (N) is the SSL API access port of the peer
  • blacklistingCause (S) is the cause of blacklisting (if blacklisted is true)
  • announcedAddress (S) is the name that the peer announced to the network (could be a DNS name, IP address, or any other string)
  • application (S) is the name of the software application, typically NRS
  • state (N) defines the state of the peer: 0 for NON_CONNECTED, 1 for CONNECTED, or 2 for DISCONNECTED
  • shareAddress (B) is true if the address is allowed to be shared with other peers
  • inbound (B) is true if the peer has made a request to this node
  • inboundWebSocket (B) is true if an inbound websocket has been established from this node
  • outboundWebSocket (B) is true if an outbound websocket has been established to this node
  • lastConnectAttempt (B) is the timestamp (in seconds since the genesis block) of the last connection attempt to the peer
  • requestProcessingTime (N) is the API request processing time (in millisec)

Set API Proxy Peer Example

http://localhost:27876/nxt?
  requestType=setAPIProxyPeer&
  peer=163.172.154.74
{
 "downloadedVolume":6176,
 "address":"104.223.53.14",
 "inbound":false,
 "blockchainState":"UP_TO_DATE",
 "weight":0,
 "uploadedVolume":323,
 "services":[
  "PRUNABLE","API","API_SSL","CORS"
  ],
 "requestProcessingTime":77,
 "version":"2.0.11",
 "platform":"ARDOR-TGFQ-U33C-C37U-CMKWF",
 "inboundWebSocket":false,
 "apiSSLPort":7878,
 "lastUpdated":112610887,
 "blacklisted":false,
 "announcedAddress":"104.223.53.14",
 "apiPort":27876,
 "application":"Ardor",
 "port":27874,
 "outboundWebSocket":true,
 "lastConnectAttempt":112610887,
 "state":1,
 "shareAddress":true
}