Written by : joel nzoda on Digilah (Tech Thought Leadership)
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:
93ef6f358fbb998c60802496863052290d4c63735b7fe5bdaac821de96a53a9a
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:
10000000000000000000000000000000000000000000000000000000000000
any number that starts with a zero would be accepted and considered below target. Example:
0787a6fd6e0782f7f8058fbef45f5c17fe89086ad4e78a1520d06505acb4522f
If we decrease the target to:
01000000000000000000000000000000000000000000000000000000000000
we need a number starting with two zeros:
00db27957bd0ba06a5af9e6c81226d74312a7028cf9a08fa125e49f15cae4979
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
Ethereum price
Bitcoin price
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