What is Bitcoin mining?
The Bitcoin mining process starts when you make a transaction. I want to pay you a Bitcoin. I take my wallet and say I want to send you a Bitcoin from my wallet. I’m simply sending a message out on the network. In a similar way to there being an email network, there’s a Bitcoin network.
This message gets picked up by a Bitcoin miner. The miner checks that the message makes sense, that there’s actually Bitcoin at the address that it’s being sent from. All the while, the miner is checking, and asking ‘does this message make sense?’. If it does make sense, it gets added to a mine pool: a collection of transactions that have been verified, but which have yet to be added to the block.
Once the mining software has a block of transactions of the required size, it has to play a complex mathematical game. This takes a huge amount of work, and required a huge amount of electricity. All the Bitcoin miners are competing against each other to see who gets to solve the mathematical game first, and therefore to see who gets to add the next block on the chain.
The game involves crushing the data in the block. The hash number the miner has to come up with must be smaller than the target that has been set within the rules of the Bitcoin mining ‘game’. This doesn’t come on first try, so the hash needs to be calculated over and over again, at great expense in electricity and CPU power.
All Bitcoin miners are competing against each other to see who gets to solve the mathematical game first, and therefore to see who gets to add the next block on the chain.
There’s a piece of data at the head of the block called a ‘nonce’. The nonce get’s changed, the data rehashed, and for the first few thousand times, the puzzle won’t be solved. So the nonce gets changed and rehashed, probably for hundreds of thousands of times, again and again until finally, one of the miners will come up with a hash that is lower than the target.
The first miner who comes up with a hash number lower than the target wins, and sends his block out to the network for verification. All his mining peers can check that the hash matches the original data. Whilst you can’t reverse a hash and come back to the original data, if you already have the original data, you can check whether the hash matches it.
Once this is verified by the other miners, the miner gets to add his block to the blockchain. Then it’s the end of that particular contest. The miner has won and is duly paid with two rewards.
- The miner gets to keep the small fees that are paid when you transmit Bitcoin.
- The miner gets the blockchain reward. At the moment, this reward is something like 12.5 Bitcoin. A new block is added on average every 10 minutes or so.