getLeaderSchedule
Returns the leader schedule for an epoch. The leader schedule determines which validator is responsible for producing blocks in each slot. This is critical for MEV strategies, transaction timing optimization, validator monitoring, and understanding when a specific validator will next be the leader. Returns a map of validator identities to their assigned slot indices.
Parameters
| # | Type | Required | Description |
|---|---|---|---|
| 1 | `u64 | null` | No |
| 2 | object | No | Configuration object |
Configuration object fields:
| Field | Type | Description |
|---|---|---|
commitment | string | Commitment level: processed, confirmed, or finalized |
identity | string | Only return results for this validator identity (base-58) |
Response
Returns null if the requested epoch is not available. Otherwise a map:
| Field | Type | Description |
|---|---|---|
result | `object | null` |
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": "getLeaderSchedule",
5 "params": [
6 null,
7 { "identity": "dv1ZAGvdsz5hHLwWXsVnM94hWf1pjbKVau1QVkaMJ92" }
8 ]
9}'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: "getLeaderSchedule",
8 params: [
9 null,
10 { identity: "dv1ZAGvdsz5hHLwWXsVnM94hWf1pjbKVau1QVkaMJ92" }
11 ]
12 }),
13});
14const { result } = await response.json();
15Object.entries(result).forEach(([k, v]) => console.log(k, "slots:", v.length));Python
1import requests
2
3response = requests.post("http://[IP_ADDRESS]:[PORT]", json={
4 "jsonrpc": "2.0",
5 "id": 1,
6 "method": "getLeaderSchedule",
7 "params": [
8 None,
9 {"identity": "dv1ZAGvdsz5hHLwWXsVnM94hWf1pjbKVau1QVkaMJ92"}
10 ]
11})
12result = response.json()["result"]
13for k, v in result.items(): print(f"{k}: {len(v)} 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": "getLeaderSchedule",
12 "params": [
13 null,
14 {"identity": "dv1ZAGvdsz5hHLwWXsVnM94hWf1pjbKVau1QVkaMJ92"}
15 ]
16 }))
17 .send().await?
18 .text().await?;
19 println!("{}", res);
20 Ok(())
21}Example Response
1{
2 "jsonrpc": "2.0",
3 "result": {
4 "dv1ZAGvdsz5hHLwWXsVnM94hWf1pjbKVau1QVkaMJ92": [0, 1, 2, 3, 4, 5, 6, 7]
5 },
6 "id": 1
7}