## Significance of the "hash" field reported by the 'bitcoin-cli getblock' command

1

It is stated that the header of a block does not contain a 'hash' field ( see https://en.bitcoin.it/wiki/Block_hashing_algorithm or Antonopolous' Mastering Bitcoin 2nd Ed. ) This makes sense since inlcuding such a field would be self-referential.

However, when interrogating the blockchain for info on a specific block for example via 'bitcoin-cli getblock' a 'hash' field is reported:

{
"hash":  "00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048",
"confirmations": 534047,
"strippedsize": 215,
.
.
.


Is the "hash" field something that the 'bitcoin-cli' calculates and inserts in situ into the json for informational purpouses

OR

is it that the "hash" field >is< actually part of the header and my understanding of this aspect is flawed?

## Answers

4

Is the "hash" field something that the 'bitcoin-cli' calculates and inserts in situ into the json for informational purpouses

This is correct. The block contains all of the info necessary to compute the hash, so as you mentioned, including it would be unnecessary and self-referential.

As one of the steps taken to confirm the block as being valid, bitcoind will calculate the hash and check it against the network difficulty. Using the getblock command returns this hash, among other info (not all of which is explicitly included in the block, but can be calculated locally with the available info).