getSlotLeaders
Learn about getSlotLeaders—including its use cases, code examples, request parameters, response structure, and helpful tips.
The getSlotLeaders
RPC method in CoinVera allows you to retrieve a list of validator public keys scheduled to produce blocks for a specific range of slots. This method is helpful when analyzing or predicting short-term leader activity on the Solana network.
✅ Common Use Cases
Predicting Near-Term Block Producers Identify which validators are expected to lead block production in upcoming slots.
Analyzing Leader Distribution Examine how leadership is distributed across a segment of an epoch.
Network Monitoring & Analysis Tools that track validator activity or block propagation can use this method to understand validator participation in upcoming slots.
🧾 Request Parameters
startSlot
(u64
) – Required The first slot (inclusive) from which to begin fetching leader assignments.limit
(u64
) – Required The number of consecutive slot leaders to return (must be between 1 and 5,000).
📦 Response Structure
Returns an array of base-58 encoded public keys, one for each slot in the requested range, in order.
{
"result": [
"5Y6g8zWcR9GVoHqGnBbPmgzUdu1tHuCVDRKLv7fP5Xed",
"2ABgfX2pRzAGhLkYwPYTeJNXREtxNUb1mC17hCwF41hD",
...
]
}
Each public key corresponds to the validator scheduled to produce a block for that slot.
🧪 Example
Get Slot Leaders for a Specific Range
Fetches leaders for the next 5 slots starting at a specified slot number.
{
"jsonrpc": "2.0",
"id": 1,
"method": "getSlotLeaders",
"params": [
180000000,
5
]
}
Code Examples
const fetch = require('node-fetch');
async function getSlotLeaders(rpcUrl) {
try {
const response = await fetch(rpcUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'getSlotLeaders',
"params": [
355104000,
5
]
}),
});
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';
getSlotLeaders(RPC_URL);
Example Response
{
"jsonrpc": "2.0",
"result": [
"vu1sGn2f1Xim6voHNLt4nLn38zNkYdLasU7hEr1TC2D",
"vu1sGn2f1Xim6voHNLt4nLn38zNkYdLasU7hEr1TC2D",
"vu1sGn2f1Xim6voHNLt4nLn38zNkYdLasU7hEr1TC2D",
"vu1sGn2f1Xim6voHNLt4nLn38zNkYdLasU7hEr1TC2D",
"simpRo1FrQYGa1moicfgnPDp6KyE38d4gYrZzhjXYJb"
],
"id": 1
}
💡 Developer Tips
Limit Parameter You can retrieve up to 5,000 slot leaders in one request, which allows insight into a sizable segment of the leader schedule within an epoch.
Epoch Boundaries The schedule is fixed per epoch. If your requested range crosses into a new epoch, only slots from the current epoch (where
startSlot
resides) will be returned—up to thelimit
or the end of the schedule, depending on node configuration.Supports Future Slot Lookups You can query upcoming (future) slots. The RPC node uses the current leader schedule to project future leaders.
High Accuracy Since the leader schedule is deterministic and set at the beginning of an epoch, returned values are reliable unless major network events occur.
Difference from
getLeaderSchedule
getSlotLeaders
: Returns a flat, ordered list of leader public keys for a specific slot range.getLeaderSchedule
: Returns the full epoch schedule, mapping each validator to all slots they're scheduled to lead.
Use getSlotLeaders
when you need a concise, sequential list of upcoming block producers for a well-defined slot range—ideal for validator analysis, staking dashboards, or block propagation modeling.
Last updated