From 94a364cc8891bb9868a6ddae914c33629de76eed Mon Sep 17 00:00:00 2001 From: Aleobot Date: Thu, 20 May 2021 01:50:21 +0000 Subject: [PATCH] Sync snarkOS documentation --- rpc/README.md | 88 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 83 insertions(+), 5 deletions(-) diff --git a/rpc/README.md b/rpc/README.md index 19a8f513e5..1eded79cd8 100644 --- a/rpc/README.md +++ b/rpc/README.md @@ -201,20 +201,76 @@ Returns information about the node. ### Arguments -None +None ### Response -| Parameter | Type | Description | -|:------------:|:----:|:---------------------------------------------:| -| `is_miner` | bool | Flag indicating if the node is a miner | -| `is_snycing` | bool | Flag indicating if the node currently syncing | +| Parameter | Type | Description | +|:----------------:|:-------------:|:---------------------------------------------:| +| `is_bootnode` | bool | Flag indicating if the node is a bootnode | +| `is_miner` | bool | Flag indicating if the node is a miner | +| `is_syncing` | bool | Flag indicating if the node currently syncing | +| `launched` | DateTime | The timestamp of when the node was launched | +| `listening_addr` | SocketAddr | The configured listening address of the node | +| `version` | String | The version of the client binary | ### Example ```ignore curl --data-binary '{"jsonrpc": "2.0", "id":"documentation", "method": "getnodeinfo", "params": [] }' -H 'content-type: application/json' http://127.0.0.1:3030/ ``` +## getnodestats +Returns statistics related to the node. + +### Arguments + +None + +### Response + +| Parameter | Type | Description | +|:--------------------------------:|:----:|:-----------------------------------------------------------------:| +| `connections.all_accepted` | u64 | The number of connection requests the node has received | +| `connections.all_initiated` | u64 | The number of connection requests the node has made | +| `connections.all_rejected` | u64 | The number of connection requests the node has rejected | +| `connections.connected_peers` | u16 | The number of currently connected peers | +| `connections.connecting_peers` | u16 | The number of currently connecting peers | +| `connections.disconnected_peers` | u16 | The number of known disconnected peers | +| `handshakes.failures_init` | u64 | The number of failed handshakes as the initiator | +| `handshakes.failures_resp` | u64 | The number of failed handshakes as the responder | +| `handshakes.successes_init` | u64 | The number of successful handshakes as the initiator | +| `handshakes.successes_resp` | u64 | The number of successful handshakes as the responder | +| `handshakes.timeouts_init` | u64 | The number of handshake timeouts as the initiator | +| `handshakes.timeouts_resp` | u64 | The number of handshake timeouts as the responder | +| `inbound.all_successes` | u64 | The number of successfully processed inbound messages | +| `inbound.all_failures` | u64 | The number of inbound messages that couldn't be processed | +| `inbound.blocks` | u64 | The number of all received Block messages | +| `inbound.getblocks` | u64 | The number of all received GetBlocks messages | +| `inbound.getmemorypool` | u64 | The number of all received GetMemoryPool messages | +| `inbound.getpeers` | u64 | The number of all received GetPeers messages | +| `inbound.getsync` | u64 | The number of all received GetSync messages | +| `inbound.memorypool` | u64 | The number of all received MemoryPool messages | +| `inbound.peers` | u64 | The number of all received Peers messages | +| `inbound.pings` | u64 | The number of all received Ping messages | +| `inbound.pongs` | u64 | The number of all received Pong messages | +| `inbound.syncs` | u64 | The number of all received Sync messages | +| `inbound.syncblocks` | u64 | The number of all received SyncBlock messages | +| `inbound.transactions` | u64 | The number of all received Transaction messages | +| `inbound.unknown` | u64 | The number of all received Unknown messages | +| `misc.block_height` | u32 | The current block height of the node | +| `misc.blocks_mined` | u32 | The number of blocks the node has mined | +| `misc.duplicate_blocks` | u64 | The number of duplicate blocks received | +| `misc.duplicate_sync_blocks` | u64 | The number of duplicate sync blocks received | +| `outbound.all_successes` | u64 | The number of successfully sent messages | +| `outbound.all_failures` | u64 | The number of failures to send messages | +| `queues.inbound` | u32 | The number of messages queued in the common inbound channel | +| `queues.outbound` | u32 | The number of messages queued in the individual outbound channels | + +### Example +```ignore +curl --data-binary '{"jsonrpc": "2.0", "id":"documentation", "method": "getnodestats", "params": [] }' -H 'content-type: application/json' http://127.0.0.1:3030/ +``` + ## getpeerinfo Returns the node's connected peers. @@ -543,6 +599,28 @@ curl --user username:password --data-binary '{ ] }' -H 'content-type: application/json' http://127.0.0.1:3030/ ``` +## disconnect +Disconnects the node from the given address. + +### Protected Endpoint + +Yes + +### Arguments + +| Parameter | Type | Required | Description | +|:-------------------:|:------:|:--------:|:---------------------------------------------- | +| `address` | string | Yes | The address to disconnect in an IP:port format | + +### Response + +null + +### Example +```ignore +curl --user username:password --data-binary '{"jsonrpc": "2.0", "id":"1", "method": "disconnect", "params": ["127.0.0.1:4141"] }' -H 'content-type: application/json' http://127.0.0.1:3030/ +``` + ## getrawrecord Returns the hex encoded bytes of a record from its record commitment.