Bitcoin mining is a peer-to-peer computing process that is needed to verify each Bitcoin transaction and then added to the blockchain. Bitcoin nodes use the blockchain to verify the transaction to eliminate double spending. A blockchain is a distributed public ledger or data containing all the past Bitcoin transactions. The blocks in the blockchain contain a cluster of the transactions recorded in a currency’s history. Blockchain confirms transactions to the rest of the network as having happened. (Read also: What is Blockchain?)
The Bitcoin mining difficulty requirement is a measure of how much time and processing power it would require to find a hash value (256-bit Number) while processing a block. The difficulty level is revised after 2,016 Blocks or every two weeks so that the block time remains constant at one block every ten minutes.
Each miner working on a block takes into account a selection of transactions from the vast pool of transactions and organises them. The selection of Bitcoin transaction is different from one miner to another rendering to its uniqueness. Each transaction has the addresses you send from as inputs and addresses you sent to as outputs.The miner ensures each of the transactions in his selected cluster of transactions is valid by the following two ways:
- Ensuring each transaction contains signatures associated with each of the addresses that spend it.
- Verifying that each of the addresses is not overspending on and above they are capable of spending.
The inputs have to be equal to the outputs. If inputs are greater than outputs, then the difference is known as transaction fees and go to the miner who has inserted the transaction into the block he has mined. Besides, each block also one unique transaction that has no inputs and only outputs and is called Coinbase transaction.
Each block, the miner creates has four things:
- The Block header of the block before it.
- The Coinbase Transaction – that has no inputs but has mining rewards.
- All the transactions that the miner has chosen to validate
- A random dummy parameter called “Nonce.”
A miner combines all these by computing a function called the HASH function which is a 256-Bit Length Number. An individual block must have a proof of work (POW) to be considered as valid. The POW protects against double spending and makes the blockchain most secure. The Bitcoin’s POW model uses a function called Hashcash. (Read also: What is Proof of Work (PoW)?)
If the number generated by the hash function is smaller than the difficulty requirement, the miner has officially mined a block. There are farms in Georgia (Europe), China and US which holds almost 40% of the total hashing power of Bitcoin.The maximum supply of Bitcoin is capped at 21 million; hence at the current rate, mining would continue till 2142. This difference is greater than the combined life expectancy of the current X and Z generations.