How Bitcoin Mining Works Last updated: But bitcoin isn’t physical, so why do we call it mining?
Because it’s similar to gold mining in that the bitcoins exist in the protocol’s design just as the gold exists undergroundbut they haven’t been brought out into the light yet just as the gold hasn’t yet been dug up.
The bitcoin protocol stipulates that 21 million bitcoins will exist at some point. What “miners” do is bring them out into the light, a few at a time. They get to do this as a reward for creating blocks of validated transactions and including them in the blockchain.
Cryptocurrency Mining Calculators
Nodes Backtracking a bit, let’s talk about “nodes. Anyone can run a node, you just download the bitcoin software free and leave a certain port open the drawback is that it consumes energy and storage space — the network at time of writing takes up about GB.
Nodes spread bitcoin transactions around the network. One node will send information to a few nodes that it knows, who will relay the information to nodes that they know, etc. That way it ends up getting around the whole network pretty quickly. Some nodes are mining nodes usually referred to as “miners”.
How Bitcoin Mining Works
These group outstanding transactions into blocks and add them to the blockchain. How do they do this? By solving a complex mathematical puzzle that is part of the bitcoin program, and including the answer in the block. The puzzle that needs solving is to find a number that, when combined with the data in the block and passed through a hash function, produces a result that is within a certain range.
This is much harder than it sounds. For trivia lovers, this number is called a “nonce”, which is a concatenation of “number used once. Solving the puzzle How do they find this number? By guessing at random. The hash function makes it impossible to predict what the output will be.
So, miners guess the mystery number and apply the hash function to the combination of that guessed number and the data in the block. The resulting hash has to start with a pre-established number of zeroes. There’s no way of knowing which number will work, because two consecutive integers will give wildly varying results. What’s more, there may be several nonces that produce the desired result, or there may be none in which case the miners keep trying, but with a different block configuration.