I understand the role that the nonce plays in the block header for calculating a hash for a valid proof of work.
But what I ask is: Do we consider the nonce in the prevBlockHash
calculation of the previous block because, well, it's in the block header already (for the proof-of-work calculation), and it would be silly to write a calcPrevBlockHash
function that calculates the previous block's header by ignoring the nonce?
Or is there a specific security property or assurance that we get when including the nonce in the prevBlockHash
calculation of the subsequent block?
For instance, you could argue that we hash the timestamp because we want to capture the time that the block was generated. See answer here: Why the timestamp component of the block header? I guess you can argue the same for the nonce field.
But I claim that we could still have the nonce in the block header, and not hash it during the prevBlockHash
calculation of the subsequent block, and things would still work. You would still be (a) able to validate this block, and (b) unable to mess around with the transactions in the block, because that would modify the hashMerkeRoot
field, and thus render the block invalid.
prevBlockHash
. – Kostas Jul 27 '16 at 18:10prevBlockHash
hash? Or is it something along the lines of: "Well, it's part of the header because we need it there to calculate the proof-of-work. We actually don't need to include it when doing theprevBlockHash
thing (we don't get any extra warranties by doing so), but it would be overkill to code acalcPrevBlockHash
function that ignores thenonce
field, so we just include it as well in ourprevBlockHash
calcuation." – Kostas Jul 27 '16 at 18:11hashBlockHeader()
is what you use for the proof-of-work calculation and theprevBlockHash
calculation now. (Note: made-up function names.) All I'm asking is: If you were to calculateprevBlockHash
using acalcPrevBlockHash()
function that ignores the nonce field, would that break anything? Would you lose any security properties that would currently have? – Kostas Jul 27 '16 at 18:31