getEpochSchedule - Solana
Example code for the getEpochSchedule JSON-RPC method. Complete guide on how to use the getEpochSchedule JSON-RPC method in the GetBlock Web3 documentation.
This method returns the epoch schedule parameters configured at cluster genesis, including epoch length and the warmup behavior applied to early epochs.
Parameters
This method does not accept any parameters.
Request
curl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "getEpochSchedule",
"params": [],
"id": "getblock.io"
}'const { Connection } = require('@solana/web3.js');
const connection = new Connection('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', 'confirmed');
const schedule = await connection.getEpochSchedule();
console.log(schedule.slotsPerEpoch, schedule.firstNormalEpoch);import requests
response = requests.post(
'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
headers={'Content-Type': 'application/json'},
json={
'jsonrpc': '2.0',
'method': 'getEpochSchedule',
'params': [],
'id': 'getblock.io'
}
)
print(response.json()['result'])Response
{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": {
"firstNormalEpoch": 14,
"firstNormalSlot": 524256,
"leaderScheduleSlotOffset": 432000,
"slotsPerEpoch": 432000,
"warmup": true
}
}Response Parameters
jsonrpc
string
JSON-RPC protocol version ("2.0")
id
string
Request identifier matching the request
result
object
Object holding the cluster's epoch schedule parameters
Result Object
slotsPerEpoch
number
Maximum number of slots in each epoch
leaderScheduleSlotOffset
number
Slots before an epoch starts at which its leader schedule is calculated
warmup
boolean
Whether epochs started short and grew toward slotsPerEpoch
firstNormalEpoch
number
First epoch with the full slotsPerEpoch length
firstNormalSlot
number
Slot at which firstNormalEpoch begins
Use Cases
Slot to Epoch Math: Convert an arbitrary slot to its epoch without extra requests
Schedule Prefetch: Time leader schedule fetches using leaderScheduleSlotOffset
Historical Analysis: Handle warmup epochs correctly when indexing early ledger data
Test Validators: Detect shortened epoch settings on a local validator
Error Handling
-32603
Internal error
Node failed to read the requested cluster state
-32005
Node is unhealthy
The node has fallen behind the cluster tip
Last updated
Was this helpful?