grandpa_roundState - Midnight

Example code for the grandpa_roundState JSON-RPC method. Complete guide on how to use grandpa_roundState JSON-RPC in GetBlock Web3 documentation.

This method returns the current GRANDPA round state, including round number, voter set, and prevote/precommit progress. Useful for monitoring finality health.

Parameters

  • None

Request Example

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "grandpa_roundState",
    "params": [],
    "id": "getblock.io"
}'

Response Example

{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": {
        "setId": 1024,
        "best": {
            "round": 1234,
            "totalWeight": 100,
            "thresholdWeight": 67,
            "prevotes": {
                "currentWeight": 80,
                "missing": []
            },
            "precommits": {
                "currentWeight": 75,
                "missing": []
            }
        },
        "background": []
    }
}

Response Parameters

Field
Type
Description

result.setId

integer

Current GRANDPA voter set ID

result.best.round

integer

Current GRANDPA round number

result.best.totalWeight

integer

Total voter weight in the round

result.best.thresholdWeight

integer

Weight threshold required to finalize

result.best.prevotes

object

Prevote participation state

result.best.precommits

object

Precommit participation state

Use Cases

  • Validator monitoring dashboards

  • Detecting stalled finality

  • Analytics on GRANDPA participation rates

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid <ACCESS-TOKEN>

-32602

Invalid params

Request parameters are missing or malformed

429

Too Many Requests

Rate limit exceeded for your plan

SDK Integration

Last updated

Was this helpful?