chain_getBlockHash

Retrieve the block hash for the specified block.

The hash of a certain block on the blockchain may be easily obtained using the chain_getBlockHash method. This technique is frequently used to securely and uniquely identify blocks. Block numbers are accepted as input parameters, and the associated block hash is returned. The method ensures flexibility and utility for a range of use scenarios by getting the hash of the most recent block if no block number is given.

Example Request and Result for chain_getBlockHash method

In this section, we provide an illustrative example of a request made to retrieve details contents using the chain_getBlockHash method. Additionally, we present the resulting response containing information about the block hash for a specified block.

Parameters

FieldTypeDescription

blocknumber*

string

Identifies the block in order to obtain its hash by using its block number, which is a numerical identifier. The hash of the most recent block is returned if this parameter is not present.

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 the block hash of the specified block number.

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

Request Body

NameTypeDescription

blocknumber*

string

0x994f28

{
    "jsonrpc": "2.0",
    "result": "0xf9bb4bcd70b0188c940ed73de2499d0273d987ea8286cfc6324fefb67559ce63",
    "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_getBlockHash",
    "params": ["0x994f28"],
    "id": 1
}'

Last updated