getSlotLeaders
Returns the slot leaders for a given slot range. Each entry in the returned array corresponds to the validator identity scheduled to be the leader for that slot. This method is useful for predicting upcoming leaders, optimizing transaction submission timing, and building leader schedule visualizations. The range is limited to a maximum of 5,000 slots.
Parameters
| # | Type | Required | Description |
|---|---|---|---|
| 1 | u64 | Yes | Start slot |
| 2 | u64 | Yes | Number of slots to return leaders for (1-5000) |
Response
Returns an array:
| Field | Type | Description |
|---|---|---|
result | array[string] | Array of base-58 encoded validator identity public keys, one per slot |
Code Examples
cURL
1curl http://[IP_ADDRESS]:[PORT] -X POST -H "Content-Type: application/json" -d '{
2 "jsonrpc": "2.0",
3 "id": 1,
4 "method": "getSlotLeaders",
5 "params": [
6 166974442, 10
7 ]
8}'TypeScript
1const response = await fetch("http://[IP_ADDRESS]:[PORT]", {
2 method: "POST",
3 headers: { "Content-Type": "application/json" },
4 body: JSON.stringify({
5 jsonrpc: "2.0",
6 id: 1,
7 method: "getSlotLeaders",
8 params: [
9 166974442, 10
10 ]
11 }),
12});
13const { result } = await response.json();
14console.log("Leaders:", result.length, "slots");Python
1import requests
2
3response = requests.post("http://[IP_ADDRESS]:[PORT]", json={
4 "jsonrpc": "2.0",
5 "id": 1,
6 "method": "getSlotLeaders",
7 "params": [
8 166974442, 10
9 ]
10})
11result = response.json()["result"]
12print(f"Leaders: {len(result)} slots")Rust
1use reqwest::Client;
2use serde_json::json;
3
4#[tokio::main]
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6 let client = Client::new();
7 let res = client.post("http://[IP_ADDRESS]:[PORT]")
8 .json(&json!({
9 "jsonrpc": "2.0",
10 "id": 1,
11 "method": "getSlotLeaders",
12 "params": [
13 166974442_u64, 10_u64
14 ]
15 }))
16 .send().await?
17 .text().await?;
18 println!("{}", res);
19 Ok(())
20}Example Response
1{
2 "jsonrpc": "2.0",
3 "result": [
4 "ChorusmmC7UypFMn6WKLH2jxEpPhRFY7XhrmYYMRxuPA",
5 "ChorusmmC7UypFMn6WKLH2jxEpPhRFY7XhrmYYMRxuPA",
6 "ChorusmmC7UypFMn6WKLH2jxEpPhRFY7XhrmYYMRxuPA",
7 "Certusm1sa411sMpV9FPqU5dXAYhmmhygvxJ23S6hJ24",
8 "Certusm1sa411sMpV9FPqU5dXAYhmmhygvxJ23S6hJ24"
9 ],
10 "id": 1
11}