What does the bitcoin target really mean – part 2

By | April 8, 2015

I’ve done a lot of reading trying to figure out what a bitcoin target really means and after reading over 10 different explainations, over several days, I think I finally understand. Here are some of the basics.

1. You’ll see people talk about the maximum target of: 0x00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF. What the heck does this mean and why?

First of all, this is a good post (https://bitcointalk.org/index.php?topic=8928.0) on why isn’t the maximum target FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF?

64 ‘F’s in hex represents 256 1’s in binary which represents 1.1579208923732E+77 in decimal. ie a very large number. If this was the target, then every single hash would be lower than the target so it is logical why 64 ‘F’s cannot be the maximum target.

So it was decided that eight ‘0’s would be placed in front leaving 56 ‘F’s. This represents 2.6959946667151E+67 which is still a very big number but it’s less than 1.15E+77. Converted to binary, it has 32 leading ‘0’s. This is where you’ll hear people talk about discovering a hash with so many leading zero’s coz people are talking in binary. The more leading zero’s, the lower the target, meaning in decimal the number is lower, hence the difficulty becomes higher.

So far so good?

2. You’ll see people refer to the target as the “bits” field or a “compact” format of the target. That is exactly what it is. Another representation but in a shorter format. Remember that everyone is trying to save bandwidth so the less data that needs to be transmitted, the better.

An example bits field looks like:
bits: “18163c71” or 0x18163c71. Essentially 8 characters or 4 bytes. (because 1 hex char = 4 bits which is a nibble so 2 hex chars represents 1 byte, you can figure out the rest!)

To convert this “bits” field which is in hex to target, again in hex, we follow this formula.

target = coefficient * 2^(8 * (exponent – 3))

The first two hexadecimal digits is for the exponent and the next six hex digits is the coefficient.
In the example 18163c71, the exponent is 0x18 and the coefficient is 0x163c71. (0x just means what follows is hex).

target = 0x163c71 * 2^(0x08 * (0x18 – 0x03))
⇒ target = 0x163c71 * 2^(0x08 * 0x15)
⇒ target = 0x163c71 * 2^0x78
which in decimal is:
⇒ target = 1,457,265 * 2^120

⇒ 1,937,037,435,277,505,429,527,166,395,699,436,338,544,640 (via https://defuse.ca/big-number-calculator.htm) or 1.9370374e+42

Now to convert this back to hex gives: 163C71000000000000000000000000000000 (via http://www.mobilefish.com/services/big_number/big_number.php) of which I can add 28 ‘0’s in front if I wanted to make it a nice 64 length target.

0000000000000000163C71000000000000000000000000000000000000000000

To confirm, you can visit http://blockexplorer.com/q/hextarget (See following screenshot).

target

3 thoughts on “What does the bitcoin target really mean – part 2

  1. Pingback: How 59 days was calculated from the Mastering Bitcoin book? | An Integrated World

  2. Pingback: What do bitcoin miners do all day long? | An Integrated World

  3. Pingback: Going POW on the Blockchain – Talk Crypto Blog

Leave a Reply

Your email address will not be published. Required fields are marked *