getEpochSchedule - Solana

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

bashcurl --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"
}'

example.js

javascriptconst { 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);

example.py

pythonimport 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'])

example.rs

rustuse reqwest::Client;
use serde_json::{json, Value};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();

    let response = client
        .post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
        .header("Content-Type", "application/json")
        .json(&json!({
            "jsonrpc": "2.0",
            "method": "getEpochSchedule",
            "params": [],
            "id": "getblock.io"
        }))
        .send()
        .await?
        .json::<Value>()
        .await?;

    println!("Result: {}", response["result"]);
    Ok(())
}

Response

json{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": {
        "firstNormalEpoch": 14,
        "firstNormalSlot": 524256,
        "leaderScheduleSlotOffset": 432000,
        "slotsPerEpoch": 432000,
        "warmup": true
    }
}

Response Parameters

ParameterTypeDescription
jsonrpcstringJSON-RPC protocol version ("2.0")
idstringRequest identifier matching the request
resultobjectObject holding the cluster's epoch schedule parameters

Result Object

FieldTypeDescription
slotsPerEpochnumberMaximum number of slots in each epoch
leaderScheduleSlotOffsetnumberSlots before an epoch starts at which its leader schedule is calculated
warmupbooleanWhether epochs started short and grew toward slotsPerEpoch
firstNormalEpochnumberFirst epoch with the full slotsPerEpoch length
firstNormalSlotnumberSlot 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

Error CodeMessageDescription
-32603Internal errorNode failed to read the requested cluster state
-32005Node is unhealthyThe node has fallen behind the cluster tip