getEpochSchedule RPC method returns the epoch schedule information from the cluster’s genesis configuration. This data defines how epochs are structured, including their length and how the leader schedule is determined relative to an epoch’s start.
Understanding the epoch schedule is crucial for applications that need to align with network events, predict epoch boundaries, or understand the leader rotation mechanism.
Common Use Cases
- Predicting Epoch Boundaries: Determine the number of slots in an epoch to estimate when the current epoch will end and the next will begin.
- Leader Schedule Calculation: Understand the
leaderScheduleSlotOffsetto know how far in advance leader schedules are generated for an upcoming epoch. - Analyzing Network Initialization: Observe
warmup,firstNormalEpoch, andfirstNormalSlotto understand the initial ramp-up phase of the cluster’s epoch lengths if applicable. - Building Network Monitoring Tools: Use this information to display epoch timing and progression accurately.
Request Parameters
This method does not take any parameters.Response Structure
Theresult field of the JSON-RPC response will be an object containing the following fields:
slotsPerEpoch(u64): The maximum number of slots in each epoch (after the warmup period, if any).leaderScheduleSlotOffset(u64): The number of slots before the start of an epoch for which the leader schedule for that epoch is generated.warmup(boolean): A boolean indicating whether the cluster has a warmup period where epochs start shorter and gradually increase in length.firstNormalEpoch(u64): The first epoch number that has the fullslotsPerEpochlength. This is relevant ifwarmupis true.firstNormalSlot(u64): The slot index of the first slot in thefirstNormalEpoch. This is relevant ifwarmupis true.
Examples
1. Get the Epoch Schedule for the Cluster
This example fetches the epoch schedule.Developer Tips
- Static Information: The epoch schedule is determined by the genesis configuration of the cluster and generally does not change unless there is a significant network upgrade or a new cluster launch with different parameters.
- Mainnet vs. Testnet/Devnet: The epoch schedule, particularly
slotsPerEpochand warmup parameters, can differ significantly between Mainnet Beta, Testnet, and Devnet. Always query the specific cluster you are interested in. - Warmup Period: If
warmupistrue, epochs beforefirstNormalEpochwill have fewer slots thanslotsPerEpoch. The exact calculation for warmup epoch lengths is2^N * MINIMUM_SLOTS_PER_EPOCHwhere N is the epoch number (starting from 0) up untilfirstNormalEpochis reached. TheMINIMUM_SLOTS_PER_EPOCHis typically 32.
getEpochSchedule RPC method to understand the fundamental timing and structure of epochs within a Solana cluster.