getLeaderSchedule
Returns the leader schedule for an epoch
Common use cases
| Filtering Leader Schedule by Validator Identity | Applications filter the leader schedule to find specific slots when a target validator is scheduled to produce blocks. This supports validator monitoring dashboards, stake pool operators tracking validator performance, and infrastructure tools that need to know when their validator will be active during an epoch. |
| Calculating Validator Rewards and Fees | Validator operators use getLeaderSchedule to identify all slots when their validator was scheduled as leader, then query getBlock for each slot to aggregate transaction fees and block rewards earned during the epoch. This workflow enables accurate reward calculations and performance analysis. |
| Pre-computing Leader Schedule for Transaction Routing | Transaction relay services fetch the leader schedule in advance (often combined with getClusterNodes for TPU endpoints) to maintain a map of upcoming block producers. This enables optimized transaction forwarding by routing transactions to validators just before their leader slots for faster inclusion. |
Parameters
slot number (u64, optional)
Fetch the leader schedule for the epoch that corresponds to the provided slot. If unspecified, the leader schedule for the current epoch is fetched.
config (object, optional)
Configuration object containing the following fields:
Fields:
commitment(string): The commitment describes how finalized a block is at that point in time. See Configuring State Commitment.identity(string): Only return results for this validator identity (base-58 encoded)
Request
- cURL
- JavaScript
- Python
curl https://solana-mainnet.api.syndica.io/api-key/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getLeaderSchedule",
"params": [
null,
{
"commitment": "processed",
"identity": "dv2eQHeP4RFrJZ6UeiZWoc3XTtmtZCUKxxCApCDcRNV"
}
]
}'
// Using fetch
const response = await fetch('https://solana-mainnet.api.syndica.io/api-key/YOUR_API_KEY', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
"jsonrpc": "2.0",
"id": 1,
"method": "getLeaderSchedule",
"params": [
null,
{
"commitment": "processed",
"identity": "dv2eQHeP4RFrJZ6UeiZWoc3XTtmtZCUKxxCApCDcRNV"
}
]
})
});
const data = await response.json();
console.log(data);
import requests
import json
url = 'https://solana-mainnet.api.syndica.io/api-key/YOUR_API_KEY'
headers = {'Content-Type': 'application/json'}
data = {
"jsonrpc": "2.0",
"id": 1,
"method": "getLeaderSchedule",
"params": [
null,
{
"commitment": "processed",
"identity": "dv2eQHeP4RFrJZ6UeiZWoc3XTtmtZCUKxxCApCDcRNV"
}
]
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
Replace mainnet with devnet in the URL to query devnet instead.
Response
{
"jsonrpc": "2.0",
"result": {
"4Qkev8aNZcqFNSRhQzwyLMFSsi94jHqE8WNVTJzTP99F": [
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
57, 58, 59, 60, 61, 62, 63
]
},
"id": 1
}
Response Fields
Return value: object | null
Returns null if requested epoch is not found, otherwise returns an object where: - Keys are validator identities (as base-58 encoded strings) - Values are arrays of leader slot indices relative to the first slot in the requested epoch
FAQ and Troubleshooting
Why doesn't @solana/web3.js getLeaderSchedule accept parameters?
The legacy @solana/web3.js SDK has limited parameter support for getLeaderSchedule. To pass identity filtering parameters, either use the newer @solana/kit library which supports full RPC parameter structure, or make raw RPC calls directly to the endpoint. The RPC method itself supports both slot and identity parameters via the config object.
How do I calculate the transaction fees earned by my validator?
Use getLeaderSchedule with your validator's identity to get all slots when your validator was the leader. Then for each slot, call getBlock with rewards included to retrieve transaction fee data. Sum the fee rewards across all your leader slots to calculate total earnings for the epoch.
Why does getLeaderSchedule return null for my epoch?
getLeaderSchedule returns null if: 1) The epoch hasn't started yet (leader schedule isn't computed until epoch boundary), 2) The requested epoch is too far in the past and data has been purged, or 3) The node hasn't fully synced the epoch data. Query getEpochInfo to verify current epoch, and ensure you're querying for epochs within the node's available data range.
Related Methods
getSlotLeaders
Returns an array of slot leaders for a contiguous range of slots. Use getSlotLeaders when you need sequential leader information for slot-by-slot processing, while getLeaderSchedule is better for filtering by validator identity or viewing epoch-wide validator assignments.
getClusterNodes
Provides network contact information (TPU endpoints, gossip addresses) for all cluster validators. Combine with getLeaderSchedule to build leader maps with network endpoints, enabling transaction forwarding directly to upcoming block producers.
getEpochInfo
Returns current epoch number, slot index, and epoch timing information. Use with getLeaderSchedule to determine which epoch to query and calculate remaining slots in the current epoch's schedule.
getBlock
Retrieves full block data including transactions and rewards for a specific slot. Use after getLeaderSchedule to fetch block details for slots when a target validator was the leader, enabling reward calculations and performance analysis.
getSlotLeader
Returns the validator identity for the current slot leader. Use getSlotLeader for real-time leader queries, while getLeaderSchedule provides epoch-wide schedule data for planning and analysis.
External Resources
- Solana Official Documentation
- Solana Leader Rotation | Agave - Official documentation explaining Solana's leader schedule algorithm, epoch-based rotation mechanics, and how validators compute and use leader schedules. Provides technical context for leader schedule generation and rotation patterns.