Find the first slot of the next Solana epoch

An epoch-based reporting job needs an exact slot boundary even when a wall-clock estimate drifts. One epoch-info response contains the counters needed to compute it.

Use counters from one observation

Read absoluteSlot, slotIndex and slotsInEpoch together at finalized commitment. Subtract slotIndex from absoluteSlot to obtain the first slot of this epoch. Add slotsInEpoch to get the first slot of the following epoch.

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getEpochInfo",
  "params": [
    {
      "commitment": "finalized"
    }
  ]
}

Verify the rollover before sealing a report

For an illustrative absolute slot of 10230, index 230 and epoch length 1000, the current epoch starts at 10000 and ends at 10999. The new epoch starts at 11000. A block may be absent at that exact slot, so close the old period once a later finalized observation reports the new epoch.

Store the epoch number with both bounds. A monitoring process that restarts after rollover can then identify the exact period awaiting reconciliation.

Documentation