Blockchain hashing puzzles. Mining

Gepubliceerd op 3 augustus 2021 om 17:50

The hashing puzzle is an essential part of the blockchain technology if the 'proof of work' consensus is used. In this article, I will discuss the hashing puzzle. I will first discuss two consensus protocols (proof of work and proof of stake). Then I will discuss the technique of the hashing puzzle (how does it work? And what is a 'nonce'?) Finally, I will discuss why people invest money in hardware to solve hashing puzzles.

There are various consensus protocols in the blockchain world. In short, these are mechanisms which ensure that a transaction is verified on the blockchain. These protocols are indispensable in the blockchain. The best-known protocols are the proof of work and the proof of stake protocols. These protocols essentially do the same thing, namely verify information on the blockchain. However, the technology behind them differs fundamentally from each other.

In the proof of work consensus protocol, the node (a user in the system) that has the most processing power becomes the one who is allowed to verify the information on the blockchain. This node then receives a reward for verifying the information ('Block reward'). This will often be in the form of crypto currencies (Bitcoin, Ethereum, etc.). This verification process is also popularly referred to as 'mining'. These are users in the blockchain system who compete against each other to be allowed to verify the information on the blockchain. Only the person with the most processing power (the one who solves the hashing puzzle) is allowed to verify this information on the blockchain. In order to stay ahead of the competition, so-called "mining farms" have been created. Mining farms contain hundreds (whether or not thousands) of computers that try to verify information on the blockchain day and night. An 'ordinary' Apple computer does not have enough computer power to verify information on the blockchain.

The other commonly used consensus protocol is the proof of stake protocol. This protocol does not use the computing power of computers to verify information on the blockchain, but the one who holds the most cryptographic currency (or other type of possession). This miner is the one who may verify the information on the blockchain.
The great advantage of this protocol is that the power consumption is zero. In the proof of work consensus, on the other hand, electricity consumption is high. There is therefore much criticism of this high consumption (which is not entirely unjustified). Another risk of the proof of work protocol is monopolisation (centralisation), in which a number of powerful miners own more than 50% of the hash capacity. As a result, a decentralized system actually becomes a 'centrally' controlled system.

In order to be able to mine (verifying transactions on a blockchain) through the proof of work protocol, the node with the most processing power must solve a hasing puzzle. How does this work?

First there must be information or data. This information is then converted into a hash value. This is nothing other than that input (information) is converted into output (a hash value). This hash value is a series of letters and numbers. The input ''Hi!'' generates the output ''B980147E''. Each time ''Hoi!'' is used as input, the same hash value will be generated as output. The special thing about information hash is that this is a one-way traffic. Input provides the same output, while output cannot be converted into input. So you cannot 'un-hash' a hash value to the original input. The output will also change if the input changes. The input ''Hi!!!'' generates an output of ''84DE0947''. Currently, the SHA-256 hashing protocol is the safest hashing protocol available. In combination with asymmetric encryption, storing information in the blockchain is therefore very secure. This combination is also known as the 'digital signature'.

An important part of solving the hashing puzzle is the 'restriction' or 'difficulty'. This is a rule that determines how difficult it is to solve a puzzle. This level of difficulty may vary from blockchain system to blockchain system. An example of a difficulty is that at the input ''Hi'' an output is created with five zeros for the output, or that only two zeros are created for the output. The person who finds this the quickest (in other words: most computer power) solves this puzzle and receives a reward. See below for an example of how the level of difficulty in the blockchain works:

In this picture you see the input 'Cheesecake' and the level of difficulty: find a hash value (output) that starts with the letter 'A'. After 15 attempts the corresponding hash value is found. In the second example, the input is 'Ice ice baby - too cold!' and the difficulty level is determined on the output that should start with the word 'Hi'. After 1797 attempts this output is found. The more difficult the difficulty level, the longer it takes to solve the puzzle (and the more computer power is required). The level of difficulty will never be so difficult that no user will be able to solve the hashing puzzle. Because otherwise, the mining and using of the blockchain system would no longer be attractive (but so difficult that ordinary computers can't solve it).

Another important component of the hashing puzzle is the 'nonce' (the number sequence after 'Cheesecake' in the previous picture). The nonce is a number that miners use to find the correct hash. The miner guesses a valid hash, by entering the correct nonce in an algorithm. In this way, the miner guesses a valid hash. The nonce stands for 'number used once'. The nonce is used to increase communication security against hackers trying to carry out attacks. A nonce is a random number intended for single use, and can sometimes be combined with a timestamp that ensures that the identity of the nonce is associated with a single time value.

So the entered data plus a random nonce must generate an output that is in line with the level of difficulty. If this is the case, then the puzzle is solved. The result is also called the 'solution'. Please note that guessing the correct hash value (and therefore actually the nonce) takes a lot of computer power and time. This is due to the concept of 'trial and error'. The miner keeps guessing until the hash value corresponds to the current level of difficulty. The data remains the same, but the miner enters a different nonce each time the hash value does not match the difficulty level. See the picture below for a schematic representation of the hashing puzzle:

Why would you want to invest in computer power to verify information on the blockchain? The answer is simple: it is profitable (if you know what you are doing). If you look at the value of Bitcoin, the price of Bitcoin is EUR 32k (3 August 2021) and the price of Ethereum is EUR 2k (3 August 2021). So it is 'big business'. But on the other hand, there is an investment that has to be recouped. The strongest Intel processor currently costs +/- USD 1600. The miner needs a number of these processors to have a chance at all to verify the information on the blockchain. Not everyone, like Scrooge McDuck will be able to swim in a swimming pool full of money. The chances are that the investment made cannot be recouped. This is because the mining and crypto sector is very volatile and has great risks.

I published this article previously on my LinkedIn page. This article was written on May 14 2020 and slightly modified on August 3, 2021.

BTC address: bc1q3nnm8m2vrsv8med8a38dl37g8l3mm4wa7ph7wj 

ETH address: 0x38b84E2D3B50F83A067A7488C1733180651f418A

Reactie plaatsen


Er zijn geen reacties geplaatst.