getSlotLeader
https://api.triport.io/v1/solReturns the identity public key of the validator that leads the current slot.
getSlotLeader returns a single Pubkey — the base-58 encoded identity public
key of the validator scheduled to produce the block for the slot currently being
processed by the node.
Use it for a quick, point-in-time answer to "who is leader right now?" — for example to label live transaction routing or to surface the active validator in a dashboard. The result reflects the slot resolved at the requested commitment level, so it tracks the leader as the cluster advances.
To look up leaders for a range of upcoming slots rather than just the
current one, use getSlotLeaders, or fetch the full
epoch schedule with getLeaderSchedule.
All Solana JSON-RPC methods POST to the same base path /v1/sol; the method
field in the request body selects the call.
Parameters
The single positional parameter is an optional config object.
configobjectoptionalconfig.commitmentstringoptionalprocessed, confirmed, or finalized. Defaults to finalized.config.minContextSlotinteger (u64)optionalResponse
Response fields
| Field | Type | Description |
|---|---|---|
jsonrpc | string | Always "2.0". |
id | string | integer | Echoes the id from the request, for correlating responses. |
result | string (Pubkey) | Base-58 encoded identity public key of the current slot leader (32–44 chars). |
Errors
Errors arrive in the standard JSON-RPC error object (code, message,
data).
| Code | Triport code | When it happens |
|---|---|---|
-32602 | invalid_params | The config object contains an unknown field or a malformed value (e.g. an invalid commitment enum value). |
-32002 | tier_insufficient | The API key's tier is below the minimum for this method (not expected here — getSlotLeader is free+). |
-32003 | rate_limited | You exceeded your tier's sustained RPS for sol_read_rpc; honour Retry-After / data.retry_after_sec. |
See the shared errors reference for the full envelope, the
data fields, and the HTTP ↔ JSON-RPC wire-code mapping.
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: "getSlotLeader",
params: [{ commitment: "finalized" }],
}),
});
const { result: leader } = await res.json();
console.log(leader); // "ENJ7iD7BsFrFzaXTrbAVbDYZ12Z4BuRMpfGd3GPnaQbm"TypeScript SDK (@triport/sdk)
import { TriportClient } from "@triport/sdk";
const client = new TriportClient({ apiKey: process.env.TRIPORT_API_KEY });
const leader = await client.sol.getSlotLeader({ commitment: "finalized" });
console.log(leader); // "ENJ7iD7BsFrFzaXTrbAVbDYZ12Z4BuRMpfGd3GPnaQbm"Python (triport-sdk)
import os
from triport import TriportClient
client = TriportClient(api_key=os.environ["TRIPORT_API_KEY"])
leader = client.sol.get_slot_leader(commitment="finalized")
print(leader) # ENJ7iD7BsFrFzaXTrbAVbDYZ12Z4BuRMpfGd3GPnaQbmNotes
commitmentdefaults tofinalizedwhen omitted; passprocessedfor the most up-to-date (but least settled) view of the current leader.- The leader changes as the cluster advances — each leader produces a fixed run of consecutive slots — so the value is only accurate for the moment it was observed. For forward-looking lookups use a range method instead.
idmay be any client-chosen string or integer; it is echoed back so you can correlate responses.- This is a
sol_read_rpcmethod available from the free tier; throughput scales with your plan (20 → 600 rps) with burst allowance. There is no daily quota. - Related:
getSlotLeaders,getLeaderSchedule,getSlot.