get_last_block_header - Monero

Example code for the get_last_block_header JSON-RPC method. Complete guide on how to use get_last_block_header JSON-RPC in GetBlock Web3 documentation.

This method returns the header of the most recent block in the chain. Useful as a lightweight alternative to get_info when only block-level metadata is needed.

Parameters

  • None

Request Example

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "get_last_block_header",
    "params": {},
    "id": "getblock.io"
}'

Response Example

{
    "id": "getblock.io",
    "jsonrpc": "2.0",
    "result": {
        "block_header": {
            "block_size": 5500,
            "depth": 0,
            "difficulty": 294558564173,
            "hash": "e22cf75f39ae720e8b71b3d120a5ac03f0db50bba6379e2850975b4859190bc6",
            "height": 3194582,
            "major_version": 16,
            "minor_version": 16,
            "nonce": 1234567890,
            "num_txes": 12,
            "orphan_status": false,
            "prev_hash": "37155cae7d3aa8ca7dc8b9e69e0d1f64b5e3a8b1c2d9e4f5a6b7c8d9e0f1a2b3",
            "reward": 600000000000,
            "timestamp": 1737869732
        },
        "status": "OK",
        "untrusted": false
    }
}

Response Parameters

Field
Type
Description

result.block_header.hash

string

Hash of the latest block

result.block_header.height

unsigned int

Height of the latest block

result.block_header.timestamp

unsigned int

Unix timestamp when the block was mined

result.block_header.difficulty

unsigned int

Mining difficulty at this block

result.block_header.reward

unsigned int

Coinbase reward in atomic units

result.block_header.num_txes

unsigned int

Number of non-coinbase transactions in the block

result.block_header.major_version

unsigned int

Major protocol version

Use Cases

  • Lightweight chain-tip polling

  • Displaying network statistics in dashboards

  • Computing block-time analytics

Error Handling

Status Code
Error Message
Cause

404

Not found

Missing or invalid <ACCESS-TOKEN>

429

Too Many Requests

Rate limit exceeded for your plan

SDK Integration

Last updated

Was this helpful?