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

71 lines
1.2 KiB
Plaintext

import {
DocBlock,
DocSideBySide,
CodeParams,
Parameter,
Field,
Values,
CodeSnippets,
} from "../../../components/CodeDocBlock";
<DocBlock>
## getBlockCommitment
Returns commitment for particular block
<DocSideBySide>
<CodeParams>
### Parameters:
<Parameter type={"u64"} required={true}>
block number, identified by Slot
</Parameter>
### Result:
The result field will be a JSON object containing:
- `commitment` - commitment, comprising either:
- `<null>` - Unknown block
- `<array>` - commitment, array of u64 integers logging the amount of cluster stake in lamports that has voted on the block at each depth from 0 to `MAX_LOCKOUT_HISTORY` + 1
- `totalStake` - total active stake, in lamports, of the current epoch
</CodeParams>
<CodeSnippets>
### Code sample:
```bash
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0", "id": 1,
"method": "getBlockCommitment",
"params":[5]
}
'
```
### Response:
```json
{
"jsonrpc": "2.0",
"result": {
"commitment": [
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 10, 32
],
"totalStake": 42
},
"id": 1
}
```
</CodeSnippets>
</DocSideBySide>
</DocBlock>