Thank you in advance for your time in reading. I am working on developing a template for the bitcoin-cli submitblock [1] method. I have posted Issue #26830 on the Bitcoin Core GitHub [2]. Issue #26830 provides a detailed overview of all available information relating to the proper form for block hashing and submission for validation. However, there are still two keystone questions I have to be able to get started:
1. What, exactly, is being hashed?
2. What, exactly, is the required format for submissions?
As far as I can tell, block hashing requires hashing six variables, Version + hashPrevBlock + hashMerkleRoot + Time + Bits + Nonce. However, my previous impression was that hashing was a method for finding a nonce value, such that the nonce when hashed would produce a hash lower than the hash of the previous block. So, I am having trouble working through the logic. I am also struggling to understand what the file format for block submissions should be and how to format the file. It is not clear to me whether JSON or hexadigit format should be used nor how such file should be structured.
Any advice or suggestions would be sincerely appreciated.
References
[1]
https://bitcoincore.org/en/doc/0.16.0/rpc/mining/submitblock[2]
https://github.com/bitcoin/bitcoin/issues/26830