How to generate a block header?


good afternoon

I set myself a task to understand the work of the miner, but as you understand it is difficult for a beginner. Constantly there are questions. Without conditionally, I turn to Google search and find the answers but not always.

Guys help sort out a few points

How to compose a block header? I appeal to the instructions on such sites as:

I understand the headline is formed by the principle: Version + prevhash + merkle_root + ntime + nbits + '00000000' + '000000800000000000000000000000000000000000000000000000000000000000000000000080020000'

Where merkle_root should be in the reverse order of the byte and only it. But other sources and sources give different examples of header formation. Someone does not translate merkle_root in the reverse order of a byte, but translates ntime and nbits

The question is how to properly form the header of the block and what incoming data should be specified in the reverse order of the byte. Most likely something I do not understand until the end and I hope for help.

And can someone tell me a good manual

Maxim Lavr

Posted 2017-08-04T15:59:48.097

Reputation: 1

The best documentation, and the only one that's truly authoritative, is the Bitcoin Core source code.

– Nate Eldredge – 2017-08-04T16:14:24.863


possible duplicate of

– Nick ODell – 2017-08-04T17:25:43.793