TriportRPC

getEpochInfo

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

Returns information about the current epoch on the Solana cluster.

Solanasol_read_rpcfree+ — 20 / 60 / 200 / 600 RPS (free / basic / pro / business)

getEpochInfo returns a snapshot of the cluster's current epoch: which epoch is active, how far through it the cluster is, and the related slot and block heights. Use it to display network progress, estimate time until the next epoch boundary, or as a lightweight liveness probe that also reports the node's current absoluteSlot and blockHeight.

slotIndex is the cluster's position within the current epoch, while slotsInEpoch is that epoch's total length — so slotsInEpoch - slotIndex slots remain before the epoch rolls over. absoluteSlot is the slot count since genesis (it keeps climbing across epochs), and blockHeight is the number of confirmed blocks beneath the current one.

The reading is taken relative to a slot governed by the optional commitment config. Pass minContextSlot to require that the serving node has already reached at least a given slot before it answers.

Parameters

JSON-RPC params is a positional array: [config?]. The single argument is optional — omit it (send params: []) to use the node defaults.

configobjectoptional
Optional configuration object (see below).
commitmentstringoptional
Commitment level: processed, confirmed, or finalized.
minContextSlotintegeroptional
Minimum slot the request must be evaluated at.

Response

Response fields

FieldTypeDescription
resultobjectEpochInfo object.
result.epochintegerThe current epoch number.
result.slotIndexintegerThe cluster's slot position relative to the start of the current epoch.
result.slotsInEpochintegerThe total number of slots in the current epoch.
result.absoluteSlotintegerThe current slot, counted from genesis.
result.blockHeightintegerThe number of confirmed blocks beneath the current block.
result.transactionCountintegerThe total number of transactions processed by the cluster since genesis.

Errors

Errors are returned in the standard JSON-RPC error envelope. See the shared errors reference for the full envelope shape and shared codes.

CodeMeaningWhen it happens
-32602Invalid paramsconfig is malformed (e.g. an unknown commitment value).
401UnauthorizedMissing or invalid Authorization: Bearer key.
429Rate limitedMore than your tier's RPS for sol_read_rpc (20 / 60 / 200 / 600).

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: "getEpochInfo",
    params: [],
  }),
});


const { result } = await res.json();
const remaining = result.slotsInEpoch - result.slotIndex;
console.log(`Epoch ${result.epoch}: ${remaining} slots remaining`);

TypeScript SDK (@triport/sdk)

import { TriportClient } from "@triport/sdk";


const client = new TriportClient({ apiKey: process.env.TRIPORT_API_KEY });


const info = await client.solana.getEpochInfo({ commitment: "finalized" });


const remaining = info.slotsInEpoch - info.slotIndex;
console.log(`Epoch ${info.epoch}: ${remaining} slots remaining (slot ${info.absoluteSlot})`);

Python (triport-sdk)

import os
from triport import TriportClient


client = TriportClient(api_key=os.environ["TRIPORT_API_KEY"])


info = client.solana.get_epoch_info(commitment="finalized")


remaining = info["slotsInEpoch"] - info["slotIndex"]
print(f"Epoch {info['epoch']}: {remaining} slots remaining (slot {info['absoluteSlot']})")

Notes

  • Slots remaining: slotsInEpoch - slotIndex gives the slots left in the current epoch. At roughly 400 ms per slot you can estimate the time to the next epoch boundary.
  • absoluteSlot vs slotIndex: absoluteSlot is monotonic since genesis and never resets; slotIndex resets to 0 at each epoch boundary.
  • Commitment defaults: when commitment is omitted, the node's default commitment applies. Pass finalized for the strongest consistency guarantee.
  • Related methods: use getEpochSchedule for the cluster's static epoch layout (slots per epoch, warmup), and getBlock / getSlot to inspect specific slots and blocks.