TriportRPC

getSlotLeader

POSThttps://api.triport.io/v1/sol

Returns the identity public key of the validator that leads the current slot.

Solanasol_read_rpcfree+ · 20 / 60 / 200 / 600 rps (free / basic / pro / business)

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.

configobjectoptional
Configuration object (see fields below). Omit it entirely for defaults.
config.commitmentstringoptional
Commitment level for the query: processed, confirmed, or finalized. Defaults to finalized.
config.minContextSlotinteger (u64)optional
The minimum slot at which the request may be evaluated.

Response

Response fields

FieldTypeDescription
jsonrpcstringAlways "2.0".
idstring | integerEchoes the id from the request, for correlating responses.
resultstring (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).

CodeTriport codeWhen it happens
-32602invalid_paramsThe config object contains an unknown field or a malformed value (e.g. an invalid commitment enum value).
-32002tier_insufficientThe API key's tier is below the minimum for this method (not expected here — getSlotLeader is free+).
-32003rate_limitedYou 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)  # ENJ7iD7BsFrFzaXTrbAVbDYZ12Z4BuRMpfGd3GPnaQbm

Notes

  • commitment defaults to finalized when omitted; pass processed for 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.
  • id may be any client-chosen string or integer; it is echoed back so you can correlate responses.
  • This is a sol_read_rpc method 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.