The Bitcoin Blockchain’, block size limit bitcoin mining getting rewarded with newly created bitcoins. Recently over dinner, I was asked to explain bitcoin mining, and I struggled as it is entangled with a number of other concepts. Here’s my attempt at breaking it down into bite-sized pieces.
How do bitcoin transactions work? Why is mining needed in bitcoin? Why pay rewards in BTC instead of USD? What can and can’t miscreants do? This means the nodes have seen that the payment has been initiated, and they have validated it according to certain technical and business logic rules, but it isn’t yet written into anyone’s bitcoin blockchain ledger. If they guess right, then the block is published to the rest of the network. The computers on the network validate that the block meets the criteria, and then ignore it or store it into their blockchains.
The competition then starts again with the unconfirmed transactions that have accumulated since. The network adjusts the difficulty of the guessing game to target a block being created every 10 mins or so, irrespective of the amount of computing power in the network. The current advice suggests that after 6 blocks, the chances of the transaction being unwound due to a competing longer chain replacing your blocks is very small. If you are receiving a payment, then the higher the value your payment, the longer you may want to wait to reduce the chance of your payment being unwound. There are two parts to this. First you need a way to get transactions into the ledger, secondly you need a way to make it expensive for miscreants to add dishonest blocks.
Transactions are added to the ledger in blocks so as to create some sort of time order to the transactions. You don’t actually need the guessing game to add blocks to a blockchain. This cost acts as a deterrent to miscreants who would otherwise want to add their dishonest blocks. So to dominate the network, you just need to create many aliases who are all under your control and all agree with each other.
It is cheap and easy to spawn validators who all agree with each other. Therefore it is very cheap to bully the network. So for a network to be secure against this, you need to have a more expensive way to bully the network. Computational power is more expensive and requires investment and upkeep. Therefore use majority-by-computational-power instead of majority-by-numbers. So miscreants will need to spend a lot more money to dominate the network.
When you mine a block, get to collect any voluntary transaction fees from the transactions you have included. 25 BTC, and reducing to 12. The reward decreases with time, and in theory, transaction fees will replace the block reward. If there are more unconfirmed transactions than can fit in a block, rational miners will mine the ones with the highest transaction fees first.
A hash is a fingerprint of data. It’s easy to make a hash from some data but computationally impossible to create the data from the hash. Hashes look random compared with the data put in. You’ll see the hash in the smaller box. What does the hash of this look like? It’s easy to generate a hash from some text, but impossible to re-generate the text from the hash. If you change just one part of the data, the hash looks entirely different.