1
The bits field is the compact representation of the target.
Example:
bits: 1d00ffff
target: 00ffff0000000000000000000000000000000000000000000000000000
bits: 1cfff00
target: ffff0000000000000000000000000000000000000000000000000000
But these two actually represent the same number.
int(target) -> 26959535291011309493156476344723991336010898738574164086137773096960
for both of the above targets.
What (if anything) makes bits a unique representation of the target?
Clarification:
In regular interactions with numbers, this kind of thing doesn't really matter, as a few leading zeros don't affect how we interpret the number. However, in Bitcoin, the bits field is used as part of the hash of the block. Therefore, a different bits representation would produce a different hash of the block.
Thanks, I understand the question now. – Nate Eldredge – 2019-04-18T15:25:47.377
@NateEldredge Thanks for pointing this out. I've added a clarification to the question. – Stephen Cowley – 2019-04-18T15:28:40.910
Some related fun, try and establish why the there is a sign bit in the target. – Anonymous – 2019-04-18T15:40:22.527
@Anonymous Is there a sign bit? – Stephen Cowley – 2019-04-18T15:45:02.543
There is a sign bit. – Anonymous – 2019-04-18T16:05:20.373
See the answer over here for representation of sign bit. https://bitcoin.stackexchange.com/questions/48707/difficulty-target-representation-in-bitcoin-wiki
– Ugam Kamat – 2019-04-19T05:16:19.877