getEpochInfo
Learn getEpochInfo use cases, code examples, request parameters, response structure, and tips.
The getEpochInfo RPC method returns real-time information about the current epoch on the Solana network. It helps track epoch progression, network state, and can be used to determine how far the network has advanced into the current epoch and when the next epoch is expected to begin.
β
Common Use Cases
Monitor Epoch Progression Retrieve the current slot index within the epoch and total slots in the epoch to estimate time remaining.
Analyze Network State Access core metrics like epoch number, block height, and transactions processed to evaluate network activity.
Node Synchronization Checks Confirm whether a node is aligned with the network by comparing its epoch info against a trusted source.
π Request Parameters
getEpochInfo optionally accepts a configuration object:
commitment(string, optional): Defines the ledger confirmation level:finalized(default) β Highest safety; may lag slightly.confirmedβ Recently voted on by supermajority.processedβ Fastest, but may be incomplete or rollback-prone.
minContextSlot(number, optional): Ensures the response is evaluated at or beyond a specific slot, useful for timeline-sensitive consistency.
π¦ Response Structure
The result field will return an object containing:
absoluteSlot
u64
Current absolute slot number on the ledger.
blockHeight
u64
Current block height (number of blocks produced since genesis).
epoch
u64
Current epoch number.
slotIndex
u64
Current slot within the epoch.
slotsInEpoch
u64
Total slots assigned to the current epoch.
transactionCount
u64 | null
Total number of transactions processed in this epoch (may be null).
π‘ Examples
1. Fetch Epoch Info with Default Commitment
2. Fetch Epoch Info Using confirmed Commitment
Code Examples
Example Response
π§ Developer Tips
Choosing Commitment Levels Use
finalizedfor highest confidence. Useprocessedfor low-latency monitoring. For balanced needs,confirmedis a good compromise.Transaction Count Limitations
transactionCountmay benullif not tracked by the node or unavailable for the specified commitment level.Dynamic Epoch Lengths
slotsInEpochcan vary based on network configuration. UsegetEpochScheduleto explore the full epoch schedule and slot structure.
Last updated