getSlotLeader
Returns the current slot leader
Common use cases
| Identifying Block Producers for Transaction Routing | Applications use getSlotLeader to identify which validator is currently producing blocks, enabling optimized transaction routing by sending transactions directly to the active leader's TPU endpoint for faster confirmation times. |
| Monitoring Leader Transitions for Network Analysis | Network monitoring tools and analytics platforms track slot leaders across epochs to analyze validator participation, detect leader schedule patterns, and measure block production performance metrics across the network. |
| Verifying Leader Schedule Correctness | Validators and infrastructure operators query the current slot leader to verify their local leader schedule computation matches the network consensus, ensuring proper block production coordination during epoch transitions. |
Parameters
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.minContextSlot(number): The minimum slot that the request can be evaluated at
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": "getSlotLeader",
"params": [
{
"commitment": "finalized"
}
]
}'
// 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": "getSlotLeader",
"params": [
{
"commitment": "finalized"
}
]
})
});
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": "getSlotLeader",
"params": [
{
"commitment": "finalized"
}
]
}
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": "ENvAW7JScgYq6o4zKZwewtkzzJgDzuJAFxYasvmEQdpS",
"id": 1
}
Response Fields
Return value: string
Node identity Pubkey as base-58 encoded string
FAQ and Troubleshooting
How often does the slot leader change?
The slot leader changes every slot (approximately 400ms). Each validator is assigned multiple consecutive slots during their scheduled leader periods within an epoch.
Can I predict future slot leaders?
Yes, use getSlotLeaders to fetch the leader schedule for a range of future slots. The schedule is deterministic and computed at the start of each epoch based on validator stake weights.
Why does getSlotLeader return a pubkey instead of full validator info?
The method returns only the validator's identity pubkey for efficiency. Use getClusterNodes to resolve the pubkey to full connection details (IP, ports, TPU endpoints) if needed for direct communication.
Related Methods
getSlot
Returns the current slot number, essential for determining which slot to query for its leader
getSlotLeaders
Fetches leader schedule for a range of slots, useful for predicting future leaders and batch processing
getClusterNodes
Provides full validator connection info (TPU endpoints) needed after identifying the slot leader for direct transaction routing
getEpochInfo
Returns epoch timing details including slots per epoch, helpful for understanding leader schedule rotation periods
External Resources
- Solana Official Documentation
- Solana Architecture: Leader Rotation - Official documentation explaining how validators rotate as slot leaders and the leader schedule computation algorithm