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
"getblockcount"Empty object
{} — this method takes no parameters.Response
The total number of blocks in the main chain. Also the index of the next block to be mined.
"OK" on success.getblockhash
Returns the block hash at a given height.Request
A single-element array containing the target block height as an integer:
[height].Response
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
Number of bytes to reserve in the block blob for the miner’s extra nonce. Maximum 255 bytes.
The mining reward address where the block reward will be sent if you find a valid block.
Response
Current mining difficulty. Your hash must be numerically less than
2^256 / difficulty.The height of the block you are attempting to mine (next block index).
Byte offset within
blocktemplate_blob where your extra nonce data should be written.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."OK" on success.submitblock
Submits a solved block blob to the network for validation and propagation.Request
A single-element array containing the solved block blob as a hex string:
["<block_blob_hex>"].Response
"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
Response
Block major version. Version 9 is the Godflame/Fuego consensus era, active from height 826420.
Block minor version.
Unix timestamp recorded in the block header by the miner.
Hash of the preceding block.
Proof-of-work nonce found by the miner.
true if this block is on an alternative chain (orphaned), false if it is in the main chain.Block height (index) in the chain.
Number of blocks confirmed on top of this block.
0 means it is the tip.Total deposit output value included in this block, in atomic units.
Hex-encoded hash of this block.
Difficulty at which this block was mined.
Total block reward (coinbase + fees), in atomic units.
"OK" on success.getblockheaderbyhash
Returns the block header for a block identified by its hash.Request
Hex-encoded hash of the block whose header you want to retrieve.
Response
The response follows the sameblock_header structure as getlastblockheader. See that method for field descriptions.
getblockheaderbyheight
Returns the block header for a block at a specific chain height.Request
The block height to query. Must be less than or equal to the current chain height.
Response
The response follows the sameblock_header structure as getlastblockheader. See that method for field descriptions.