How to build crypto: What role does a Bitcoin Miner play

What you'll learn

  • How Miners confirm bitcoin transactions
  • What Proof of Work means
  • Can anyone be a Bitcoin Miner?
  • Introduction to Bitcoin Mining Pools

In order to provide a functioning monetary system, without a central mediator, Bitcoin needs to settle transactions with ‘finality’. There can be no rolling back, or replaying transactions. 

Full Nodes - introduced in the previous article in this section - will ensure transactions are valid; that they present the correct digital signatures proving the unspent funds (UTXO) associated with an address, can be spent.

But those transactions need to be confirmed in the blockchain - ensuring no double spends have taken place - which is the role played by Miners. They are paid for that service meaning they also serve the function of issuing new bitcoin.

Miners & transaction confirmation

As the Bitcoin blockchain has a fixed block size of 1MB, it can only accommodate an average of seven transactions per second, so unconfirmed transactions sit in something called a Mempool, waiting for Miners to take over.

Miners’ function is to watch the Mempool, waiting for these unconfirmed transactions, then package them into a candidate block;  every ten minutes, one of the candidate blocks is chosen to be added to the existing blockchain confirming (settling) all the transactions within it.

Miners are paid for this settlement function with new bitcoin for every confirmed block. The first block - aka Genesis block - was mined on January, 3rd 2009, with a reward of 50BTC. 

Ever since, a new block has been added to the network at approximately 10 minute intervals, and every 210,000 blocks the reward miners receive halves. This roughly equates to a four year halving cycle and means the supply cap of 21 million bitcoin will be reached around 2140.

At Bitcoin’s 2021 ATH price of $64,805 the reward rate of 6.25BTC amounts to over $420k paid per block, every ten minutes.

The BTC that is awarded to the miner who confirms each new block is also known as the “coinbase reward” – a term which was later claimed by the cryptocurrency exchange of the same name.

Miners & Proof of Work

Given that Bitcoin’s value comes from the digital scarcity of its currency, and the way it ensures against double spend, the mining process has to be difficult and incentivise honest behaviour. This is achieved through something called Proof of Work (Pow).

PoW requires Miners to compete against each other to earn the right to broadcast their candidate block to the network by solving a mathematical puzzle. 

Full Nodes automatically adjust the difficulty of finding the solution to the puzzle - every 2,016 blocks - ensuring the required amount of computational power has been expended to ensure a new block is created every 10 minutes, regulating issuance in line with the maximum supply.

While the puzzle itself is meaningless, the work required to arrive there is not: it proves that the miner hasn’t cheated, and ensures that no single entity can discover all of the blocks - keeping all the bitcoin rewards to themselves - or removing transactions, which would bring the whole system to a halt. 

PoW is therefore integral to the process of maintaining digital scarcity, and improving on the current failings of the fiat system, with its infinite supply.

Bitcoin’s mining puzzle

The computational puzzle is in the form of a hashing algorithm called SHA256. This isn’t unique to Bitcoin, but is an external cryptographic standard, developed by the NSA.

A hash is a unique one-way identifier for a digital record that enables privacy and security. Think of it as a randomising engine. You provide any input, like a password and the algorithm produces a random string of text and numbers (the hash) of uniform length. Change one letter of the input and you get a different hash and you cannot work back from the hash to know the password, but a unique input will always generate the same hash value.

SHA256 - used for Bitcoin Mining - produces a hash that is 64 characters long, regardless of the size of the input; each character represents four bytes of data 64*4=256.

Bitcoin mining is often described as a lottery because the task that Miners complete to show Proof of Work is arbitrary - it is just a clever way of regulating new block production and bitcoin issuance.

The aim of the game is to hash specific details from the new block and previous block, to produce a separate numeric hash value that is less than or equal to something called the Target - given our Lottery analogy this is the winning number.

The hashed block details are: version number, a timestamp, the hash from the previous block, the hash of something called the Merkle Root, a random number called a nonce, and a target hash.

Given the potential number range that a 256 bit algorithm can generate it will take a lot of guesses to find the Target, so all Miners do is run the algorithm as often as possible.

In the early days, Bitcoin could be mined using the GPU - Graphics Processing Unit  - in an ordinary home computer, originally designed to speed up the rendering of graphics, especially in PC gaming. 

Today, Miners use specialist hardware, known as mining rigs, that use application-specific integrated circuits, or ASICs. These are computer processors that have been optimised to solve the maths problem that is at the heart of bitcoin mining. One of the most popular is the Antman S19j Pro Miner 100 TH/s made by Bitmain. 

Mining facilities will run as many rigs as they can financially support and cool to find solve the puzzle before another Miner, somewhere else in the world, does. 

Once the Target is found, the block - and its transactions - are added to the blockchain, which syncs with all Full Nodes and Miners, and the process starts again..

