0

I read in many places that mining involves finding nonce such that SHA256(SHA256 (blockheader_including_nonce)) meets a specific criteria (0 bits...).

Why is this hashing done only on the < 100 bytes of the block header? If it's only done on header, doesn't this mean we could modify a transaction in the block and keep the same block header and hash?

How is this not a weakness?

6

In fact, it is done over the whole block, but indirectly.

One of the members in the block header is the Merkle root hash of the transaction hashes. Effectively, that is a hash of all the transactions.

Because that field is included in the block header, the hash of the block header is effectively a hash of all transactions as well. If a transaction would change, its hash would change, the Merkle root would change, the block header would change, and finally the block hash would change as well.

Then why is this done? There are several reasons for the exact construction, but the most important one is probably the fact that it makes the speed of mining independent from the number of transactions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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