getClusterNodes - Solana
Example code for the getClusterNodes JSON-RPC method. Complete guide on how to use the getClusterNodes JSON-RPC method in the GetBlock Web3 documentation.
Parameters
Request
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "getClusterNodes",
"params": [],
"id": "getblock.io"
}'const { Connection } = require('@solana/web3.js');
const connection = new Connection('https://go.getblock.io/<ACCESS-TOKEN>/', 'confirmed');
const nodes = await connection.getClusterNodes();
console.log(nodes.length, nodes[0].version);import requests
response = requests.post(
'https://go.getblock.io/<ACCESS-TOKEN>/',
headers={'Content-Type': 'application/json'},
json={
'jsonrpc': '2.0',
'method': 'getClusterNodes',
'params': [],
'id': 'getblock.io'
}
)
print(response.json()['result'])Response
{
"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
Parameter
Type
Description
Node Entry
Field
Type
Description
Use Cases
Error Handling
Error Code
Message
Description
Was this helpful?