> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orbitflare.com/llms.txt
> Use this file to discover all available pages before exploring further.

# getEpochSchedule

> 返回此集群创世配置中的 epoch 计划信息

## 参数

此方法不需要任何参数。

## 响应

<ResponseField name="result" type="object">
  <Expandable title="result fields">
    <ResponseField name="slotsPerEpoch" type="number">
      每个 epoch 中的最大 slot 数
    </ResponseField>

    <ResponseField name="leaderScheduleSlotOffset" type="number">
      在 epoch 开始之前用于计算该 epoch 领导者计划的 slot 数
    </ResponseField>

    <ResponseField name="warmup" type="boolean">
      epoch 是否从短周期开始逐渐增长
    </ResponseField>

    <ResponseField name="firstNormalEpoch" type="number">
      第一个正常长度的 epoch，log2(slotsPerEpoch) - log2(MINIMUM\_SLOTS\_PER\_EPOCH)
    </ResponseField>

    <ResponseField name="firstNormalSlot" type="number">
      MINIMUM\_SLOTS\_PER\_EPOCH \* (2.pow(firstNormalEpoch) - 1)
    </ResponseField>
  </Expandable>
</ResponseField>

## 代码示例

### 基本请求

```bash theme={null}
curl http://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY -X POST -H "Content-Type: application/json" -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getEpochSchedule"
}'
```

### 使用 web3.js

```typescript theme={null}
import { Connection } from '@solana/web3.js';

const connection = new Connection('http://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY');
const epochSchedule = await connection.getEpochSchedule();
console.log(epochSchedule);
```

### 使用 Python

```python theme={null}
from solana.rpc.api import Client

client = Client("http://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY")
response = client.get_epoch_schedule()
print(response)
```

## 注意事项

1. 返回集群创世配置中的 epoch 计划信息
2. 返回的数据是静态的，对于给定的网络/集群不会改变
3. 对于计算 epoch 边界和领导者计划时间非常有用
4. warmup 参数指示 epoch 是否从短周期开始并增长到完整大小

## 最佳实践

1. 在本地缓存此信息，因为它不会改变
2. 使用返回的值计算 epoch 过渡
3. 使用 firstNormalEpoch 和 firstNormalSlot 进行 epoch 时间计算
4. 适当处理网络错误并重试
