Source
get_healthParameters
NoneResult
result
Returns
"ok" when the node is healthy.result
Returns a JSON-RPC error when the node is unhealthy. The exact error payload is
UNSTABLE and may change.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
RPC methods
CLI reference
Network constants
curl https://api.devnet.solana.com -s -X POST \
-H "Content-Type: application/json" \
-d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getHealth"
}
'
import { createSolanaRpc } from "@solana/kit";
const rpc_url = "https://api.devnet.solana.com";
const rpc = createSolanaRpc(rpc_url);
let health = await rpc.getHealth().send();
console.log(health);
use anyhow::Result;
use solana_client::nonblocking::rpc_client::RpcClient;
use solana_commitment_config::CommitmentConfig;
#[tokio::main]
async fn main() -> Result<()> {
let client = RpcClient::new_with_commitment(
String::from("https://api.devnet.solana.com"),
CommitmentConfig::confirmed(),
);
let health = client.get_health().await?;
println!("{:#?}", health);
Ok(())
}
{
"jsonrpc": "2.0",
"result": "ok",
"id": 1
}
{
"jsonrpc": "2.0",
"error": {
"code": -32005,
"message": "Node is behind by 42 slots",
"data": { "numSlotsBehind": 42 }
},
"id": 1
}
Returns whether this RPC node is healthy. The node reports healthy when it is within the configured slot distance of the cluster tip.
curl https://api.devnet.solana.com -s -X POST \
-H "Content-Type: application/json" \
-d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getHealth"
}
'
import { createSolanaRpc } from "@solana/kit";
const rpc_url = "https://api.devnet.solana.com";
const rpc = createSolanaRpc(rpc_url);
let health = await rpc.getHealth().send();
console.log(health);
use anyhow::Result;
use solana_client::nonblocking::rpc_client::RpcClient;
use solana_commitment_config::CommitmentConfig;
#[tokio::main]
async fn main() -> Result<()> {
let client = RpcClient::new_with_commitment(
String::from("https://api.devnet.solana.com"),
CommitmentConfig::confirmed(),
);
let health = client.get_health().await?;
println!("{:#?}", health);
Ok(())
}
{
"jsonrpc": "2.0",
"result": "ok",
"id": 1
}
{
"jsonrpc": "2.0",
"error": {
"code": -32005,
"message": "Node is behind by 42 slots",
"data": { "numSlotsBehind": 42 }
},
"id": 1
}
get_health"ok" when the node is healthy.