Skip to main content

chain_getBlockHash - JSON-RPC Method

Description#

Returns the block hash for a given block number on Enjin Matrix. When called without parameters it returns the hash of the latest block. Hashes are required for deterministic storage reads and verifying block inclusion proofs.

Parameters#

ParameterTypeRequiredDescription
blockNumbernumberNoBlock height as a decimal integer. If omitted, returns the best block hash

Returns#

FieldTypeDescription
resultstringHex-encoded block hash

Request Examples#

{
"jsonrpc": "2.0",
"method": "chain_getBlockHash",
"params": [],
"id": 1
}
{
"jsonrpc": "2.0",
"method": "chain_getBlockHash",
"params": [6781838],
"id": 42
}

Response Example#

{
"jsonrpc": "2.0",
"result": "0x1873093eade39aa409f64537dd972c27156e4691fc0fda227a06d50c52ad5fef",
"id": 42
}

Code Examples#

# Latest block hash
curl https://api-enjin-matrixchain.n.dwellir.com/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "chain_getBlockHash",
"params": [],
"id": 1
}'

# Hash for block 6,781,838
curl https://api-enjin-matrixchain.n.dwellir.com/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "chain_getBlockHash",
"params": [6781838],
"id": 42
}'

Notes#

  • Provide the returned hash to chain_getBlock or state_getStorage for deterministic reads.
  • Supply decimal heights when querying by number; JSON-RPC clients perform conversion to hex automatically.
  • For archival queries across Matrix and the Enjin Relaychain, track hashes per network—they are distinct consensus layers.