chain_getBlock

Retrieve a relay chain block's header and body components.

An crucial RPC call for getting comprehensive details about a particular block in the relay chain is chain_getBlock. This function takes a block hash as input and outputs a complete set of information about the block that is specified, including information about both the block's header and body.

Example Request and Result for chain_getBlock method

In this section, we provide an illustrative example of a request made to retrieve details contents using the chain_getBlock method. Additionally, we present the resulting response containing information about the header and the body of a relay chain block.

Parameters

The example in this section uses a non-existing project id.

Make sure you replace it with your Vara Mainnet endpoint when issuing the API calls.

Don't have a project id? Here's a straightforward guide on how to obtain one!

Retrieve a relay chain block's header and body components.

POST https://vara-mainnet.blastapi.io/<project-id>

Request Body

{
    "jsonrpc": "2.0",
    "result": {
        "block": {
            "header": {
                "parentHash": "0x290a66a02502c71003cb11a136338f75982d30e70bfd8d7bf8f0101863721f2c",
                "number": "0x994f28",
                "stateRoot": "0x24d5472620295e65a1f36eabe81f8eed60f1c553d29a92eb45ab800cca363972",
                "extrinsicsRoot": "0x58f7a3376ad6b952298bf6f591e1a9223c31ff3aef5cea2e6cc1089f31a2b121",
                "digest": {
                    "logs": [
                        "0x06424142453402230000007e2af82100000000",
                        "0x0542414245010128560001c10a7aeb99a9e9281b7c6778a281f1e155fbccde2b808b01587b6a01eca9acc0b16ae2b9ec4f5a3ee844d07d359634feb5a402861d5a846c24a9d488"
                    ]
                }
            },
            "extrinsics": [
                "0x280401000b90f431148e01",
                "0x91028400b036db501b2e84f2b2480e7b8ad756508a4a1b014f556be56e57c4de3bc1900701104d7b885a7313fd062fd33cabd698ffeaccdd27da5869e6661d6b2e3804db02589481b543d364cfc0d97f252201ac5e22947ab0625a3ce54754aa1166bf4b8616020000680391282a7344c498560810d991c42aee5f9ef5a5b7002646a0421fdf29d4f4783e0403de180c32090000000000000000000000000000000000000000",
                "0x1004680600"
            ]
        },
        "justifications": null
    },
    "id": 1
}

Curl Request example

curl --location 'https://vara-mainnet.blastapi.io/<project-id>' \
--header 'Content-Type: application/json' \
--data '{
    "jsonrpc": "2.0",
    "method": "chain_getBlock",
    "params": ["0xf9bb4bcd70b0188c940ed73de2499d0273d987ea8286cfc6324fefb67559ce63"],
    "id": 1
}'

Last updated