Skip to main content

on_getblockhash

Obtains block hash by given block height

Request

{
"jsonrpc": "2.0",
"id": 0,
"method": "on_getblockhash",
"params": [2111]
}

Request parameters

Unlike most other daemon methods, on_getblockhash does not take a named parameter object. Its params is a positional JSON array that must contain exactly one element; passing an object, an empty array or more than one element makes the call fail with a "Wrong parameters, expected height" error.

  • params[0] - unsigned int; the height of the block whose identifier is requested. 0 is the genesis block. The height must be less than the current blockchain size, otherwise the call fails with a "To big height" error.

Response

{
"id": "0",
"jsonrpc": "2.0",
"result": "68b3bcf941431fe76420059ce3104bb34ee122a49d0b541af1041ab06e0015bb"
}

Response information

The result of this method is also unusual: it is a bare JSON string rather than an object, so there is no status field and no nested fields.