All Posts

Blockchain & Bitcoin Mining

Explanation: Bitcoin Mining is the process of creating new coins while validating transactions and creating blocks. This is usually done by a proof of work (PoW) algorithm. But there are also other algorithms like proof of stake (PoS), delegated proof of Stake, proof of capacity (PoC), proof of elapsed time (PoET), etc.

Bitcoin uses a proof of work algorithm called hashcash.

Duties of the miners

Miners have the following duties in Bitcoin:

  1. Check incoming transactions: Is the signature valid? Does the signature correspond to the used public address? Is there no double spend?
  2. Assemble a block out of the transactions, some extra data and the hash of the previous block header
  3. Propagate the proof of work solution to the network
  4. Check the solution of other miners for correctness.

Consensus algorithm

Let’s say we have a blockchain with ten blocks. Now all miners try to find the eleventh block. Whoever finds it first receives a block reward in form of the cryptocurrency (Bitcoin for example).

Therefore, the miners need to solve a puzzle. Each miner takes the unprocessed transactions and validates them. After that he takes the header hash of the previous block and combines both, header hash and transactions, plus some extra information and calculates the hash (SHA-256) of this combined input value.

If the hash fulfills certain difficult to meet properties the miner can send the input + the result to the network. All other miners check, if the solution is correct and use this block now as the new previous block.

In Bitcoin the hash value needs to be below a certain target value. This target value is adjusted dynamically, roughly every 14 days. The lower the target the more difficult it is to find a matching combination of input values. In average it takes ten minutes to find a new hash or block.

If the input doesn’t lead to a valid output, the miner needs to make a tiny change (incrementing a field called nonce) and try it again. This is done billion of times repeatedly. This process is called mining.

All miners compete against each other and only the first one who finds the correct solution is entitled to submit its block.

A detailed explanation of proof of work can be found here. [Link]

Incentive for mining

The lucky miner who found the correct solution is now allowed to credit himself a certain amount of Bitcoin. This is done in the coinbase transaction, which is a special transaction created by the miner. The newly created Bitcoin are created from thin air. It is like the central bank printing new money.

The miner has a strong financial incentive to create correct blocks, otherwise all other nodes would reject his block.

Mining Hardware

Since the process of mining is energy intense it is necessary to have very efficient hardware. For Bitcoin so called ASICS were developed.

The most prominent are:

Some mining hardware producers also run mining pools.

Mining Software

The mining software is an important piece in the mining process. It takes care of validating transactions, building the block, hashing the data and updating the nonce. It also schedules the work for the mining hardware. The most prominent bitcoin mining software are:

  • 50Miner
  • BFGMiner
  • CGMiner

An extensive list of bitcoin mining software can be found here:

Mining Pools

A single miner might have too weak hardware to profitably mine Bitcoin blocks. Therefore, they can join mining pools where they bundle their hashing power and share the rewards.

Popular mining pools are:

  1. F2Pool
  2. com
  3. AntPool
  4. pool
  5. ViaBTC
  6. Poolin

As of August 2020 the hash rate distribution looked like that:

Hash rate bitcoin mining pools shares


Further Links

A useful forum for bitcoin and blockchain related topic: