The sha256( sha256( BlockHeader ) ) function used in the bitcoin hashing algorithm is believed to be very reliable. It is so reliable that there is only one way to pick up the golden nonce for the next block in the blockchain - by brute forcing during the mining process.

Currently, there are already over 530,000 blocks in the bitcoin blockchain. This is enough to perform a statistical analysis and answer the question, "are the bit values in the previously found nonsense really equally likely?".

The simplest statistical analysis can be done not on the whole blockchain, but only on the last few thousand blocks. This would require taking this information from, for example, btc.com. This blockchain explorer has quite an advanced api, which we will use. Let's write a simple script that uses requests library to download information about last 2000 blocks. I am interested in only one value - nonce, and I will write it to text file together with block number.

Reply to this note

Please Login to reply.

Discussion

Run the script and wait for it to finish. You will get a file like this with 2,000 lines:

Now let's divide this sample into groups of 100 values and perform statistical analysis on each group. Nonce is a 32-bit number. It stands to reason that every bit of the nonce is equally likely to take a value of one or zero. This is what I am going to check. I will write a script that counts the number of ones in each bit position in a group of 100 nonces.

You can see that some bits in the bitcoin nonce are not equally probable in their value and the graphs are shifted downwards. So the bit value is still slightly more likely to be zero than one.