The Ethereum Classic (ETC) mining difficulty parameter may seem mysterious to some. I will showcase it has a beautiful effortless to understand interpretation.
Some ETC network computers receive prizes for creating, distributing and validating the blocks of the ETC blockchain. This work is referred to spil mining and the computers spil miners. To create valid blocks, miners keep adjusting random numbers ter those blocks until corresponding 256 bit hashes meet a certain requirement. The random numbers are referred to spil nonces. The hash requirements involve a number referred to spil the difficulty. For a hash value H and difficulty d, this is the requirement:
The probability of an arbitrary hash meeting the requirement is equal to the number of acceptable hashes divided by the number of possible hashes. Ter other words, for a difficulty d, this probability is equal to the following:
I will now showcase that d equals the average required number of hashes to find an acceptable nonce. I will do this very first using software and 2nd using calculus:
Software Based Derivation — The following Python program finds the average required counts of random numbers, inbetween zero and one, to obtain values less than 1 / d for various values of d:
Here is the output:
The errors can always be made smaller by averaging overheen a larger quantity of numbers. Clearly the average count is the difficulty.
Calculus Based Derivation — The probablity of a hash count of one is 1 / d. The probability of a hash count of two is (1 / d)(1 – 1 / d). The probability of a hash count of three is (1 / d)(1 – 1 / d) , etc. The average hash count is the sum of the products of thesis probabilities and their corresponding hash counts:
Let A(x) be a function based on this expression such that the average hash count is A(1):
Here is an antiderivative of A(x):
This is equal the following geometric series divided by d – 1:
Using the formula for an infinite geometric series, this can be shown to equal:
Since A(x) is equal to the derivative of its antiderivative, A(x) is equal to the derivative of the above expression divided by d – 1:
Clearly the average hash count A(1) = d.
The mining difficulty can be understood spil the average number of hashes required to find a valid nonce. If it wasgoed mysterious before, hopefully now it is less so.
Feel free to leave any comments or questions below. You can also voeling mij by clicking any of thesis icons:
I would like to thank IOHK (Input Output Hong Kong) for funding this effort.
This work is licensed under the Creative Commons Attribution ShareAlike Four.0