2

Why is the target converted to "Bits" and not stored in full in the block header?

For example, why:

{
"hash" : "000000000003ba27aa200b1cecaad478d2b00432346c3f1f3986da1afd33e506",
"height" : 100000,
"bits" : "1b04864c",
"difficulty" : 14484.16236123,
}

and not:

{
"hash" : "000000000003ba27aa200b1cecaad478d2b00432346c3f1f3986da1afd33e506",
"height" : 100000,
"target" : "000000000004864c000000000000000000000000000000000000000000000000",
"difficulty" : 14484.16236123,
}

Is it to save space?

  • 1
    There isn't a need for that level of accuracy, but there is a need to conserve space in the header, because clients typically store the block headers in RAM. – morsecoder Apr 3 '15 at 18:55
3

Your rendition is longer if nothing else, the entire header is only 80 bytes long. The encoding of "bits" is historical and is left over from the pre-release 0.1.0 client. There's other things in the header which could have been encoded better (the nonce should have been longer, and the version read as a bitfield not an int, and an aux merkle root would have been nice), but as it is there's no really great reason to change anything due to the amount of inertia behind the current formation.

| improve this answer | |
  • What do you mean by aux merkle root? Also, it'd be nice to have accurate times in both the header (and associated w/ individual Txs) – Wizard Of Ozzie Apr 4 '15 at 5:06
  • A dedicated part of the merkle tree just for axillary data like UTXO commitments. Timestamps on transactions would be completely meaningless, they only exist to allow for difficulty adjustments. There's no use for them that wouldn't rely on them being correct to some degree, if there was a way of making sure the timestamps were correct we wouldn't need a block chain to begin with. – Anonymous Apr 4 '15 at 7:14
  • 1
    "historical"? Does this mean there is no current use for bits in the block header? I am wondering why it is there at all, assuming a full node syncs from block 0 and can calculate difficulty on its own for each block... – pinhead Apr 12 '17 at 19:54

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.