get_block_header_by_height - Monero
Example code for the get_block_header_by_height JSON-RPC method. Complete guide on how to use get_block_header_by_height JSON-RPC in GetBlock Web3 documentation.
Parameters
Parameter
Type
Required
Description
Request Example
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "get_block_header_by_height",
"params": {
"height": 912345
},
"id": "getblock.io"
}'import axios from 'axios';
const data = JSON.stringify({
"jsonrpc": "2.0",
"method": "get_block_header_by_height",
"params": {
"height": 912345
},
"id": "getblock.io"
});
const config = {
method: 'post',
url: 'https://go.getblock.io/<ACCESS-TOKEN>/',
headers: {
'Content-Type': 'application/json'
},
data: data
};
axios(config)
.then(response => console.log(JSON.stringify(response.data, null, 2)))
.catch(error => console.log(error));Response Example
{
"id": "getblock.io",
"jsonrpc": "2.0",
"result": {
"block_header": {
"block_size": 5500,
"depth": 100,
"difficulty": 294558564173,
"hash": "e22cf75f39ae720e8b71b3d120a5ac03f0db50bba6379e2850975b4859190bc6",
"height": 912345,
"major_version": 7,
"minor_version": 7,
"nonce": 1234567890,
"num_txes": 12,
"orphan_status": false,
"prev_hash": "37155cae7d3aa8ca7dc8b9e69e0d1f64b5e3a8b1c2d9e4f5a6b7c8d9e0f1a2b3",
"reward": 1500000000000,
"timestamp": 1452793716
},
"status": "OK",
"untrusted": false
}
}Response Parameters
Field
Type
Description
Use Cases
Error Handling
Status Code
Error Message
Cause
SDK Integration
Last updated
Was this helpful?