Author

Topic: Bitcoin header help... (Read 114 times)

newbie
Activity: 2
Merit: 0
January 19, 2024, 01:16:07 PM
#3
Brilliant, thank you. I had no clue these were SHA256 prefix/suffix-related. I really appreciate it, thanks!

This looks like SHA256 related values.
The first one 0x80 is the SHA-2 specific padding used at the end of the message (1 followed by m 0)[1].
The second one (0x0280) is the message length in bits added at the end of the final [SHA2] block. We have an 80-byte header so 80 byte message * 8 = 640 bits or 0x0280

[1] https://datatracker.ietf.org/doc/html/rfc6234#section-4
legendary
Activity: 3472
Merit: 10611
January 09, 2024, 11:22:11 PM
#2
This looks like SHA256 related values.
The first one 0x80 is the SHA-2 specific padding used at the end of the message (1 followed by m 0)[1].
The second one (0x0280) is the message length in bits added at the end of the final [SHA2] block. We have an 80-byte header so 80 byte message * 8 = 640 bits or 0x0280

[1] https://datatracker.ietf.org/doc/html/rfc6234#section-4
newbie
Activity: 2
Merit: 0
January 09, 2024, 09:21:39 PM
#1
So... I was going through the CPUMiner code (... YES, I know CPU mining is dead, I'm just using this code as an educational way to learn how BTC blocks and transactions are assembled) and was wondering about these two lines:

   work->data[20] = 0x80000000;
   work->data[31] = 0x00000280;

in the block header setup. Any idea why these values are important to set? From reading the BTC specs, I thought the header padding from +20 onwards was all supposed to be 0's..?

So confused newbie to the bowels of BTC... any help appreciated, thanks.
Jump to: