When you hear: mining of bitcoins, you imagine that coins are extracted from the ground. Bitcoin does not exist physically, so why do we call it mining?
Because it is similar to gold mining, because bitcoins exist in the draft protocol (as gold exists underground) but have not yet been released into the daylight (just as gold has not yet been dug). The bitcoin protocol predicts that at some point there will be 21 million bitcoins. What „miners” do is bring them to the light, several at a time. They do this as a reward for creating blocks of verified transactions and including them in the block chain.
Going back a bit, let’s talk about „nodes”. A node is a powerful computer that runs bitcoin software and helps keep bitcoins active by participating in information transfer. Anyone can run the node, just download the Bitcoin software (free) and leave the port open (the disadvantage is that it consumes energy and storage space – the network at the time of writing takes about 145 GB). Nodes distribute bitcoin transactions over the network. One node will send information to several nodes that it knows, which will pass information to nodes they know, etc. This will quickly pass through the entire network.
Some nodes are search nodes (usually referred to as „miners”). These groups divide transactions into blocks and add them to the blockchain. How do they do it? Solving a complicated mathematics puzzle, which is part of the bitcoin program and contains the answer in the block. The puzzle that requires a solution consists in finding a number that, in combination with the data in the block and transmitted by the hash function, gives the result of hashing to a certain extent. It is much harder than it seems.
(For lovers of curiosities, this number is called „nonce”, it is an abbreviation of (eng. number used once), i.e. the number used only once. In the case of bitcoin, nonce is an integer from 0 to 4,294,967,296.)
Solving a puzzle
How do they find this number? Guessing randomly. The hashing function makes it impossible to predict what the result will be. So miners guess the mysterious number and use the hash function to combine that number and the data in the block. The resulting abbreviation must begin with a fixed number of zeros. It is not possible to check which number will work because two consecutive integers will give wildly variable results. What’s more, there may be several nonce’s that give the desired result, or they may not be (in this case the miners are still trying but with a different block configuration).
The first miner who has obtained the hash result in the desired range announces victory for the rest of the network. All other miners immediately stop working on this block and start trying to find the secret number next. As a reward, the winning miner gets a bit of a new bitcoin for his work.
Although it is not as easy to earn as it seems, there are many mining nodes competing for this prize, and it’s a matter of luck and computing power (the more guessing you can do, the more happiness you have).
In addition, the costs associated with being a mining node are significant, not only because of the need to have powerful equipment (if you have a faster processor than competitors, you have a better chance of finding the right number before they do) but also because of the large amount of electricity consumed by these processors.
The number of bitcoins awarded as a prize for solving a puzzle will be reduced. It is currently 12.5, but it is halved every four years (the next is expected in 2020-21). The bitcoin value in relation to the cost of electricity and equipment may increase over the next few years to partially compensate for this reduction but it is not certain.
The degree of calculation difficulty (the number of zeros required at the beginning of the hashing sequence) is often adjusted, so the processing of the block takes on average about 10 minutes.
Why 10 minutes? This is the time that the creators of bitcoins consider necessary for a steady and declining flow of new coins, up to a maximum of 21 million (expected in 2140).
If you have come this far, then congratulations! There is still much to explain about the system, but at least now you have an idea about the general outline, programming genius and concept. For the first time, we have a system that allows for convenient digital transfers in a decentralized way, free from power organs and resistant to manipulation. The effects can be huge.