getSlotLeaders
https://api.triport.io/solReturns the ordered list of slot leaders (validator identity pubkeys) for a contiguous range of slots.
getSlotLeaders returns the validator that is scheduled to produce each slot
over a window of the leader schedule. Given a startSlot and a limit, it
returns an ordered array of base-58 validator identity public keys: element 0
is the leader of startSlot, element 1 of startSlot + 1, and so on.
Use it to predict which validator will produce upcoming slots — for example to route a transaction toward the next leader's TPU, to attribute confirmed slots to a validator, or to render an upcoming leader schedule. Because Solana assigns leaders in fixed-size groups of consecutive slots, you will typically see the same pubkey repeated for several entries in a row.
The window must fall within the leader schedule the cluster currently knows
about (the current and next epoch). Requesting a startSlot too far in the
future, or a limit outside the 1–5000 range, returns an invalid-params
error rather than a partial list.
Parameters
Positional params array: [startSlot, limit]. Both are required.
startSlotinteger (u64 slot number)required0 of the result is this slot's leader.limitintegerrequired1 and 5000 inclusive.Response
Response fields
| Field | Type | Description |
|---|---|---|
result | array of string | Ordered list of base-58 validator identity pubkeys. Length equals limit. result[i] is the leader of slot startSlot + i. |
Errors
| Code | Meaning | When it happens |
|---|---|---|
-32602 | Invalid params | limit is outside 1–5000, startSlot is negative, or a param is missing/wrong type. |
-32003 | Rate limit exceeded | You exceeded your tier's sol_read_rpc RPS (e.g. 20 rps sustained on free). Retry after Retry-After. |
-32601 | Method not found | The method name was misspelled or sent to the wrong chain path. |
Example rate-limit envelope (HTTP 429):
{
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32003,
"message": "Rate limit exceeded: 20 RPS sustained on sol_read_rpc (free tier)",
"data": {
"current_tier": "free",
"category": "sol_read_rpc",
"limit_rps": 20,
"burst_capacity": 40,
"retry_after_sec": 1
}
}
}See errors.md for the full error envelope and the complete code list.
Examples
JavaScript (fetch)
const res = await fetch("https://api.triport.io/sol", {
method: "POST",
headers: {
"x-token": process.env.TRIPORT_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
jsonrpc: "2.0",
id: 1,
method: "getSlotLeaders",
params: [348392041, 10],
}),
});
const { result } = await res.json();
console.log(result); // ["DWvDTSh3...", "DWvDTSh3...", ...]TypeScript SDK (@triport/sdk)
import { TriportClient } from "@triport/sdk";
const client = new TriportClient({ apiKey: process.env.TRIPORT_API_KEY! });
const leaders: string[] = await client.solana.getSlotLeaders({
startSlot: 348392041,
limit: 10,
});
console.log(leaders[0]); // leader of slot 348392041Python (triport-sdk)
import os
from triport import TriportClient
client = TriportClient(api_key=os.environ["TRIPORT_API_KEY"])
leaders = client.solana.get_slot_leaders(start_slot=348392041, limit=10)
print(leaders[0]) # leader of slot 348392041Notes
- Range cap:
limitis hard-capped at5000. To cover a wider window, page forward by advancingstartSlotby the previouslimit. - Repeated entries are expected: leaders are assigned in groups of consecutive slots, so the same pubkey commonly appears multiple times in a row.
- Schedule horizon: queries outside the currently-known leader schedule
(roughly the current and next epoch) fail with
-32602rather than returning a truncated list. - Related methods:
getSlotfor the current slot,getBlockProductionfor which leaders actually produced blocks. See getting-started.md for auth and chain-path basics and rate-limits-and-tiers.md for per-tier RPS.