---
title: getLeaderSchedule
description: >-
  Returns the leader schedule for the epoch that contains the supplied slot, or
  for the current epoch if no slot is supplied.
url: /docs/rpc/http/getleaderschedule
type: reference
hideTableOfContents: true
---

Returns the leader schedule for the epoch that contains the supplied slot, or
for the current epoch if no slot is supplied.

<Callout type="info" title="Source">
  [`get_leader_schedule`](https://github.com/anza-xyz/agave/blob/v3.1.8/rpc/src/rpc.rs#L2904)
</Callout>

<APIMethod>

```jsonc !!request curl
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getLeaderSchedule",
  "params": [
    // !hover slot
    null,
    // !hover(1:4) config
    {
      // !hover commitment
      "commitment": "processed",
      // !hover identity
      "identity": "dv2eQHeP4RFrJZ6UeiZWoc3XTtmtZCUKxxCApCDcRNV"
    }
  ]
}
```

```ts !!request title="Kit"
import { address, createSolanaRpc, type Commitment } from "@solana/kit";

const rpc_url = "https://api.devnet.solana.com";
const rpc = createSolanaRpc(rpc_url);

// !hover slot
let slotNumber = null;

// !hover identity
let identity = address("dv1ZAGvdsz5hHLwWXsVnM94hWf1pjbKVau1QVkaMJ92");
// !hover commitment
let commitment: Commitment = "finalized";

let leaderSchedule = await rpc
  .getLeaderSchedule(slotNumber, { identity, commitment })
  .send();

console.log(leaderSchedule);
```

```ts !!request title="web3.js"
import { Connection, clusterApiUrl } from "@solana/web3.js";

const connection = new Connection(clusterApiUrl("devnet"), "confirmed");

let leaderSchedule = await connection.getLeaderSchedule();

console.log(leaderSchedule);
```

```rs !!request title="Rust"
use anyhow::Result;
use solana_client::{nonblocking::rpc_client::RpcClient, rpc_config::RpcLeaderScheduleConfig};
use solana_commitment_config::CommitmentConfig;

#[tokio::main]
async fn main() -> Result<()> {
    let client = RpcClient::new_with_commitment(
        String::from("https://api.devnet.solana.com"),
        CommitmentConfig::confirmed(),
    );

    // !hover slot
    let slot_number = None;
    // !hover(1:4) config
    let config = RpcLeaderScheduleConfig {
        // !hover identity
        identity: String::from("dv1ZAGvdsz5hHLwWXsVnM94hWf1pjbKVau1QVkaMJ92").into(),
        // !hover commitment
        commitment: CommitmentConfig::finalized().into(),
    };
    let leader_schedule = client
        .get_leader_schedule_with_config(slot_number, config)
        .await?;

    println!("{:#?}", leader_schedule);

    Ok(())
}
```

### !params

#### !! slot

!type u64 | object | null  
!optional

Either the slot used to select the epoch, `null` to use the current slot at the
requested commitment, or a configuration object.

- If this parameter is a number, the RPC returns the leader schedule for the
  epoch that contains that slot.
- If this parameter is `null` or omitted, the RPC uses the current epoch.
- If this parameter is an object, it has the same shape as `config` and the
  request omits the slot.

When this parameter is an object, it contains:

| Field        | Type     | Description                                                                      |
| ------------ | -------- | -------------------------------------------------------------------------------- |
| `commitment` | `string` | Commitment level used to select which slot the node reads from for this request. |
| `identity`   | `string` | Validator identity to filter for, as a base-58 encoded string.                   |

#### !! config

!type object  
!optional

Configuration object containing the following fields. This parameter is only
used when `slot` is a number or `null`.

##### !! commitment

!type string  
!values processed confirmed finalized  
!default finalized

Solana RPC uses the following commitment levels:

| Value       | Description                                                                                                                                                                                                                                                                |
| ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `processed` | Return data from the highest slot this node has processed on the fork it currently considers best. This is the newest view, but it can still change if the cluster switches forks.                                                                                         |
| `confirmed` | Return data from the highest slot that at least two-thirds of active stake has directly voted to confirm. This is more stable than `processed`, but it is still a weaker guarantee than `finalized`.                                                                       |
| `finalized` | Return data from the highest slot that the cluster recognizes as finalized. In practice, this means the slot has reached maximum vote lockout in validators' vote towers and is recognized by at least two-thirds of active stake. This is the strongest commitment level. |

##### !! identity

!type string

Return only entries for this validator identity, as a base-58 encoded string.

### !!result

```jsonc !response
{
  "jsonrpc": "2.0",
  // !hover(1:8) result
  "result": {
    "4Qkev8aNZcqFNSRhQzwyLMFSsi94jHqE8WNVTJzTP99F": [
      0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
      21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
      39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
      57, 58, 59, 60, 61, 62, 63
    ]
  },
  "id": 1
}
```

!type object | null

Returns `null` if the requested epoch is unavailable. Otherwise returns an
object where:

- Keys are validator identities (as base-58 encoded strings)
- Values are arrays of leader slot indices relative to the first slot in the
  requested epoch

</APIMethod>
