getnetworkinfo - Zcash
This method returns network status information for the node, including its protocol version and connection count.
Zebra returns a subset of Bitcoin Core's getnetworkinfo. The per-direction counts connections_in and connections_out, and the localrelay, networkactive, and incrementalfee fields, are not present.
Parameters
This method takes no parameters.
Request
bashcurl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "getnetworkinfo",
"params": [],
"id": "getblock.io"
}'example.js
javascriptconst axios = require('axios');
const response = await axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
jsonrpc: '2.0',
method: 'getnetworkinfo',
params: [],
id: 'getblock.io'
}, {
headers: { 'Content-Type': 'application/json' }
});
console.log(response.data.result);example.py
pythonimport requests
response = requests.post(
'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
headers={'Content-Type': 'application/json'},
json={
'jsonrpc': '2.0',
'method': 'getnetworkinfo',
'params': [],
'id': 'getblock.io'
}
)
print(response.json())example.rs
rustuse reqwest::Client;
use serde_json::{json, Value};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let response = client
.post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
.header("Content-Type", "application/json")
.json(&json!({
"jsonrpc": "2.0",
"method": "getnetworkinfo",
"params": [],
"id": "getblock.io"
}))
.send()
.await?
.json::<Value>()
.await?;
println!("Result: {}", response["result"]);
Ok(())
}Response
json{
"jsonrpc": "2.0",
"result": {
"version": 6030000,
"subversion": "/Zebra:6.3.0/",
"protocolversion": 170160,
"localservices": "0000000000000001",
"timeoffset": 0,
"connections": 69,
"networks": [
{
"name": "ipv4",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "ipv6",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "onion",
"limited": false,
"reachable": false,
"proxy": "",
"proxy_randomize_credentials": false
}
],
"relayfee": 1e-06,
"localaddresses": [],
"warnings": ""
},
"id": "getblock.io"
}Response Parameters
| Parameter | Type | Description |
|---|---|---|
version | integer | Zebra numeric version |
subversion | string | User agent string sent to peers |
protocolversion | integer | P2P protocol version |
localservices | string | Hex-encoded services supported by this node |
timeoffset | integer | Median time offset in seconds vs peer clocks |
connections | integer | Total active peer connections |
networks | array of object | Per-network (IPv4, IPv6, Tor) status objects |
relayfee | number | Minimum relay fee in ZEC/kB |
localaddresses | array of object | Locally-advertised addresses |
warnings | string | Any node warnings (empty if none) |
Use Cases
- Health Checks: Read
connectionsto confirm the node has peers - Version Checks: Read
subversionandprotocolversionto identify the node - Fee Floors: Read
relayfeefor the minimum relay fee in ZEC per kilobyte - Node Warnings Monitoring: Poll the
warningsfield to detect network-layer issues that don't stop the node
Error Handling
| Error Code | Message | Description |
|---|---|---|
| -32601 | Method not found | Node does not expose getnetworkinfo |
| -32603 | Internal error | Node failed to compile the network info payload |