getLeaderSchedule
https://api.triport.io/v1/solReturns the leader schedule for an epoch — which slots each validator is assigned to produce blocks in.
getLeaderSchedule returns the leader schedule for an epoch: a map keyed by
validator identity pubkey, where each value is the array of slot indices
(relative to the start of the epoch) that the validator is assigned to lead.
This is the canonical way to know, ahead of time, which validator will be the
leader for a given slot — useful for transaction-routing optimizations, leader
forecasting, and validator-performance dashboards.
The slot indices are epoch-relative: index 0 is the first slot of the
epoch. To convert an index into an absolute slot, add it to the epoch's first
slot (use getEpochInfo /
getEpochSchedule to find epoch boundaries).
By default the call returns the schedule for the epoch that contains the current
slot. Pass an optional slot to query the epoch containing that slot, and an
optional config to set a commitment level or to filter the result to a single
validator via identity. If the requested slot does not correspond to a known
epoch, the result is null.
Parameters
JSON-RPC params is a positional array: [slot?, config?]. Both elements are
optional — pass [] to get the schedule for the current epoch.
slotintegeroptionalconfigobjectoptionalcommitmentstringoptionalprocessed, confirmed, or finalized.identitystring (base-58)optional^[1-9A-HJ-NP-Za-km-z]{32,44}$.Response
When the requested slot belongs to no known epoch, result is null:
{
"jsonrpc": "2.0",
"id": 1,
"result": null
}resultobject | nullLeaderSchedule map, or null if the epoch is not found.result.<pubkey>array of integersErrors
Errors are returned in the standard JSON-RPC error envelope. See the shared errors reference for the full envelope shape and shared codes.
| Code | Meaning | When it happens |
|---|---|---|
-32602 | Invalid params | slot is not an integer, or identity is not a valid base-58 pubkey. |
401 | Unauthorized | Missing or invalid Authorization: Bearer key. |
429 | Rate limited | More than your tier's RPS for sol_read_rpc (20 / 60 / 200 / 600). |
Note: a slot that does not map to a known epoch is not an error — it returns
result: null. Always null-check the result.
Examples
JavaScript (fetch)
const res = await fetch("https://api.triport.io/v1/sol", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.TRIPORT_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
jsonrpc: "2.0",
id: 1,
method: "getLeaderSchedule",
params: [null, { identity: "Awes4Tr6TX8JDzEhCZY2QVNimT6iD1zWHzf1vNyGvpLM" }],
}),
});
const { result } = await res.json();
if (result === null) {
console.log("epoch not found");
} else {
for (const [pubkey, slots] of Object.entries(result)) {
console.log(`${pubkey} leads ${slots.length} slots this epoch`);
}
}TypeScript SDK (@triport/sdk)
import { TriportClient } from "@triport/sdk";
const client = new TriportClient({ apiKey: process.env.TRIPORT_API_KEY });
const schedule = await client.solana.getLeaderSchedule({
identity: "Awes4Tr6TX8JDzEhCZY2QVNimT6iD1zWHzf1vNyGvpLM",
commitment: "finalized",
});
if (schedule === null) {
console.log("epoch not found");
} else {
for (const [pubkey, slots] of Object.entries(schedule)) {
console.log(`${pubkey}: ${slots.length} leader slots`);
}
}Python (triport-sdk)
import os
from triport import TriportClient
client = TriportClient(api_key=os.environ["TRIPORT_API_KEY"])
schedule = client.solana.get_leader_schedule(
identity="Awes4Tr6TX8JDzEhCZY2QVNimT6iD1zWHzf1vNyGvpLM",
commitment="finalized",
)
if schedule is None:
print("epoch not found")
else:
for pubkey, slots in schedule.items():
print(f"{pubkey}: {len(slots)} leader slots")Notes
- Epoch-relative indices: the integers in each array are offsets from the
first slot of the epoch, not absolute slot numbers. Add the epoch's first slot
(from
getEpochInfo) to get an absolute slot. - Current epoch by default: omit
slot(or passnull) to get the schedule for the epoch containing the current slot. - Filter early: pass
identityto return only one validator's slots instead of the full cluster map — far smaller responses for per-validator views. - Null on unknown epoch: a
slotoutside any known epoch yieldsresult: nullrather than an error — always null-check before iterating. - Related methods:
getEpochInfoandgetEpochSchedulefor epoch boundaries;getBlockProductionto see how many assigned slots a validator actually produced.