We highlighted above how Full Nodes adjust to regulate block creation, this accounts for any increase or decrease in the collective Mining capacity. That will logically vary in relation to the price of bitcoin, as that determines the value of the incentive for participating - the coinbase reward plus fees. 

Bitcoin Price, the known difficulty rate, the collective hashrate and the cost of running a Mining operation (energy/cooling/overheads) can be used to work out the viability of participating.

Hash rate is a proxy for the strength of the Bitcoin network, as a bad actor would need to control 51% of the collective hash rate to stand any chance of being able to decide which transactions are added to new blocks and double spending coins.

It should also be obvious why Bitcoin Mining is so energy intensive given mining rigs are running 24/7/365 to find the Target, which gets harder as the aggregate hashing power goes up. This creates a virtuous loop with price, which tends to increase as hashrate increases, in turn attracting more Miners.

Can anyone be a Bitcoin Miner?

If you’ve read this far and are excited at the process of running a mining rig, it's time for a dose of cold reality. Bitcoin Mining is now a professional enterprise with most of the world’s bitcoin mining centres situated close to renewable energy sources in regions where electricity is cheap and plentiful.

Professional miners overclock their machines, to run them at performance levels above the manufacturer’s recommended settings. This should only be attempted by experienced miners, since care must be taken not to overheat the miners in the process, as solving one problem then creates another - the need to cool your mining operation, using up even more energy.

So unless you happen to own your own hydro electric dam or have a huge bank of solar panels, you will struggle to profitably mine bitcoin using GPUs or ASICs on a hobby basis.

Even with multiple ASICs linked together, you could toil away for weeks, months or longer and fail to discover a new block. In the meantime, you would be running up an expensive electricity bill, given the power requirements and need to mitigate the heat generated.

To solve this problem, and make mining more accessible to as many people as possible, bitcoiners have created Mining Pools. This entails a group of miners combining their hashpower (their collective computer processing power) to search for a new block together.

If any miner in the pool succeeds in this quest, the coinbase reward will be shared with all pool members proportionately to their hashpower.

If you are determined to mine cryptocurrency, you’ll need to find the right location in which to set up a rig (cool, well vented, and well insulated or isolated to prevent noise complaints), and choose the right ASIC for your needs and budget. With that done, and your mining gear on its way, it’ll be time to consider which mining pool to join.

For example, if you provide 5% of the hash power to the pool and the pool discovers a new block, you will receive 5% of the reward which (excluding pool fees) would amount to 0.3125 BTC. 

It sounds like easy money, but if it was that easy, everyone would be doing it! The truth is that it is extremely hard to profit from bitcoin mining.

You can consider mining other cryptocurrencies where there is less competition, but that will have to measure against the reward.

Choosing a Bitcoin Mining Pool

Choosing a mining pool comes down to some simple logic: the larger the size of the pool, in terms of hashpower, the more regularly they’ll find blocks. This will ensure a consistent stream of revenue.

However, due to the small portion of the hashpower you will supply to the pool, your share of the coinbase rewards will be miniscule. Joining a smaller pool will give you a larger share of the rewards, but payouts will be less frequent because the pool will discover less blocks.

There are also some more technical considerations that will guide your decision. If you are taking the DIY approach will require a fast internet connection with low latency in pinging the pool to share data.

Any delay in receiving data can waste precious time in searching for a solution to the next block. You ideally want a ping of under 200ms and as close to zero as possible.

Different pools charge different fees, so this will also need to be taken into account. You’ll also want to check the payout frequency; some pools will only pay out on scheduled dates, or once a minimum amount of BTC has been accrued in your wallet.

Pools that custody the miners’ rewards until they are distributed also incur a risk, since you are relying on them not to get hacked or hold onto funds. You may prefer to pick a pool that pays out directly into your own wallet.

Your last consideration should be the opportunity cost of investing in a mining pool. Can you get a similar or better rate of return on your investment elsewhere, when adjusted for the risk involved?

Using A Hosted Bitcoin Mining Service

A better approach might be to use a service that hosts a mining rig for you. You pay for the machine and the electricity but everything else is taken care of. You can see your ROI via a dashboard and even work out a breakeven point. Here is an example from Compass Mining.

Summarising the process for using a Bitcoin Mining Hosting Service (referencing the tweet above).

Purchase a mining rig; note these are in short supply cost ~$9,000

Choose where you Miner is hosted & pay for the electricity - $250 per month in this example

Connect to a Pool to monitor revenue from block rewards & transaction fees; set a wallet to receive them

Miners also earn fees paid by the sender of each transaction associated with the blocks they attempt to add to the blockchain, but those are of negligible value compared to the block reward. 

Consider a block as aggregated transaction data, miners validate the accuracy of each transaction and for their efforts, they are rewarded with coins. So miners provide the double function of settlement and issuance.