getleaderschedule

Solana RPC

Archive Method

Only on the full archive nodes. Complex queries might take longer and incur additional cost

How to Use It

// yarn add @tatumio/tatum

import { TatumSDK, Solana, Network } from '@tatumio/tatum'

const tatum = await TatumSDK.init<Solana>({ network: Network.SOLANA })

const res = await tatum.rpc.getLeaderSchedule({
  identity: '4Qkev8aNZcqFNSRhQzwyLMFSsi94jHqE8WNVTJzTP99F'
})

await tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs

Overview

The getLeaderSchedule method returns the leader schedule for an epoch. This method is useful for understanding the rotation of leadership among the validators, which is key in maintaining a decentralized and secure network. The schedule can be fetched for a specific epoch, or for the current epoch if no parameter is specified.

Parameters

  • slot (number, optional): Fetch the leader schedule for the epoch that corresponds to the provided slot. If unspecified, the leader schedule for the current epoch is fetched.
  • options (object, optional): A configuration object containing:
    • commitment(string, optional): Specifies the level of commitment to apply when fetching data.
      • Values: finalized confirmed processed
    • identity (string, optional): Only return results for this validator identity (base-58 encoded).

Return Object

The method returns one of the two following values:

  • null - If requested epoch is not found.
  • object - The result field will be a dictionary of validator identities, as base-58 encoded strings, and their corresponding leader slot indices as values (indices are relative to the first slot in the requested epoch).

JSON-RPC Request Example

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getLeaderSchedule",
  "params": [
    null,
    {
      "identity": "4Qkev8aNZcqFNSRhQzwyLMFSsi94jHqE8WNVTJzTP99F"
    }
  ]
}

JSON-RPC Response Example

{
  "jsonrpc": "2.0",
  "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
}