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

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# getSlotLeaders

> Returns the validator identity for each slot in a contiguous slot range.

<Info>
  **Source**

  [`get_slot_leaders`](https://github.com/anza-xyz/agave/blob/v4.3.2/rpc/src/rpc.rs#L998)
</Info>

<RequestExample>
  ```bash cURL
  curl https://api.devnet.solana.com -s -X POST \
    -H "Content-Type: application/json" \
    -d '
    {
      "jsonrpc": "2.0",
      "id": 1,
      "method": "getSlotLeaders",
      "params": [
        518091329,
        10
      ]
    }
  '
  ```

  ```ts Kit
  import { createSolanaRpc } from "@solana/kit";

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

  // Start at the current slot: nodes only keep leader schedules for recent epochs
  let startSlot = await rpc.getSlot().send();
  let limit = 10;

  let slotLeaders = await rpc.getSlotLeaders(startSlot, limit).send();

  console.log(slotLeaders);
  ```

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

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

  // Start at the current slot: nodes only keep leader schedules for recent epochs
  let startSlot = await connection.getSlot();
  let limit = 10;

  let slotLeaders = await connection.getSlotLeaders(startSlot, limit);

  console.log(slotLeaders);
  ```

  ```rs Rust
  use anyhow::Result;
  use solana_client::nonblocking::rpc_client::RpcClient;
  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(),
      );

      // Start at the current slot: nodes only keep leader schedules for recent epochs
      let start_slot = client.get_slot().await?;
      let limit = 10;

      let slot_leaders = client.get_slot_leaders(start_slot, limit).await?;

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

      Ok(())
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Response
  {
    "jsonrpc": "2.0",
    "result": [
      "dv1ZAGvdsz5hHLwWXsVnM94hWf1pjbKVau1QVkaMJ92",
      "dv1ZAGvdsz5hHLwWXsVnM94hWf1pjbKVau1QVkaMJ92",
      "dv1ZAGvdsz5hHLwWXsVnM94hWf1pjbKVau1QVkaMJ92",
      "dv4ACNkpYPcE3aKmYDqZm9G5EB3J4MRoeE7WNDRBVJB",
      "dv4ACNkpYPcE3aKmYDqZm9G5EB3J4MRoeE7WNDRBVJB",
      "dv4ACNkpYPcE3aKmYDqZm9G5EB3J4MRoeE7WNDRBVJB",
      "dv4ACNkpYPcE3aKmYDqZm9G5EB3J4MRoeE7WNDRBVJB",
      "dv4ACNkpYPcE3aKmYDqZm9G5EB3J4MRoeE7WNDRBVJB",
      "dv4ACNkpYPcE3aKmYDqZm9G5EB3J4MRoeE7WNDRBVJB",
      "dv4ACNkpYPcE3aKmYDqZm9G5EB3J4MRoeE7WNDRBVJB"
    ],
    "id": 1
  }
  ```
</ResponseExample>

## Parameters

<ParamField body="start slot" type="u64" required>
  First slot in the requested range. Use a recent slot, such as the result of
  [`getSlot`](/developers/docs/rpc/http/getslot): a node keeps leader schedules
  for only ten epochs (the next epoch, the current epoch, and the eight before
  it), so a start slot outside that range returns `Invalid slot range: leader
  schedule for epoch <epoch> is unavailable` (`-32602`). The cURL example's fixed
  slot goes out of range once the cluster is nine epochs past it (two to three
  weeks); this command reads the current slot first:

  ```bash Example
  SLOT=$(curl https://api.devnet.solana.com -s -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","id":1,"method":"getSlot"}' | jq .result)

  curl https://api.devnet.solana.com -s -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","id":1,"method":"getSlotLeaders","params":['"$SLOT"',10]}'
  ```
</ParamField>

<ParamField body="limit" type="u64" required>
  Number of consecutive slots to return. Allowed range: `1` to `5,000`.
</ParamField>

## Result

<ResponseField name="result" type="array">
  Array of validator identity Pubkeys, as base-58 encoded strings, in slot order.
</ResponseField>
