getHealth – Solana
The getHealth JSON-RPC method retrieves the current health status of a Solana node.
The getHealth RPC Solana method checks if a node is within HEALTH_CHECK_SLOT_DISTANCE slots of the latest confirmed cluster slot. If the node is healthy, it returns an "ok" response; otherwise, it returns a JSON-RPC error.
This method is crucial for network monitoring, validator operations, and infrastructure management. If the node is behind, the error response may include additional details, such as the number of slots behind.
Supported Networks
This method is accessible through Solana API endpoints:
Mainnet
Devnet
Parameters
This method does not require any parameters.
Request Example
API Endpoints
cURL Example
Response
A successful getHealth example response returns the health status of the node.
Healthy Response
Unhealthy Response (with additional information)
Error Handling
Common getHealth error scenarios:
Node out of sync: The node is lagging behind the latest cluster-confirmed slot.
Network connectivity issues: The request fails due to API unavailability.
Ambiguous method calls: In some cases, errors like the method getHealth() is ambiguous for the type player may occur in custom implementations, requiring method resolution.
Use Cases
The Solana getHealth method is essential for:
Validators: Monitoring node synchronization and performance.
Blockchain explorers: Displaying node health status.
Web3 applications: Ensuring nodes are in sync before submitting transactions.
Infrastructure management: Detecting unhealthy nodes for maintenance and debugging.
Code Example – Web3 getHealth Integration
Integration with Web3
Integrate the getHealth API with Solana’s Core API to monitor node health dynamically. By leveraging JSON-RPC parameters and endpoints, developers can ensure real-time tracking of node synchronization, detect unhealthy nodes, and optimize blockchain infrastructure for dApps and validators.
Last updated