> For the complete documentation index, see [llms.txt](https://docs.coinvera.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coinvera.io/integration/solana/rpc/getslotleaders.md).

# getSlotLeaders

The `getSlotLeaders` RPC method in **CoinVera** allows you to retrieve a list of **validator public keys** scheduled to produce blocks for a specific range of slots. This method is helpful when analyzing or predicting short-term leader activity on the Solana network.

***

#### ✅ Common Use Cases

* **Predicting Near-Term Block Producers**\
  Identify which validators are expected to lead block production in upcoming slots.
* **Analyzing Leader Distribution**\
  Examine how leadership is distributed across a segment of an epoch.
* **Network Monitoring & Analysis**\
  Tools that track validator activity or block propagation can use this method to understand validator participation in upcoming slots.

***

#### 🧾 Request Parameters

* `startSlot` (`u64`) – **Required**\
  The first slot (inclusive) from which to begin fetching leader assignments.
* `limit` (`u64`) – **Required**\
  The number of **consecutive slot leaders** to return (must be between **1 and 5,000**).

***

#### 📦 Response Structure

Returns an array of base-58 encoded public keys, one for each slot in the requested range, in order.

```json
{
  "result": [
    "5Y6g8zWcR9GVoHqGnBbPmgzUdu1tHuCVDRKLv7fP5Xed",
    "2ABgfX2pRzAGhLkYwPYTeJNXREtxNUb1mC17hCwF41hD",
    ...
  ]
}
```

Each public key corresponds to the validator scheduled to produce a block for that slot.

***

#### 🧪 Example

**Get Slot Leaders for a Specific Range**

Fetches leaders for the next 5 slots starting at a specified slot number.

```json
{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getSlotLeaders",
    "params": [
      180000000, 
      5          
    ]
}
```

***

**Code Examples**

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

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

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

    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';

getSlotLeaders(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_slot_leaders(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getSlotLeaders',
                'params': [
                    355104000,
                    5
                ]
            }
        )
        
        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_slot_leaders(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": [
    "vu1sGn2f1Xim6voHNLt4nLn38zNkYdLasU7hEr1TC2D",
    "vu1sGn2f1Xim6voHNLt4nLn38zNkYdLasU7hEr1TC2D",
    "vu1sGn2f1Xim6voHNLt4nLn38zNkYdLasU7hEr1TC2D",
    "vu1sGn2f1Xim6voHNLt4nLn38zNkYdLasU7hEr1TC2D",
    "simpRo1FrQYGa1moicfgnPDp6KyE38d4gYrZzhjXYJb"
  ],
  "id": 1
}
```

***

#### 💡 Developer Tips

* **Limit Parameter**\
  You can retrieve up to **5,000** slot leaders in one request, which allows insight into a sizable segment of the leader schedule within an epoch.
* **Epoch Boundaries**\
  The schedule is fixed per epoch. If your requested range crosses into a new epoch, only slots from the current epoch (where `startSlot` resides) will be returned—up to the `limit` or the end of the schedule, depending on node configuration.
* **Supports Future Slot Lookups**\
  You can query upcoming (future) slots. The RPC node uses the current leader schedule to project future leaders.
* **High Accuracy**\
  Since the leader schedule is deterministic and set at the beginning of an epoch, returned values are reliable unless major network events occur.
* **Difference from `getLeaderSchedule`**
  * `getSlotLeaders`: Returns a flat, ordered list of leader public keys for a specific slot range.
  * `getLeaderSchedule`: Returns the full epoch schedule, mapping each validator to all slots they're scheduled to lead.

***

Use `getSlotLeaders` when you need a concise, sequential list of upcoming block producers for a well-defined slot range—ideal for validator analysis, staking dashboards, or block propagation modeling.
