Blocks & Slots
getSlotLeaders
Returns the slot leaders for a given range
Parameters
Start slot number
Number of slot leaders to return
Response
Array of slot leader public keys (base-58 encoded)
Code Examples
Basic Request
Using web3.js
Notes
- Returns the slot leaders for a given range of slots
- The slot leaders are responsible for producing blocks
- The response is immediate as it reads from the current state
- The slot leaders are determined by the network’s leader schedule
- The range must be within the current epoch
Best Practices
- Use appropriate start slot and limit based on your needs
- Cache results when appropriate to reduce RPC load
- Monitor for changes in the leader schedule
- Consider using websocket subscription for real-time updates
- Handle network errors and retry when appropriate
Common Errors
Code | Message | Solution |
---|---|---|
-32601 | Method not found | Verify you’re connected to a Solana RPC node |
-32602 | Invalid params | Check startSlot and limit parameters |
-32007 | Slot leader information unavailable | Node may be bootstrapping or syncing |
Use Cases
-
Leader Schedule Analysis
-
Leader Schedule Monitoring
-
Leader Schedule Planning