What Puzzle Bitcoin Miners Actually Solve?
To understand what problem Bitcoin miners solve we have to first understand what SHA-256 is
SHA-256 stands for “Secure Hash Algorithm” which is a Cryptographic Hash Algorithm.
A cryptographic hash (sometimes called ‘digest’) is a kind of ‘signature’ for a text or a data file. SHA-256 generates an almost-unique 256-bit (32-byte) signature for a text. What it means is whenever an SHA-256 algorithm is applied to any length of string or text, it will give back a unique 256-bit string like below. This is known as a hashing function.
An example of a 256-bit string:
EF9F171116ABFB430DD0920B081A62998CB6433C76503238D9A79FA4244A8884
This string will always be different for each string or content i.e. no two different strings in the world can have the same SHA2 even if they differ just by one bit. E.g. “My name is Crypto Purview” and “My name is CryptoPurview” will have different SHA-256. (Note there is just space difference between 2 strings)
SHA256 for My name is Crypto Purview is:
A1B02DA40FC6B104DAC8357E8B164264A0EA611E6C36F5E73A410CACBCBCFA62
SHA256 for My name is CryptoPurview is:
4D942ECCAAF6250853369F80EC0B84C68ED03C57BCF0DD60E3FFD01392D9F966
Try yourself to generate SHA-256 for a text string here. Let’s suppose I ask you to calculate SHA-256 of the below block of text, it will take you seconds using a simple algorithm to give me an answer.
start text
address10 -> 1 btc -> address23
address23 -> 0.5 btc -> address50
address21 -> 100 btc -> address200
address36 -> 0.001 btc -> address214
end text
Let’s take the above problem one step further and I ask you to calculate SHA-256 of the same block of text with one new line added on top of the text block called Nonce.
You can choose Nonce to be any number example 123234 or 22123 and move lines in any order. For example, you can swap the position of line 1 and line 2, but the resulting SHA256 should start with leading five 0s.
Something like below:
000003D4F9EB9395B6CD9692F6A37DF9EFCD607B64371AB3249C42D564378EF9
Let’s suppose in your first attempt you calculate it using below text block:
start text
Nonce:123456
address10 -> 1 btc -> address23
address23 -> 0.5 btc -> address50
address21 -> 100 btc -> address200
address36 -> 0.001 btc -> address214
end text
The SHA256 for the above combination of strings comes out to be:
7C4D90C28727BADC5DC32AB3CE16BC9ED733E4E570FD42BA420272A5304AFC2A
Hard luck for you, not starting with leading five 0s. You try this again with different Nonce values and arrange the above transactions in a different order. In order to crack this “puzzle”, miners use different permutations of Nonce value and order. This process consumes a lot of computation power.
In the actual world, these lines are unconfirmed bitcoin transactions and are 1000s in numbers and it takes a room full of GPUs to solve it through the try and fail method. The moment any miner hits the jackpot i.e. able to find SHA2 with leading required 0s, it will raise its hand and tell other miners the solution and claim the reward ‘Bitcoin’.
More the number of leading 0s required, more difficult it is to crack the puzzle as more permutation and combinations are required.
For example, the block ‘520282’ mined in Bitcoin network had SHA2 as follows: 0000000000000000003d05ef31993d1ddb80b6ef5632d0ae939ea1b22a24e150
and Nonce was 554703974.
You can check it from this link.
SHA-256 is used in several different parts of the Bitcoin network:
– Mining uses SHA-256 as the Proof-Of-Work algorithm.
– SHA-256 is used in the creation of bitcoin addresses to improve security and privacy.