According to the media “cryptocurrency is complicated”. Many are put off investing in so-called ‘digital currency’ for that reason alone - never mind the scams, scares and volatility. One aspect of that complexity is the mining process. Here we explain the concept of Bitcoin mining in simple terms.
What is cryptocurrency mining?
Mining is the process that validates transactions on a blockchain. Each block contains a batch of transactions and a hash number that relates to the information in the previous block, all the way back to the very first block - the genesis block.
The hash is what links together the blocks in the chain, thereby maintaining the integrity of the blockchain as a whole. But what exactly is the hash? A hash is a string of numbers and letters that is produced mechanically by processing data using a specific set of rules.
The input data are derived from the set of new transactions to be added to the chain, a timestamp, the hash of the previous block, some other bits and pieces, and a nonce - a random whole number between 0 and several billion.
In the case of Bitcoin, Secure Hash Algorithm (SHA) 256 is the set of rules used to produce a hash. The algorithm is was devised by the US National Security Agency and published in 2001. Different algorithms are used by other cryptocurrencies but the general principle is the same.
It is essentially just a means of reducing a set of inputs into an output that has a particular format. Passing the same information through the hash function will always generate the same result. Make even a minute change to just one element, and the resulting hash will look completely different.
In order for a hash to be added to the Bitcoin blockchain it must satisfy a difficulty requirement. This simply specifies the number of zeroes that the hash must begin with. The more zeroes, the less likely finding a valid set of inputs becomes.
This is where mining comes in. Miners in the Bitcoin network repeatedly apply the hash algorithm in a race to find the nonce that generates a hash that satisfies the difficulty requirement - the ‘golden nonce’.
Once a valid hash is found it is broadcast to other miners for confirmation. Once confirmed by a majority of the network the block is added to the chain. Reaching a consensus in this way ensures that every miner on the network is in possession of the same valid set of transactions, thereby maintaining the integrity of the balances residing on the chain as a whole.
The winner receives the block reward, some newly minted Bitcoin. After the inception of Bitcoin in 2009 the block reward was 50 BTC. The current block reward is 12.5 BTC. The successful miner also receives a portion of the Bitcoin transaction fees associated with the block.
Finding a nonce that generates a hash that satisfies then mining difficulty can take a lot of attempts. As a result, solving this mathematical puzzle requires considerable computing power, or ‘hash power’.
Is it possible to mine Bitcoin using a home computer?
In the early days of Bitcoin, home computers were powerful enough to generate hashes that satisfied the mining difficulty. As more computers joined the Bitcoin network, hash power grew.
To maintain the number of new blocks created at around one every 10 minutes, the code underlying Bitcoin would raise the difficulty, requiring more computational power to find a valid hash. The difficulty is adjusted every 2016 blocks - approximately once every two weeks.
In response to rising difficulty, miners began to produce mining rigs, comprised of arrays of microprocessors, generating much greater hash power than a home computer. This, in turn, prompted further increases in difficulty.
Over time, the computer power needed to mine Bitcoin has risen steadily, to the point where the current difficulty is such that you are more likely to win the lottery twice in a row than find a valid hash at random. With the chances so vanishingly small, it takes a lot of tries to find a hash that satisfies the difficulty requirement.
In response, sophisticated miners now use high end GPUs (graphics processing unit), which can perform many calculations in parallel. These offer a degree of versatility, and can be used to mine various coins.
For miners dedicated to just one coin, there are application-specific integrated circuits (ASIC), developed solely for the purpose of mining cryptocurrency. These are hugely powerful but with greater computational power comes greater specialisation, making ASICs less able to be redirected towards coins they were not designed to mine.
Nowadays, beginners with consumer level equipment avoid mining cryptocurrencies including many of the better known ones, such as Litecoin and Bitcoin as the hardware and electricity costs are prohibitive. A home computer simply isn’t powerful enough to expect to generate the income needed to cover the electricity bills, given the low likelihood of ever finding a block.
As it has become more costly for individuals to mine using their own equipment, cloud mining has become increasingly popular.
Cloud mining does not require private individuals to own or manage the hardware themselves. It also require only a standard home CPU, with relatively small energy requirements. But the returns are relatively poor, and there is considerable risk for the consumer, given opportunities for fraud and hacks.
Concentration of hash power has led to centralisation of Bitcoin
The huge outlays involved in industrial mining operations means that most Bitcoin mining is now undertaken by large mining ‘farms’ run by companies such as Bitmain, in China, or by mining pools, like Antpool, where a number of miners club together to increase their joint hash power.
Unfortunately, the growth of these large scale mining operations has tended to centralise governance of Bitcoin, and seems far removed from the vision of Satoshi Nakamoto.
Indeed the extent of the concentration of hash power is approaching the point at which it may become possible for a single mining operation to secure control of 51% of the network. This would give that operation the power to falsify the shared ledger in a so-called double-spend attack.
In terms of fiat currency, a double spend is akin to using some cash to make a purchase, then that cash miraculously finding its way back into your wallet, rather that the merchant’s cash register.
In crypto, this is achieved by privately using 51% of the network to build a chain, while simultaneously spending coins on the public chain. Once the private chain is longer than the public chain it is broadcast to the network and accepted as the valid chain, by virtue of being longest (and so logically the result of the majority of the hash power).
The bottom line
There you have it: cryptocurrency mining in a nutshell. It is not as complicated as the media would have you believe. But it is not a straightforward way for individuals to make great returns either.
More concerningly, the concentration of hash power into the hands of a few very large operators tends to undermine, drastically, the dream of decentralization on which the cryptocurrency project was founded.
That could not have been evidenced more starkly by the damage done to the whole crypto universe by the so called hash war, between two large groups of miners on the Bitcoin Cash chain.
Hopefully, this is an isolated instance. If not, other consensus mechanisms, like the proof-of-stake approach used by BitBay, must surely gain more widespread appeal in the years ahead. We certainly think it is superior. If hash wars become more common, others are likely to come round to our way of thinking, too.