getClusterNodes
Returns information about all the nodes participating in the cluster, including their public keys, gossip addresses, TPU addresses, RPC addresses, and software versions. This is valuable for network monitoring, node discovery, debugging connectivity issues, and building dashboards that visualize the Solana network topology.
Parameters
This method does not accept any parameters.
Response
Returns an array of node objects:
| Field | Type | Description |
|---|---|---|
[].pubkey | string | Node public key (base-58) |
[].gossip | `string | null` |
[].tpu | `string | null` |
[].rpc | `string | null` |
[].version | `string | null` |
[].featureSet | `u32 | null` |
[].shredVersion | u16 | Shred version for this node |
Code Examples
cURL
1curl http://[IP_ADDRESS]:[PORT] -X POST -H "Content-Type: application/json" -d '{
2 "jsonrpc": "2.0",
3 "id": 1,
4 "method": "getClusterNodes",
5 "params": []
6}'TypeScript
1const response = await fetch("http://[IP_ADDRESS]:[PORT]", {
2 method: "POST",
3 headers: { "Content-Type": "application/json" },
4 body: JSON.stringify({
5 jsonrpc: "2.0",
6 id: 1,
7 method: "getClusterNodes",
8 params: []
9 }),
10});
11const { result } = await response.json();
12console.log("Nodes:", result.length);Python
1import requests
2
3response = requests.post("http://[IP_ADDRESS]:[PORT]", json={
4 "jsonrpc": "2.0",
5 "id": 1,
6 "method": "getClusterNodes",
7 "params": []
8})
9result = response.json()["result"]
10print(f"Nodes: {len(result)}")Rust
1use reqwest::Client;
2use serde_json::json;
3
4#[tokio::main]
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6 let client = Client::new();
7 let res = client.post("http://[IP_ADDRESS]:[PORT]")
8 .json(&json!({
9 "jsonrpc": "2.0",
10 "id": 1,
11 "method": "getClusterNodes",
12 "params": []
13 }))
14 .send().await?
15 .text().await?;
16 println!("{}", res);
17 Ok(())
18}Example Response
1{
2 "jsonrpc": "2.0",
3 "result": [
4 {
5 "pubkey": "9QzsJf7LPLj8GkXbYT3LFDKqE5tKVhMYAhRxMuE2Nft",
6 "gossip": "10.239.6.48:8001",
7 "tpu": "10.239.6.48:8004",
8 "rpc": "10.239.6.48:8899",
9 "version": "1.18.15",
10 "featureSet": 4215500110,
11 "shredVersion": 50093
12 }
13 ],
14 "id": 1
15}