Skip to main content
The Fuego daemon exposes a set of JSON-RPC methods for querying and interacting with block data. You send these as POST requests to http://127.0.0.1:18180/json_rpc with a standard JSON-RPC 2.0 envelope. These methods let you poll chain height, fetch block headers by hash or height, retrieve templates for mining, and submit solved blocks to the network.

getblockcount

Returns the current number of blocks in the main chain (i.e. the current height).

Request

method
string
required
"getblockcount"
params
object
required
Empty object {} — this method takes no parameters.
curl -s http://127.0.0.1:18180/json_rpc \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "method": "getblockcount",
    "params": {},
    "id": "1"
  }'

Response

{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "count": 900000,
    "status": "OK"
  }
}
count
integer
required
The total number of blocks in the main chain. Also the index of the next block to be mined.
status
string
required
"OK" on success.

getblockhash

Returns the block hash at a given height.

Request

params
array
required
A single-element array containing the target block height as an integer: [height].
curl -s http://127.0.0.1:18180/json_rpc \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "method": "getblockhash",
    "params": [826420],
    "id": "1"
  }'

Response

{
  "jsonrpc": "2.0",
  "id": "1",
  "result": "9a0158c87c062c63a675c65eda91c10bb6d7b68b854be783aa85b2cbbf3b8a55"
}
The result is the block hash string directly (not a nested object).

getblocktemplate

Returns a block template that a miner can use to attempt proof-of-work. The template includes the current difficulty, block height, and a blob to hash.

Request

reserve_size
integer
required
Number of bytes to reserve in the block blob for the miner’s extra nonce. Maximum 255 bytes.
wallet_address
string
required
The mining reward address where the block reward will be sent if you find a valid block.
curl -s http://127.0.0.1:18180/json_rpc \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "method": "getblocktemplate",
    "params": {
      "reserve_size": 8,
      "wallet_address": "fireXfGYourMiningAddressHere..."
    },
    "id": "1"
  }'

Response

{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "difficulty": 12345678,
    "height": 900001,
    "reserved_offset": 130,
    "blocktemplate_blob": "0d0d...abcdef",
    "status": "OK"
  }
}
difficulty
integer
required
Current mining difficulty. Your hash must be numerically less than 2^256 / difficulty.
height
integer
required
The height of the block you are attempting to mine (next block index).
reserved_offset
integer
required
Byte offset within blocktemplate_blob where your extra nonce data should be written.
blocktemplate_blob
string
required
Hex-encoded block template blob. Replace bytes at reserved_offset with your nonce, hash with the active PoW algorithm, and submit with submitblock if the result meets difficulty.
status
string
required
"OK" on success.

submitblock

Submits a solved block blob to the network for validation and propagation.

Request

params
array
required
A single-element array containing the solved block blob as a hex string: ["<block_blob_hex>"].
curl -s http://127.0.0.1:18180/json_rpc \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "method": "submitblock",
    "params": ["0d0d...solvedblob"],
    "id": "1"
  }'

Response

{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "status": "OK"
  }
}
status
string
required
"OK" if the block was accepted. An error response is returned if the block is invalid or does not meet the current difficulty.

getlastblockheader

Returns the block header of the most recently confirmed block in the main chain. No parameters are required.

Request

curl -s http://127.0.0.1:18180/json_rpc \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "method": "getlastblockheader",
    "params": {},
    "id": "1"
  }'

Response

{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "block_header": {
      "major_version": 9,
      "minor_version": 0,
      "timestamp": 1712345678,
      "prev_hash": "b1c2d3e4f5...",
      "nonce": 1234567890,
      "orphan_status": false,
      "height": 899999,
      "depth": 0,
      "deposits": 8000000000000,
      "hash": "a1b2c3d4e5f6...",
      "difficulty": 12345678,
      "reward": 180000000
    },
    "status": "OK"
  }
}
block_header.major_version
integer
required
Block major version. Version 9 is the Godflame/Fuego consensus era, active from height 826420.
block_header.minor_version
integer
required
Block minor version.
block_header.timestamp
integer
required
Unix timestamp recorded in the block header by the miner.
block_header.prev_hash
string
required
Hash of the preceding block.
block_header.nonce
integer
required
Proof-of-work nonce found by the miner.
block_header.orphan_status
boolean
required
true if this block is on an alternative chain (orphaned), false if it is in the main chain.
block_header.height
integer
required
Block height (index) in the chain.
block_header.depth
integer
required
Number of blocks confirmed on top of this block. 0 means it is the tip.
block_header.deposits
integer
required
Total deposit output value included in this block, in atomic units.
block_header.hash
string
required
Hex-encoded hash of this block.
block_header.difficulty
integer
required
Difficulty at which this block was mined.
block_header.reward
integer
required
Total block reward (coinbase + fees), in atomic units.
status
string
required
"OK" on success.

getblockheaderbyhash

Returns the block header for a block identified by its hash.

Request

hash
string
required
Hex-encoded hash of the block whose header you want to retrieve.
curl -s http://127.0.0.1:18180/json_rpc \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "method": "getblockheaderbyhash",
    "params": {
      "hash": "9a0158c87c062c63a675c65eda91c10bb6d7b68b854be783aa85b2cbbf3b8a55"
    },
    "id": "1"
  }'

Response

The response follows the same block_header structure as getlastblockheader. See that method for field descriptions.
{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "block_header": {
      "major_version": 9,
      "minor_version": 0,
      "timestamp": 1712000000,
      "prev_hash": "c9d8e7f6...",
      "nonce": 987654321,
      "orphan_status": false,
      "height": 826420,
      "depth": 73580,
      "deposits": 16000000000000,
      "hash": "9a0158c87c062c63a675c65eda91c10bb6d7b68b854be783aa85b2cbbf3b8a55",
      "difficulty": 11000000,
      "reward": 190000000
    },
    "status": "OK"
  }
}

getblockheaderbyheight

Returns the block header for a block at a specific chain height.

Request

height
integer
required
The block height to query. Must be less than or equal to the current chain height.
curl -s http://127.0.0.1:18180/json_rpc \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "method": "getblockheaderbyheight",
    "params": {
      "height": 826420
    },
    "id": "1"
  }'

Response

The response follows the same block_header structure as getlastblockheader. See that method for field descriptions.
{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "block_header": {
      "major_version": 9,
      "minor_version": 0,
      "timestamp": 1712000000,
      "prev_hash": "c9d8e7f6...",
      "nonce": 987654321,
      "orphan_status": false,
      "height": 826420,
      "depth": 73580,
      "deposits": 16000000000000,
      "hash": "9a0158c87c062c63a675c65eda91c10bb6d7b68b854be783aa85b2cbbf3b8a55",
      "difficulty": 11000000,
      "reward": 190000000
    },
    "status": "OK"
  }
}