solana/docs/src/api/methods/_getSlotLeaders.mdx

78 lines
1.5 KiB
Plaintext

import {
DocBlock,
DocSideBySide,
CodeParams,
Parameter,
Field,
Values,
CodeSnippets,
} from "../../../components/CodeDocBlock";
<DocBlock>
## getSlotLeaders
Returns the slot leaders for a given slot range
<DocSideBySide>
<CodeParams>
### Parameters:
<Parameter type={"u64"} optional={true}>
Start slot, as u64 integer
</Parameter>
<Parameter type={"u64"} optional={true}>
Limit, as u64 integer (between 1 and 5,000)
</Parameter>
### Result:
`<array[string]>` - array of Node identity public keys as base-58 encoded strings
</CodeParams>
<CodeSnippets>
### Code sample:
If the current slot is `#99` - query the next `10` leaders with the following request:
```bash
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc":"2.0", "id": 1,
"method": "getSlotLeaders",
"params": [100, 10]
}
'
```
### Response:
The first leader returned is the leader for slot `#100`:
```json
{
"jsonrpc": "2.0",
"result": [
"ChorusmmK7i1AxXeiTtQgQZhQNiXYU84ULeaYF1EH15n",
"ChorusmmK7i1AxXeiTtQgQZhQNiXYU84ULeaYF1EH15n",
"ChorusmmK7i1AxXeiTtQgQZhQNiXYU84ULeaYF1EH15n",
"ChorusmmK7i1AxXeiTtQgQZhQNiXYU84ULeaYF1EH15n",
"Awes4Tr6TX8JDzEhCZY2QVNimT6iD1zWHzf1vNyGvpLM",
"Awes4Tr6TX8JDzEhCZY2QVNimT6iD1zWHzf1vNyGvpLM",
"Awes4Tr6TX8JDzEhCZY2QVNimT6iD1zWHzf1vNyGvpLM",
"Awes4Tr6TX8JDzEhCZY2QVNimT6iD1zWHzf1vNyGvpLM",
"DWvDTSh3qfn88UoQTEKRV2JnLt5jtJAVoiCo3ivtMwXP",
"DWvDTSh3qfn88UoQTEKRV2JnLt5jtJAVoiCo3ivtMwXP"
],
"id": 1
}
```
</CodeSnippets>
</DocSideBySide>
</DocBlock>