Network
The RPC API enables you to query status information for nodes and validators.
Node Status​
Returns general status of a given node (sync status, nearcore node version, protocol version, etc.), and the current set of validators.
- method:
status
- params:
[]
Example:
- JSON
- JavaScript
- HTTPie
- Lantstool
{
"jsonrpc": "2.0",
"id": "dontcare",
"method": "status",
"params": []
}
const response = await near.connection.provider.status();
http POST https://rpc.testnet.near.org \
jsonrpc=2.0 \
id=dontcare \
method=status \
params:='[]'
Try it out on Lantstool
Loading...
Example response:
{
"jsonrpc": "2.0",
"result": {
"chain_id": "testnet",
"genesis_hash": "FWJ9kR6KFWoyMoNjpLXXGHeuiy7tEY6GmoFeCA5yuc6b",
"latest_protocol_version": 73,
"node_key": null,
"node_public_key": "ed25519:DC7DbfZq4dkPqUKaKpWNimgtRBxnD9rja2KcZRs4e3DL",
"protocol_version": 73,
"rpc_addr": "0.0.0.0:3030",
"sync_info": {
"earliest_block_hash": "uz2gwgYxpx8dHsjgiPQefbwAhWk41CCvEmHU7ktYE2C",
"earliest_block_height": 187251995,
"earliest_block_time": "2025-02-10T13:54:22.616904144Z",
"epoch_id": "94jeudySZcxGBSVgKXn3xPT3P5iFF6YcnxC43F15QtkQ",
"epoch_start_height": 187443633,
"latest_block_hash": "EfL8Rc1EH13UxgbJB4skt8xSF8vojNQPcAX1opf6RFab",
"latest_block_height": 187456272,
"latest_block_time": "2025-02-12T22:10:10.530341781Z",
"latest_state_root": "3Vpebx4DuKAYmMjL96XMmLqWYUfuS2raZWoAbxFxeqBm",
"syncing": false
},
"uptime_sec": 6020117,
"validator_account_id": null,
"validator_public_key": null,
"validators": [
{
"account_id": "kiln.pool.f863973.m0",
"is_slashed": false
},
{
"account_id": "node2",
"is_slashed": false
},
{
"account_id": "node3",
"is_slashed": false
},
{
"account_id": "node0",
"is_slashed": false
},
{
"account_id": "node1",
"is_slashed": false
},
{
"account_id": "legends.pool.f863973.m0",
"is_slashed": false
},
{
"account_id": "aurora.pool.f863973.m0",
"is_slashed": false
},
{
"account_id": "01node.pool.f863973.m0",
"is_slashed": false
},
{
"account_id": "stakely_v2.pool.f863973.m0",
"is_slashed": false
},
{
"account_id": "chorusone.pool.f863973.m0",
"is_slashed": false
},
{
"account_id": "ni.pool.f863973.m0",
"is_slashed": false
},
{
"account_id": "foundryusa.pool.f863973.m0",
"is_slashed": false
},
{
"account_id": "chorus-one.pool.f863973.m0",
"is_slashed": false
},
{
"account_id": "lunanova2.pool.f863973.m0",
"is_slashed": false
},
{
"account_id": "everstake.pool.f863973.m0",
"is_slashed": false
},
{
"account_id": "fastnear.testnet",
"is_slashed": false
},
{
"account_id": "pionear-0.pool.f863973.m0",
"is_slashed": false
},
{
"account_id": "stakesstone.pool.f863973.m0",
"is_slashed": false
},
{
"account_id": "stakeway.pool.f863973.m0",
"is_slashed": false
},
{
"account_id": "bisontrails.pool.f863973.m0",
"is_slashed": false
}
],
"version": {
"build": "2.4.0-rc.1",
"rustc_version": "1.82.0",
"version": "2.4.0-rc.1"
}
},
"id": "dontcare"
}
What could go wrong?​
When API request fails, RPC server returns a structured error response with a limited number of well-defined error variants, so client code can exhaustively handle all the possible error cases. Our JSON-RPC errors follow verror convention for structuring the error response:
{
"error": {
"name": <ERROR_TYPE>,
"cause": {
"info": {..},
"name": <ERROR_CAUSE>
},
"code": -32000,
"data": String,
"message": "Server error"
},
"id": "dontcare",
"jsonrpc": "2.0"
}
Heads up
The fields
code
,data
, andmessage
in the structure above are considered legacy ones and might be deprecated in the future. Please, don't rely on them.
Here is the exhaustive list of the error variants that can be returned by status
method:
ERROR_TYPEerror.name | ERROR_CAUSEerror.cause.name | Status Code | Reason | Solution |
---|---|---|---|---|
INTERNAL_ERROR | INTERNAL_ERROR | 500 | Something went wrong with the node itself or overloaded |
|
Network Info​
Returns the current state of node network connections (active peers, transmitted data, etc.)
- method:
network_info
- params: none
Example:
- JSON
- HTTPie
- Lantstool
{
"jsonrpc": "2.0",
"id": "dontcare",
"method": "network_info",
"params": []
}
http POST https://rpc.testnet.near.org \
jsonrpc=2.0 \
id=dontcare \
method=network_info \
params:='[]'
Try it out on Lantstool
Loading...
Example response:
{
"jsonrpc": "2.0",
"result": {
"active_peers": [
{
"id": "ed25519:GkDv7nSMS3xcqA45cpMvFmfV1o4fRF6zYo1JRR6mNqg5",
"addr": "35.193.24.121:24567",
"account_id": null
}
],
"num_active_peers": 34,
"peer_max_count": 40,
"sent_bytes_per_sec": 17754754,
"received_bytes_per_sec": 492116,
"known_producers": [
{
"account_id": "node0",
"addr": null,
"peer_id": "ed25519:7PGseFbWxvYVgZ89K1uTJKYoKetWs7BJtbyXDzfbAcqX"
}
]
},
"id": "dontcare"
}