# getEpochInfo

Solana API method that returns information about the current epoch.

Parameters:

  • <object> — (optional) the configuration object containing the following fields:
    • commitment: <string> — (optional) the commitment.
    • minContextSlot: <number> — (optional) the minimum slot that the request can be evaluated at.

Returns:

  • absoluteSlot: <u64> — the current slot.
  • blockHeight: <u64> — the current block height.
  • epoch: <u64> — the current epoch.
  • slotIndex: <u64> — the current slot relative to the start of the current epoch.
  • slotsInEpoch: <u64> — the number of slots in this epoch.
  • transactionCount: <u64 | null> — the total number of transactions processed without error since genesis.

Example:

  • Solana web3.js
  • Solana.py
  • cURL
import { PublicKey, Connection } from "@solana/web3.js"

const nodeUrl = "CHAINSTACK_NODE_URL"
const connect = new Connection(nodeUrl);

(async () => {  
  console.log(await connect.getEpochInfo());
})();