get_block_template - Monero

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

This method returns a block blob and accompanying data that miners use to construct and submit a new block. The block reward is paid to the supplied wallet address.

Parameters

Parameter
Type
Required
Description

wallet_address

string

Yes

Address of the wallet that will receive the coinbase reward if the block is mined

reserve_size

unsigned int

Yes

Reserve size for extra bytes in the coinbase (often used by pools for nonce space)

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_template",
    "params": {
        "wallet_address": "44GBHzv6ZyQdJkjqZje6KLZ3xSyN1hBSFAnLP6EAqJtCRVzMzZmeXTC2AHKDS9aEDTRKmo6a6o9r9j86pYfhCWDkKjbtcns",
        "reserve_size": 60
    },
    "id": "getblock.io"
}'

Response Example

Response Parameters

Field
Type
Description

result.blockhashing_blob

string

Hex blob to feed into the proof-of-work hash function

result.blocktemplate_blob

string

Hex blob of the full block template

result.difficulty

unsigned int

Current network difficulty

result.expected_reward

unsigned int

Expected coinbase reward in atomic units

result.height

unsigned int

Height the block would be added at

result.prev_hash

string

Hash of the previous block

result.reserved_offset

unsigned int

Byte offset within the block where the reserve bytes are placed

Use Cases

  • Mining pool block construction

  • Solo mining client integration

  • Testing mining software end-to-end

Error Handling

Status Code
Error Message
Cause

404

Not Found

Missing or invalid <ACCESS-TOKEN>

-32602

Invalid params

Request parameters are missing or malformed

429

Too Many Requests

Rate limit exceeded for your plan

SDK Integration

Last updated

Was this helpful?