When you hear bitcoin mining, you probably imagine Bitcoin mining in a mine like gold. But Bitcoin isn’t physical, so why do we call it mining?
Because it’s similar to gold mining in that bitcoins exist in the design of the protocol (just like gold exists underground), but they haven’t come to light yet (just like gold has not yet been unearthed). The bitcoin protocol states that 21 million bitcoins will exist at any given time. What the “miners” do is shine a light on them, 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.
A node is a powerful computer that runs the bitcoin software and helps Bitcoin run by participating in the information relay. Anyone can run a node, just download the bitcoin software (free) and leave a port open (the downside is that it consumes power and storage space – the network at the time of writing takes about 145GB). The nodes propagate bitcoin transactions around the network. A node will send information to a few nodes that it knows, which will relay the information to the nodes that it knows, etc. That way, it will end up bypassing the entire network pretty quickly.
Some nodes are data mining nodes (generally referred to as “miners”). These groups the ongoing transactions 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, and including the answer in the block. The puzzle that needs to be solved is to find a number which, when combined with the data in the block and passed through a hash function, produces a result that is within a certain range. It’s a lot harder than it sounds.
How to solve this mathematical puzzle? By guessing at random. The hash function makes it impossible to predict the output. So the 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 must start with a preset number of zeros. There is no way to know which number will work, as two consecutive integers will give extremely variable results. Additionally, there may be multiple nonces that produce the desired result, or there may not be (in this case, miners keep trying, but with a different block configuration).
The first miner to obtain a hash resulting in the desired range announces his victory to the rest of the network. All other miners immediately stop working on that block and start trying to find the mystery number for the next one. As a reward for their work, the winning miner gets a new bitcoin.
the cost of a mining node is considerable, not only because of the powerful hardware it needs (if you have a faster processor than your competition, you are more likely to find the right number before the others), but also the large amounts of electricity consumed by these processors.
And, the number of bitcoins awarded as a reward for solving the puzzle will decrease. It’s 12.5 now, but it’s halving every four years (the next one is scheduled for 2020-21). The value of bitcoin relative to the cost of electricity and hardware could rise over the next few years to partially offset this reduction, but that is not certain.
The difficulty of the computation (the required number of zeros at the start of the hash chain) is frequently adjusted, so it takes an average of 10 minutes to process a block. Why 10 minutes? This is the amount of time bitcoin developers believe it takes for a constant, decreasing flow of new coins until the maximum number of 21 million is reached (expected some time in 2140).
Before being in possession of a bitcoin, you need a place to store it. This place is called a wallet which means wallet. Rather than keeping your bitcoin physically, it contains the private key that allows you to access your bitcoin address (which is also your public key). A wallet typically holds multiple private keys, and many Bitcoin investors have multiple wallets.