Miners perform cryptographic hashes (two successive SHA256) on what is called a block header. For each new hash, the mining software uses a different random number called the nonce. The nonce is an integer value with 32 bits of memory allocated to it.
This means that it is limited to only around 4 billion possibilities, which with the network’s current hashing power is largely insufficient. We therefore add in the hash timestamp of the block in Posix time , constantly updated. Another variable element on which minors can play: the arrangement of transactions.
Including the block number, timestamp, nonce, block data and hash of the previous block, the hash produced will look like this:
This hash can be converted into a very long number. (It is a hexadecimal number, which means that the letters AF are the numbers 10-15). To make mining difficult, there is something called target difficulty.
To create a valid block, a miner must find a hash that is below the target difficulty. For example, if the difficulty is:
any number that starts with a zero would be accepted and considered below target. Example:
If we decrease the target to:
we need a number starting with two zeros:
Because the target is a bulky number with many digits, a simpler number is usually used to express the current target. This number is called the mining difficulty. Mining difficulty is scaled to the first block created. Which means that a difficulty of 70,000 means 70,000 times more computing power than it took Satoshi Nakamoto to generate the first block, when he was the only miner and only using the CPU of a computer.
When mining a block, miners include a timestamp in the block. Since 2016, this ” timestamp ” allows the network to adjust to the passage of time by calculating the median time spent (MTP), that is to say the median of the timestamps of the last 11 blocks. To be valid, a timestamp cannot be more than two hours in the future relative to the node’s subjective time.
The difficulty changes every 2016 block. The network adjusts the difficulty so that the generation time of these 2016 blocks is 14 days, regardless of the computing power deployed.
Therefore, the difficulty follows the power of the network. The adjustment algorithm is as follows: if the time measured in the period of 2016 blocks is less than 20,160 minutes (expected time), then the difficulty increases to comply with the assumed computing power; if it is higher, then the difficulty decreases. Retargeting is limited to a factor of 4 (multiplication as division) to avoid instabilities.
Most searched question
What is cryptocurrency?
What is bitcoin and how does it work?
Most searched queries
Hello readers! Hope you liked what you read today. Click the like button at the bottom of this page and share insights with your colleagues and friends!
For more such amazing content follow Digilah