5

After mining a correct nonce on the block template (received from rpc method "getblocktemplate") you need to submit the block back to the daemon. However, the rpc method "submitblock" appears to require the entire block blob. The template does not contain the entire block, just the parts necessary for mining. And I don't see any way to derive the full block information from the template to create the block blob.

So how do I mine on the template and then submit the full block back to the daemon?

Glorfindel
  • 155
  • 1
  • 1
  • 9
The Shoe Shiner
  • 289
  • 1
  • 9

1 Answers1

6

The getbklocktemplate RPC returns a blockhashing_blob and a blocktemplate_blob.

You can either try to find a nonce (4 bytes) by mining using the blockhashing_blob, or you can try to find two nonces (4 bytes in the block header, reserved_size bytes in the extra field of the mining reward transaction) using the blocktemplate_blob and computing the transaction Merkle tree yourself.

When your nonce(s) pass the difficulty test, you put it/them in the blocktemplate_blob at the right offset(s) and you send the updated blocktemplate_blob to the daemon using the submitblock RPC.

glv
  • 3,364
  • 11
  • 15