When you hear about bitcoin “mining”, you see coins dug out of the ground. But bitcoin is not physical, so why do we call it mining?
Because it is similar to gold mining in that the existing bitcoins are the design of the protocol (just as gold exists underground), but they have not been brought into light yet (just as gold has not yet dug). The bitcoin protocol states that 21 million bitcoins will take place at some point. What “miners” do is take them out into the light, a few at a time.
They get to do it as a reward for creating blocks of authenticated transactions including them in the blockchain.
A little back, let’s talk about “nodes.” The node is a powerful computer that runs the bitcoin software and helps keep bitcoin running by participating in the transmission of information. Anyone can run a node, you just download the bitcoin software (free) and leave some port open (the disadvantage is that it consumes storage space energy – the network at the time of writing takes up about 145GB). Nodes distribute bitcoin transactions across the network. One node will send information to several nodes that it knows, who will transfer the information to nodes they know, etc. This way it eventually gets the entire network pretty quickly.
Some nodes are mining junctions (commonly referred to as “miners”). These group outstanding deals into blocks and add them to the blockchain. How do they do that? By solving a complex mathematical puzzle that is part of the bitcoin program, including the answer in the block. The puzzle that needs a solution is to find a number that, when combined with the data in the block and passes through the hash function, produces a result within a certain range. It’s much harder than it sounds.
(For trivia lovers, this number is called “nonce”, which is a chaining of “number once used.” In the case of bitcoin, the Inc is an integer between 0 and 4,294,967,296.)
How do they find that number? By random guessing. The hash function makes it impossible to predict what output will be. So, the miners guess the mystery number and apply the hash function to the combination of the number guessed the data in the block. As a result you have to start with a preset number of zeros. There is no way of knowing which number will work, because two consecutive integers will give wildly varying results. What’s more, there may be some nonces that produce the desired result, or there can be none (in which case miners continue to try, but with another block configuration).
The first miner to achieve a resulting hash in the desired range announces its victory to the rest of the grid. All other miners immediately stop working on this block and start trying to figure out the mystery number for the next one. As a reward for his work, the miner wins and gets some new bitcoin.
At the time of writing, the prize is 12.5 bitcoins, which at the time of writing is worth nearly $ 200,000.
Even though it did not seem almost as much a deal as it sounded. There are many nodes of mining competing for this prize, and this is a question of luck and computing power (the more guessing calculations you can make, you are lucky).
Also, the costs of being a mining junction are considerable, not only because of the strong hardware needed (if you have a faster processor than your competitors, you have a better chance of finding the right number before they do) but also because of the large electricity volumes that trigger the These processors consume.
And, the number of bitcoins awarded as a reward for the puzzle solution will decrease. It’s 12.5 now, but it halves every four years or so (the next is expected to 2020-21). The value of bitcoin relative to the cost of power and hardware can rise in coming years to partially compensate for this reduction, but it is not safe.
The difficulty of calculation (the required number of zeros at the beginning of the hash string) is often adjusted, so it takes an average of about 10 minutes to process a block.
Why 10 minutes? This is the amount of time that developers think bitcoin is necessary for steady and decreasing flow of new currencies until the maximum number of 21 million is reached (expected for sometime in 2140).
If you did it so far, then congratulations! There is still a lot more to explain about the system, but at least now you have an idea of the broad outline of genius of programming and concept. For the first time we have a system that allows convenient digital transfers in a distributed manner, without trust and sabotage proof. The implications can be enormous.