TransWikia.com

Why are block header bits necessary? (Valid difficulty is already implied by chain history)

Bitcoin Asked by James C. on January 7, 2021

Difficulty or target is implied by chain history, so why does it need to be explicit in the header? I suppose it exposes miner-intended-difficulty, but I don’t see why that would be relevant without chain context.

So it seemingly represents redundant data in the header, unless there are any historical reasons for this design choice?

2 Answers

They aren't really necessary. The reason that they are included can only be known by Satoshi, and AFAIK, he did not state why he chose to include nBits in the block header (or many other things that are just arbitrary). This is one of the many things that Satoshi chose to do and no one really knows why. It remains in the block header today because removing it would require a hard fork and there really is not much benefit to be gained by removing it.

The nBits field can be useful, and it likely was included as a convenience sort of thing. Instead of having to have the full chain history in order to know the current difficulty, you can instead look at the nBits. But that is just speculation, and full nodes don't use the nBits to determine the current difficulty (except those of the genesis block).

Correct answer by Andrew Chow on January 7, 2021

Directly committing to the nbits allows you to determine how much work was used to produce the header statelessly before looking for (or fetching) information about prior headers.

This can help fend of DOS attacks sending junk headers to force you to do work determining or fetching their ancestors.

Answered by G. Maxwell on January 7, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP