# Part two how mining works! nonce hash block target

Part two how mining works!

last time we discussed the block, but in particular varying the nonce and what effects this has when mining bitcoin. We now know that we can control or vary the hash of the block by varying the nonce. So how does this tie in with mining? The first thing that we’re going to need to do is to make a statement, and the statement is… Hash is a number.

Here’s an example of a hash!

This is a SHA 256 hash, it takes up 64 bits, 64 digits, 256 bits, and the statement is that this hash is actually a number, it’s not just a word, it’s not just a combination of characters, it’s an actual number that you can increment and do mathematical operations with. A hash is actually a hexadecimal number using digits from 0 to 9 and also letters a b c d e and f. A hexadecimal number utilises the letters as numbers following on from 9 with A representing 10, B representing 11 and so on.

We can actually convert this hexadecimal number into a normal decimal number and it’ll look like this…

106389882839426427283177777942538648599766085367251052543954729312376210781336 (Decimal number)

So there’s our decimal representation of our hexadecimal number, as you can see the number is visually longer and that’s because in the decimal system we only have nine digits, whereas in the hexadecimal system we have 10 digits. In the hexadecimal system we have 16 digits, therefore every digit can encode a higher value, visually the number is shorter but in essence the overall value of the number is actually exactly the same, it’s just represented in a different system. We could take a decimal number and convert it to a binary, ones and zeros, it’ll be very long but it’ll still be the same number, just represented in a different system.

Lets use an example of 3 different hash values to discuss leading zeros in a hash value.

1.eb368a2dfd38b405f014118c7d9747fcc97f4f0ee75c05963cd9da6ee65ef498
2.000000000038b405f014118c7d9747fcc97f4f0ee75c05963cd9da6ee65ef498
3.0000000000000000000000000000000cc97f4f0ee75c05963cd9da6ee65ef498

As you can see, at the begining of two of the hash values we have an icreasing amount of leading zeroes in example 2 and 3. This is just to illustrate that the visual length of this number is the same as the previous one. They all contain 64 characters or digits in length. If we convert these to a decimal number, the number gets shorter as more zeros are leading the hash value.

A hash value with more leading zeros is considered more difficult to generate and is therefore considered more valuable. Miners compete to generate a hash value that meets certain such as having a certain number of leading zeros. Having more leading zeros in a hash value means that the output value is smaller than the target value set by the proof-of-work algorithm, and this requires more computational power and time to generate. On the other hand, a hash value with fewer leading zeros is easier to generate, and it requires less computational effort.

Block target

The block target refers to the target value that the hash of a block must meet in order to be considered valid and be included in the blockchain. The target value is a 256-bit number that acts as a threshold for the proof-of-work algorithm used in the network. Miners compete to generate a block by computing hashes of various data in the block, such as transaction information and a reference to the previous block’s hash. The goal is to generate a hash that is less than or equal to the target value, which is set by the Bitcoin protocol to ensure a consistent rate of block generation and to prevent the network from being flooded with too many blocks in a short period of time.

The target value is dynamic and adjusts every 2016 blocks (approximately every 2 weeks) to ensure that the average time to generate a block remains close to 10 minutes, regardless of the total computational power of the network. A higher target value means that it is more difficult to generate a valid block, and a lower target value means that it is easier.

The block target is an important aspect of the security of the Bitcoin network, as it ensures that a certain amount of computational effort is required to add new blocks to the blockchain and prevent malicious actors from creating fake blocks and manipulating the network.

2 Likes

Another well written piece dude

3 Likes

Thats interesting itvtakes 10 mins per block regardless of the total computational power of the network . Is it even possible to create fak3 blocks