Following my article days ago, I received a number of follow-up questions on bitcoin mining, such as: What is mining? How do I mine? Who can mine? Why mine in the first place? And so on. This article looks at these and other related questions. Its purpose is to shed light on what bitcoin mining is all about.
Key issues to recall
Recall that in my last article, I explained that Bitcoin is a virtual currency created and held electronically, meaning that no physical coins exists. Instead, transactions take place peer-to-peer and are written directly on a distributed ledger called the blockchain, once they are deemed to be valid. No central authority controls or issues it. bitcoins, unlike fiat currencies, are therefore not printed by governments and central banks. Instead, they are produced by people and businesses running computers on the bitcoin network all around the world, using software that solves mathematical problems, in accordance with the Bitcoin protocol. This is where the mining comes in.
How did mining arise in Bitcoin?
The best way to create a context is to go back to Satoshi Nakamoto’s white paper which introduced bitcoin. In it, Satoshi wrote;
“By convention, the first transaction in a block is a special transaction that starts a new coin owned by the creator of the block. This adds an incentive for nodes to support the network, and provides a way to initially distribute coins into circulation, since there is no central authority to issue them. The steady addition of a constant amount of new coins is analogous to gold miners expending resources to add gold to circulation. In our case, it is CPU time and electricity that is expended.”
Since bitcoins are not printed, the only way they are created and added into circulation is through mining them. They are given as a reward to nodes on the Bitcoin network for using their computer resources to validate transactions before they are added onto the blockchain. Nakamoto carefully introduces the analogy of gold mining. You can understand this in the context that people who worked on this innovation then were very concerned about the effect of continuous printing of money by authorities (quantitative easing) on the value of fiat currencies. At that time, a number of people believed that gold was a better store of value.
When gold was a currency many years ago, the only way you could “print” more gold into the monetary system was to go and dig it off the ground. You had to invest in mining the gold. You had to work, and getting the gold out of the earth was some sort of proof that you worked to get it out (proof-of-work).
How does it work?
Remember that the genius of Bitcoin is that it invented the blockchain, a distributed ledger that does not require a trusted third party. It is a shared public ledger on which the entire Bitcoin network relies and where confirmed transactions are recorded. Wallets, where bitcoin balances are kept for the user, calculate their spendable balance from the ledger. In addition, new transactions can be verified to be not only spendable, but actually owned by the spender.
Also remember that Bitcoin is anchored on cryptography. All transactions on the network are grouped into a batch, called a block. Each block is timestamped and hashed. When a block is hashed, it is chained to previous blocks creating a chain of blocks added to the network.
As I noted above, just like the way gold was introduced into the economy centuries ago, bitcoins have to be mined. You have to do some work to get them. However, you don’t use picks and shovels. You just lend your computing power to the bitcoin network. The computing power is required to secure transactions that are recorded on the block chain.
Technically, it works this way: the mining hardware runs a cryptographic hash function on the header of the block (block header). The function is two rounds of SHA-256. For each new hash attempt, the mining software applies a different number as the random element of the block header. In Bitcoin parlance, such a number is referred as a nonce. The hashing process creates a hash – a long series of alphanumeric characters.
Each block must be discovered through hashing roughly every ten minutes. This is made possible through setting a difficulty target. The mining computer must find a hash below that target to create a valid block. So, assuming the difficulty target started with 10000………, then any number that starts with a zero would be useful and below the difficulty target.
The mining difficulty is adjusted by the network every 2016 blocks. This adjustment is based on the time it took to find and validate the previous 2016 blocks. Given that a rate of one block must be found every 10 minutes, 2016 blocks would take two weeks to find. In the event that the previous 2016 blocks took more than two weeks to find, the network reduces the mining difficulty, and vice-versa. The network’s difficulty target is self-adjusting to meet the desired validation of blocks every ten minutes. In short, the difficulty shows how much hard it is to generate a block compared to the genesis block.
In a simple way, the mining process goes as follows:
- Bundle transactions in a block
- Verify transactions to confirm their validity
- Select the header of the most recent block and insert it into the new block as a hash
- Solve the proof-of-work problem
- When the mathematical computation is solved, the new block is added to the local blockchain and propagated into the bitcoin network.
What are the rewards for mining?
In essence, mining bitcoins is like a lottery where you connect your mining hardware to the Bitcoin network and compete with everyone else’s, to earn bitcoins. If your hardware has faster and more processing power, it attempts more tries per second to win this lottery. It follows that to mine bitcoins, the cost of doing so is electricity and a computer. Miners are rewarded therefore for lending their computing power to the network. Mining computes the proof-of-work necessary to validate each block before its added to the blockchain.
Currently, miners get 12.5 bitcoins as reward for mining blocks, meaning that 12.5 bitcoins are created every ten minutes. This hasn’t always been the case, however. Nakamoto set the block reward schedule when he created Bitcoin. It is one of Bitcoin’s central rules and cannot be changed without consensus on the whole Bitcoin network. This means it needs unanimous consensus to change. When Bitcoin started in 2009, block reward for mining started at 50 bitcoins. The block reward is designed to halve every 210,000 blocks, implying that every block up until the 210,000th block was rewarded with 50 bitcoins whereas the 210,001th block onwards got a reward of 25 Bitcoins, and so forth. Since blocks are mined on average every 10 minutes, 144 blocks are mined per day on average. At 144 blocks per day, 210,000 blocks take on average four years to mine.
Why is mining necessary on the network?
Recall that Bitcoin removes the necessity of trusted third parties such as banks. Bitcoin mining is a decentralized computation that serves two purposes, namely (i) issuing new bitcoins with each block validated and (ii) confirm transactions in a trustful manner by devoting enough computational power to validate transactions in a block.
Should you mine Bitcoins?
If you are an enthusiast of Bitcoin, yes. This is because you will be providing computing power towards the validation of transactions on the network. But a response to this question requires that we briefly look at the history and evolution of bitcoin mining.
When Bitcoin launched in 2009, there was very little interest in the project, especially outside the cryptography enthusiasts space. The early versions of the bitcoin system allowed anyone running the software to mine bitcoin on their computer’s CPU. Only a handful of people mined bitcoins, there was very little computing power on the network, hence, little mining competition. In the early days, most of the bitcoins were actually mined by Nakamoto who gave them away to other people to help test the bitcoin network. But as more and more people figured out the genius behind Bitcoin, they joined the network giving rise to an exponential growth in the computing power on the network.
Since the mining happened on a simple computer CPU, it wasn’t long before a miner discovered that mining could be adapted to use a video card (graphics processing unit – GPU), other than a CPU, since it is designed to compute complex mathematical solutions. This made it more efficient than a CPU. A video card however, also utilizes a lot of power. This led to an evolution creating very powerful computers more ideal for Bitcoin mining – largely driven by the desire for efficiency which balances electricity consumption and computing power for bitcoin rewards. GPUs were replaced by field programable gateway arrays (FPGAs), which were eventually outperformed in 2013 by new application specific integrated circuits (ASIC) miners. ASIC’s mining performance is superior, but chews a lot of power, and makes a lot of noise. It is this power consumption factor that plays a huge part in whether it’s worth engaging in mining bitcoins or not.
Bitcoin mining is unprofitable in many countries where power is expensive. In many cases, electricity costs and the outlay for the hardware now make it unprofitable to mine at home, unlike in the past. In addition, as new more powerful miners are introduced in the market, the old miners become inefficient to keep running, which pushes you to write off your hardware and buy new machines.
There is a new trend however called cloud mining. This enables people to invest in a mining operation without buying or hosting the hardware. The owners of such cloud mining services allow you to mine and earn bitcoin while paying a periodic fee for warehousing and electricity. This way you do not need to buy a mining machine, neither do you consume power – you just pay for both remotely. However, you must be careful which cloud mining pool you join because some unscrupulous people, especially in the network marketing space are selling all sort of bitcoin mining schemes that border on Ponzi and pyramid arrangements.
No doubt new innovations will come, as more powerful chips are made that are more efficient, so expect the landscape to keep changing.
The key takeaway
In fiat currency systems, governments simply print more money when they need to, sometimes ruining its value. The Zimbabwe dollar is a very good example. In bitcoin, however, money isn’t printed, but is discovered. Computers around the world compete with each other on the Bitcoin network to validate transaction blocks for a reward payable in bitcoins. How much reward is given at a specific point in time is hard-coded in the bitcoin protocol and isn’t a secret. It currently stands at 12.5 bitcoins every ten minutes. Mining therefore decentralizes the function of a central bank in issuing/printing currency and central clearing, replacing that with this global competition among computers.
Taurai Chinyamakobvu is an enthusiast of blockchain, Bitcoin and other cryptocurrencies. He is an early stage investor and director of Bitfinance (a blockchain company), Flocash and Wezeshwa Fund. He is also an advisor to some international corporations. He has deep interests in fintech, and is also a member of the Reserve Bank of Zimbabwe’s committee on digital financial inclusion. He can be contacted on firstname.lastname@example.org