getClusterNodes - Solana

This method returns information about all nodes the queried validator has discovered through gossip, including their network endpoints and software versions.

Parameters

This method does not accept any 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": "getClusterNodes",
    "params": [],
    "id": "getblock.io"
}'

example.js

javascriptconst { Connection } = require('@solana/web3.js');

const connection = new Connection('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', 'confirmed');

const nodes = await connection.getClusterNodes();

console.log(nodes.length, nodes[0].version);

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': 'getClusterNodes',
        'params': [],
        'id': 'getblock.io'
    }
)

print(response.json()['result'])

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": "getClusterNodes",
            "params": [],
            "id": "getblock.io"
        }))
        .send()
        .await?
        .json::<Value>()
        .await?;

    println!("Result: {}", response["result"]);
    Ok(())
}

Response

json{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": [
        {
            "featureSet": 3271946008,
            "gossip": "145.40.94.130:8001",
            "pubkey": "dv1ZAGvdsz5hHLwWXsVnM94hWf1pjbKVau1QVkaMJ92",
            "pubsub": null,
            "rpc": null,
            "shredVersion": 50093,
            "tpu": "145.40.94.130:8004",
            "tpuQuic": "145.40.94.130:8009",
            "version": "2.3.6"
        }
    ]
}

Response Parameters

ParameterTypeDescription
jsonrpcstringJSON-RPC protocol version ("2.0")
idstringRequest identifier matching the request
resultarrayArray of node objects discovered through gossip

Node Entry

FieldTypeDescription
pubkeystringNode identity Pubkey, base58 encoded
gossipstringnull
tpustringnull
rpcstringnull
versionstringnull
featureSetnumbernull
shredVersionnumbernull

Use Cases

  • Version Census: Measure adoption of a validator client release across the cluster
  • Leader Targeting: Resolve TPU addresses to forward transactions directly to leaders
  • Fork Detection: Compare shred versions to spot nodes on a divergent cluster
  • Topology Mapping: Chart validator distribution across hosting providers and regions

Error Handling

Error CodeMessageDescription
-32603Internal errorNode failed to read the requested cluster state
-32005Node is unhealthyThe node has fallen behind the cluster tip