This is a continuation of a 3 part series describing Bitcoin mining in three different difficulty levels. You are now on Advanced
Finding the correct number allows you decide which bitcoin transactions you want included into the new block.
The miner that correctly guessed the number usually takes the bitcoin transactions that have the highest fees in them to add into the block. This is because in addition to the block reward, the miner collects the fees associated with all the bitcoin transactions as well.
Alternatively, the miner could also deliberately not include a transaction as a way to censor it. This transaction would remain in the memory pool until another miner includes it after winning the lottery.
What makes the somewhat constant 10 minute block rule possible is the dynamic difficulty adjustment of the algorithm. This is the most underappreciated aspect of Bitcoin.
The difficulty adjustment
No matter how much computing power the entire Bitcoin Network has, the block confirmation time stays at around 10 minutes.
To ensure this, every 2016 blocks (~2 weeks) there is a check if the average clearance has been higher or lower than 10 minutes during this time period. The difficulty of the guessing problem is depending on the target set by the protocol.
New Target = Old Target * (Actual Time of Last 2016 Blocks / 20160 minutes)
So if the network finds blocks faster than every 10 minutes, the difficulty increases (target decreases), if it finds blocks slower than every 10 minutes, the difficulty decreases (target increases).
This "10 minute rule" is implemented for two reasons:
Circumvent chain splittings. With super fast block clearances the blockchain could fork all over the place and it becomes harder to follow the right chain. Nodes always follow the longest.
Keeps the supply predictable. You can calculate how many Bitcoin will exist 10, 20, 30 years from now because of supply schedule is independent from how much computing power the network has.
Adding a new block to the chain every 10 minutes is Bitcoin's heartbeat, the definite order of events. A sense of time, a metronome for the network.
In this sense, by utilizing proof-of-work, the Bitcoin network provides a mechanism for establishing an indisputable history of events witnessed.
Proof-of-Work is necessary to have a clear order of events that is causal, unpredictable, and coordinated. This concept of time is so important, that the initial invention of blockchain was actually called timechain.
The issuance of new coins is also geometrically decreasing every 210,000 blocks, so roughly every 4 years which leads to a supply cap of just under 21 million Bitcoin. This scarcity is one of Bitcoin's key value propositions.
As the block rewards for solving blocks gets lower and lower, fees become necessary to finance the miners to check transactions and add them to the blockchain.
As explained in the Bitcoin whitepaper, "Once a predetermined number of coins have entered circulation, the incentive can transition entirely to transaction fees and be completely inflation free."
Bitcoin's mining economy
New technologies to mine bitcoin more efficiently has progressed a few times over the years. From CPU to GPU to FPGA to ASICs which is what is still being used to this today.
It's important to note again, no matter how powerful the mining machines become, the next difficulty adjustment will ensure that new blocks get created every 10 minutes.
You can theoretically still mine with a CPU, but you just won't make money. The electricity costs will be higher than your returns.
Joining "Mining Pools" allows you to compete against huge Bitcoin Mining Farms.
Joining a pool is great to get some rewards with just a bit of mining power. You get a reward proportional to how much mining power you add to the pool.
Bitcoin mining, in general, is only is profitable if you have access to cheap energy. Otherwise you just get driven out by other miners that have cheaper energy.
The hashrate which is a measure of the computing power of the network always follows the price. If Bitcoin's price rises, so does the profitability of mining.
The result is that more miners enter the network, increasing the hashrate, which ultimately reduces the margin for everyone.
Now let's get into more of the intricate details of mining. Let's move onto the next level of understanding.