Blocks & Slots
getSlotLeader
Returns the current slot leader
Parameters
Response
Public key of the current slot leader (base-58 encoded)
Code Examples
Basic Request
Request with Commitment
Using web3.js
Notes
- Returns the public key of the current slot leader
- The slot leader is responsible for producing the next block
- Different commitment levels can be specified
- The response is immediate as it reads from the current state
- The slot leader changes based on the network’s leader schedule
Best Practices
- Cache the slot leader when appropriate
- Consider using websocket subscription for real-time updates
- Handle network errors and retry when appropriate
- Use appropriate commitment level based on your needs
- Monitor slot leader changes for network analysis
Common Errors
Code | Message | Solution |
---|---|---|
-32601 | Method not found | Verify you’re connected to a Solana RPC node |
-32602 | Invalid params | Check config parameters |
-32007 | Slot leader information unavailable | Node may be bootstrapping or syncing |
Use Cases
-
Slot Leader Monitoring
-
Slot Leader Analysis
-
Slot Leader Tracking