# getEpochSchedule

The `getEpochSchedule` RPC method returns information about the **epoch schedule configuration** from the cluster’s genesis settings. It outlines how epochs are structured, including slot counts and leader scheduling mechanics. This data is essential for aligning application logic with Solana’s timing model.

***

#### ✅ Common Use Cases

* **Predict Epoch Boundaries**\
  Determine the number of slots in an epoch to estimate how soon the current epoch will end and when the next will begin.
* **Understand Leader Schedule Offsets**\
  Retrieve the `leaderScheduleSlotOffset` to know how far in advance validator leader schedules are generated.
* **Analyze Network Initialization**\
  Identify whether the network used a **warmup phase**, and if so, when full-length epochs began (via `firstNormalEpoch` and `firstNormalSlot`).
* **Build Monitoring and Analytics Tools**\
  Use epoch timing details to visualize epoch transitions and validate synchronization behaviors across clusters.

***

#### 🛠 Request Parameters

This method **does not require any parameters**.

***

#### 📦 Response Structure

The response object contains the following fields:

| Field                      | Type   | Description                                                                |
| -------------------------- | ------ | -------------------------------------------------------------------------- |
| `slotsPerEpoch`            | *u64*  | Number of slots in a full epoch (post-warmup).                             |
| `leaderScheduleSlotOffset` | *u64*  | Number of slots before an epoch when its leader schedule is generated.     |
| `warmup`                   | *bool* | `true` if the cluster had shorter initial epochs that ramped up gradually. |
| `firstNormalEpoch`         | *u64*  | First epoch with full-length slots (`slotsPerEpoch`).                      |
| `firstNormalSlot`          | *u64*  | The slot at which `firstNormalEpoch` begins.                               |

***

#### 💡 Example: Get Epoch Schedule

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getEpochSchedule"
}
```

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getEpochSchedule(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getEpochSchedule'
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getEpochSchedule(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_epoch_schedule(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getEpochSchedule'
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_epoch_schedule(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "firstNormalEpoch": 0,
    "firstNormalSlot": 0,
    "leaderScheduleSlotOffset": 432000,
    "slotsPerEpoch": 432000,
    "warmup": false
  },
  "id": 1
}
```

#### 🧠 Developer Tips

* **Epoch Schedule Is Static**\
  This data comes from the **cluster’s genesis configuration** and typically does not change unless there’s a protocol upgrade or network reset.
* **Cluster-Specific Behavior**\
  Parameters like `slotsPerEpoch` and `warmup` vary between **Mainnet**, **Testnet**, and **Devnet**. Always query the correct environment.
* **Warmup Epoch Calculations**\
  If `warmup` is `true`, early epochs use exponentially increasing lengths:

  ```
  iniCopyEditslots = 2^N * MINIMUM_SLOTS_PER_EPOCH
  ```

  where `N` is the epoch index, starting from 0.\
  `MINIMUM_SLOTS_PER_EPOCH` is usually 32.
* **Use for Time Estimation**\
  Combine with `getEpochInfo` to estimate time remaining in the current epoch or project when epoch transitions will occur.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.coinvera.io/integration/solana/rpc/getepochschedule.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
