Your pool first calls get_block_template and reserving some space by making use of the reserve_size
parameter.
You then take the returned blocktemplate_blob
, convert the hex data into binary, and modify the data at the offset provided by the returned reserved_offset
parameter. This is where you will write your per miner, miner ID for example. So assume you asked for 4 bytes of reserved space, you have 4 bytes you can change at this reserved offset.
Now you have to create a hashing blob for the miner from this data. To do this, you need to make use of two Monero functions: parse_and_validate_block_from_blob and get_block_hashing_blob. The former converts your binary data to a C block structure and the later gets a hashing blob of the block. To use these functions you have to be in a C/C++ environment as they are not exposed via the RPC. Alternatively, you would have to re-implement them in your chosen language.
get_block_hashing_blob
is the notable function here and what it does is return the binary data (a blockhashing_blob) of:
- The blocks header data
- Appended with the blocks merkle tree root hash
- Appended with the tx count
Lastly, once you have your binary blockhashing_blob, you convert it to a hex string and send to the miner.