2

I am trying to write a miner for myself.

I understand I get the block template and then hash the block hashing blob. That gets me a hash.

Do I then append it to block hashing blob or something else in order to submit? Take this example: 070786a498d705f8dc58791266179087907a2ff4cd883615216749b97d2f12173171c725a6f84a00000000fc751ea4a94c2f840751eaa36138eee66dda15ef554e7d6594395827994e31da10

Or do I just need to replace the 8 zeroes?

Also is the difficulty returned by get block template the amount of zeroes at the start of the hash that need to be there in order for it to be solved? Or is there something else or am I misinterpreting it?

1 Answer 1

3

Do I then append it to block hashing blob or something else in order to submit?

No. You submit the block with your updated nonce (which can be in the header and / or the updated miner tx reserved space - whatever you changed).

Also is the difficulty returned by get block template the amount of zeroes at the start of the hash that need to be there in order for it to be solved?

No. Your hash (which is just a number), multiplied by the returned difficulty from get_block_template, must be less than or equal to 2^256-1.

Alternatively (using division), would be if 2^256-1 divided by your hash is greater than or equal to the returned difficulty from get_block_template.

The hash's leading zeros do not give enough precision to accurately determine if it meets the required difficulty, hence calculation (as above) is required.

A full example, in easy to follow Python, can be found in solo-block.py.

1
  • 1
    Okay now I get it. Thank you for the example that really solidified it!
    – Keiros
    Commented Dec 9, 2020 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.