getHighestSnapshotSlot
Learn getHighestSnapshotSlot use cases, code examples, request parameters, response structure, and tips.
The getHighestSnapshotSlot
RPC method provides details about the most recent ledger snapshots stored by a Solana RPC node. It includes both the highest full snapshot and the latest incremental snapshot (if available), which are critical for fast node startup and ledger synchronization.
Version Note: Available in
solana-core v1.9+
. For versions β€ v1.8, use the deprecatedgetSnapshotSlot
method.
β
Common Use Cases
Monitor Snapshot Generation Check how up-to-date a node is in generating snapshots used for bootstrapping and syncing.
Analyze Node Health Use snapshot information to understand whether the node is keeping pace with the cluster or falling behind.
Debug Syncing Issues Compare full and incremental snapshot slots to troubleshoot delayed snapshot generation or restoration problems.
π Request Parameters
This method does not accept any parameters.
π¦ Response Structure
The result
field returns an object:
{
"full": 185000000,
"incremental": 185050000
}
full
u64
The highest slot at which a full snapshot is available.
incremental
u64 | null
The highest slot at which an incremental snapshot exists (based on the full snapshot). Can be null
if incremental snapshotting is disabled or unavailable.
If the node has no snapshots at all, the behavior may vary by provider (e.g., returning null
, an empty object, or an error).
π‘ Example: Fetch Highest Snapshot Slot
{
"jsonrpc": "2.0",
"id": 1,
"method": "getHighestSnapshotSlot"
}
Code Examples
const fetch = require('node-fetch');
async function getHighestSnapshotSlot(rpcUrl) {
try {
const response = await fetch(rpcUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'getHighestSnapshotSlot'
}),
});
const data = await response.json();
// Print the exact full response
console.log('Full RPC Response:');
console.log(JSON.stringify(data, null, 2));
return data;
} catch (error) {
console.error('Error getting health:', error.message);
return null;
}
}
// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';
getHighestSnapshotSlot(RPC_URL);
Example Response
{
"jsonrpc": "2.0",
"result": {
"full": 353404518,
"incremental": 353413622
},
"id": 1
}
π§ Developer Tips
Snapshot Data Is Node-Specific Snapshot availability depends on each nodeβs configuration. Archival or high-availability nodes may generate snapshots more frequently than lightweight ones.
Snapshot Progression Expect
full
andincremental
snapshot slots to increase as the node progresses through epochs. If these values remain static, the node may not be generating new snapshots correctly.Full vs. Incremental Snapshots
Full Snapshot: Contains the complete state of the ledger at a given slot.
Incremental Snapshot: Captures state changes since the most recent full snapshot. Smaller and faster to create, but dependent on the base full snapshot.
Use in Automation and Alerting Monitor these values in scripts or infrastructure dashboards to ensure snapshot generation is healthy and up to date.
Version Compatibility Ensure your node or RPC provider supports Solana v1.9+ to use this method. Older nodes will not respond to this RPC call.
Last updated