Today I am doing a post on the “Hash” function that’s crucial to mine a crypto and essential to the blockchain security infrastructure.
The “Explain It Like I’m Five” Version
Consider the following example:
I tell three friends that I’m thinking of a number between one and 100, and I write that number on a piece of paper and seal it in an envelope. My friends don’t have to guess the exact number; they just have to be the first person to guess any number that is less than or equal to the number I am thinking of. And there is no limit to how many guesses they get.
Let’s say I’m thinking of the number 19. If Friend A guesses 21, they lose because of 21>19. If Friend B guesses 16 and Friend C guesses 12, then they’ve both theoretically arrived at viable answers, because of 16 < 19 and 12 < 19. There is no “extra credit” for Friend B, even though B’s answer was closer to the target answer of 19.
Now imagine that I pose the “guess what number I’m thinking of” question, but I’m not asking just three friends, and I’m not thinking of a number between 1 and 100. Rather, I’m asking millions of would-be miners and I’m thinking of a 64-digit hexadecimal number. Now you see that it’s going to be extremely hard to guess the right answer.
Here is an example of how the Hash is used
If we take the sentence “Donkeys live a long time” and wish to encrypt it
We apply hash algorithm to it, we will get 6e04f289.
This value is known as a hash.
What Is a “64-Digit Hexadecimal Number”?
Crypto miners need to solve for a 64 digits hexadecimal number provided to them to reach the solution
Here is an example of such a number:
The number above has 64 digits.
As you probably noticed, that number consists not just of numbers, but also letters of the alphabet. Why is that?
To understand what these letters are doing in the middle of numbers, let’s unpack the word “hexadecimal.”
As you know, we use the “decimal” system, which means it is base 10. This, in turn, means that every digit of a multi-digit number has 10 possibilities, zero through nine.
“Hexadecimal,” on the other hand, means base 16, as “hex” is derived from the Greek word for six and “deca” is derived from the Greek word for 10.
In a hexadecimal system, each digit has 16 possibilities. But our numeric system only offers 10 ways of representing numbers (zero through nine). That’s why you have to stick letters in, specifically letters a, b, c, d, e, and f.
Use in the Mining Process
If you are mining crypto, you do not need to calculate the total value of that 64-digit number (the hash).
In crypto mining terms, that metaphorical undisclosed number in the envelope is called the target hash.
What miners are doing with those huge computers and dozens of cooling fans is guessing at the target hash.
Miners make these guesses by randomly generating as many “nonces” (number only used once) as possible, as fast as possible and the nonce is the key to generating these 64-bit hexadecimal numbers.
In Bitcoin mining, a nonce is 32 bits in size—much smaller than the hash, which is 256 bits. The first miner whose nonce generates a hash that is less than or equal to the target hash is awarded credit for completing that block and is awarded the spoils of 6.25 BTC.
The difficulty level of the most recent block at the time of writing is about 17.59 trillion, meaning that the chance of any given nonce producing a hash below the target is one in 17.59 trillion. Not great odds if you’re working on your own, even with a tremendously powerful mining rig.
As this is a slightly complex subject, I will stop here and let you digest.
More to follow
For further guidance please contact on firstname.lastname@example.org or +919920741569
Follow my twitter handle irreverentinvestor @manver1974 for more such shares