getEpochInfo
The getEpochInfo method returns comprehensive information about the current epoch. An epoch in Solana is a significant time period consisting of a fixed number of slots (typically 432,000 slots, approximately 2-3 days), during which the validator schedule and stake distribution remain constant.
Epochs are fundamental to Solana's consensus and staking mechanisms. At the beginning of each epoch, the network determines which validators will act as leaders for specific slots based on their stake weight. Staking rewards are calculated and distributed at epoch boundaries, and certain network parameter changes can only take effect at epoch transitions. Understanding epoch timing is crucial for staking applications, validator management tools, and any dApp that needs to coordinate with network-wide state changes.
This method provides detailed information about the current epoch's progress, including which slot the network is currently processing, how many slots remain in the epoch, and the block height. This data is essential for calculating time estimates, predicting when the next epoch will begin, and implementing epoch-aware logic in smart contracts or applications.
Parameters
parameter | type | description |
|---|---|---|
config | object | Optional configuration object |
config.commitment | string | Level of commitment: 'processed', 'confirmed', or 'finalized' (default: 'finalized') |
config.minContextSlot | number | Optional. Minimum slot that the request can be evaluated at |
Return Object
field | type | description |
|---|---|---|
absoluteSlot | number | The current slot number |
blockHeight | number | The current block height |
epoch | number | The current epoch number |
slotIndex | number | The current slot relative to the start of the current epoch (0-based) |
slotsInEpoch | number | The total number of slots in this epoch |
transactionCount | number|null | Total number of transactions processed without error since genesis, or null if not available |
Request Example
Response Example
Tip: Calculate epoch progress as (slotIndex / slotsInEpoch). Remaining slots in epoch = slotsInEpoch - slotIndex. With ~400ms per slot, you can estimate when the epoch ends: remainingSlots * 0.4 seconds. This is useful for countdown timers in staking UIs.