Search
# Net API
To enable Net RPC API on the node, add "net" namespace in "PublicModules" in node_config.json
Definitions:
- Node Id: A 32 bytes Ed25519 public key derived from the 64-byte private key stored in "~/.gvite/maindata/net/peerKey" or specified in "PeerKey" in node_config.json
- Node Name: A human-readable name specified in "Identity" in node_config.json
- Node Address: Node's IP address + port
- Net Id: "NetID" configured in node_config.json. "1" stands for mainnet.
- Block Propagate Latency: The time difference between the broadcast time of the snapshot block and the block timestamp. In milliseconds.
- Reliable Peer: When "WhiteBlockList" is configured in node_config.json, for each peer whose height does not exceed the sum of 86400 and the maximum height in the list, each snapshot block in the whitelist will be checked on the peer. If the check fails, the peer is considered unreliable. Or when "BlackBlockHashList" is set, if a block in the blacklist can be obtained from the peer, the peer is also considered unreliable. All peers are reliable by default.
- Sync Start Height: The height at which the current synchronization loop starts. The value is the current height of the node rounded down by 100 and added by 1. If the snapshot block at the height cannot be obtained from peers, the synchronizer will try 100 blocks backward again, or will start from the irreversible height of the node. For new nodes the value is 0.
- Sync End Height: The height of the median node sorted by peer's height at which the current synchronization loop ends. For new nodes the value is 0.
- Irreversible Height: In each round, starting from the first snapshot block height, when more than two-thirds of SBPs have produced blocks, we call the height at this block irreversible height for the round.
- Chunk: A chunk is a continuous range of snapshot blocks represented by a starting block and an ending block.
Note: For synced nodes (state = 2), the sync start height and end height will not change.
# net_syncInfo
Get node's synchronization status
Parameters: none
Returns:
SyncInfo
from
:string
Sync start heightto
:string
Sync end heightcurrent
:string
Node's current heightstate
:uint
Sync state: 0 - not start, 1 - syncing, 2 - complete, 3 - error, 4 - cancelledstatus
:string
Sync state description
Example:
# net_syncDetail
Get node's synchronization status in detail
Parameters: none
Returns:
SyncDetail
from
:string
Sync start heightto
:string
Sync end heightcurrent
:string
Node's current heightstate
:string
Sync state. This field returns the same value withstatus
status
:string
Sync state descriptiontasks
:Array<string>
Current download tasks. Only nodes in synchronising state have download tasks.connections
:Array<SyncConnectionStatus>
address
:string
Connected peer address, consisting of the first 16-byte of node id + "@" + node's ip address + portspeed
:string
Downloading speed from the peertask
:string
Current download task
chunks
:Array<SnapshotRange>
Verified snapshot chunks waiting for inserting into local ledgerheight
:uint64
Snapshot block heighthash
:hash
Snapshot block hash
caches
:Array<Segment>
Unverified snapshot chunks stored in cacheFrom
:uint64
Start snapshot block heightTo
:uint64
End snapshot block heightHash
:hash
Segment hashPreHash
:hash
Previous segment hashPoints
:Array<HashHeight>
Hash height points contained in the segmentheight
:uint64
Snapshot block heighthash
:hash
Snapshot block hash
Example:
# net_nodeInfo
Get the detailed information of the node and connected peers
Parameters: none
Returns:
NodeInfo
id
:string
Node idname
:string
Node namenetId
:int
Network idversion
:int
Node version. Returns 0 for all nodes.address
:string
Node address. Not implemented. Returns empty string at the momentpeerCount
:int
Number of peers connectedpeers
:Array<PeerInfo>
Peers connectedid
:string
Peer idname
:string
Peer nameversion
:int
Peer version. Returns 0 for all nodes.height
:int
Peer's current heightaddress
:string
Peer's ip address + portflag
:byte
Connect type. 0 - inbound, 1 - outboundsuperior
:bool
true
means the peer is an SBPreliable
:bool
true
means the peer is reliablecreateAt
:string
The datetime when this peer was connectedreadQueue
:int
The current message queue length to be read by the peerwriteQueue
:int
The peer's current message queue length to be written to other peerspeers
:Array<string>
List of peer ids that the peer is currently connected to
height
:uint64
Node heightnodes
:int
Node table size. Not implemented. Returns 0 at the moment.latency
:Array<int>
An array of 4 integers in order containing the current block broadcast latency, the average block broadcast latency within 1 hour, the average block broadcast latency within 12 hours, and the average block broadcast latency within 24 hours. In milliseconds.broadCheckFailedRatio
:float32
The ratio of account blocks received within 16 seconds with confirmations exceeding 100server
:Array<SyncConnectionStatus>
Not implemented. Returns empty array at the moment.
Example:
# net_nodes
Get all alive peers in node table
Note: Alive peers are not connected peers. Alive peers are nodes stored in node's peer table and can be pinged through
Parameters: none
Returns:
Count
:int
Number of alive peersNodes
:Array<Node>
id
:string
Node idaddress
:string
Node's IP address + portnet
:int
Network idext
:Array<byte>
Additional message. Default is null
Example:
# net_peerCount
Get the number of connected peers
Parameters: none
Returns:
int
Number of peers connected
Example: