If you have even the slightest interest in cryptocurrencies, you’ve probably heard a lot of terms thrown around – mining, blockchain, proof of work, and public key. That’s fine, but what do they actually mean? Hence, we made an article to help learn about these topics with a focus on Bitcoin Mining Education.
Nothing should be considered investment or financial advice. Enjoy the ride.
In this post, let’s take a closer look at what it means to “mine” bitcoins. It’s a strange thought to visualize, down deep in the earth digging up 0’s and 1’s, but it’s a fundamental concept for most cryptocurrencies.
Sometimes it’s best to get information from the source. Therefore, here’s what Bitcoin.org has to say about why it’s referred to as “mining”:
This process is referred to as “mining” as an analogy to gold mining because it is also a temporary mechanism used to issue new bitcoins. Unlike gold mining, however, Bitcoin mining provides a reward in exchange for useful services required to operate a secure payment network.Bitcoin.org
Bitcoin Mining Basics
At its most basic level, mining is simply attempting to solve a difficult problem. Solving this provides security for the blockchain to ensure that each block of transactions is credible and can be trusted by the community. When a node on the network solves a difficult problem, they are rewarded with a fixed number of bitcoins as compensation.
Alright, that’s it! Thanks for reading!
Just kidding. Let’s break down these steps, starting with “solving a difficult problem”.
Mining To Solve A Problem
A single block on the blockchain can contain as few as 1 transaction or as many as 1,000’s of transactions. All of these need to be verified and placed onto the blockchain.
It’s no problem for anyone to verify that a transaction is valid, but to place a new block a miner must provide a “proof-of-work” to the community proving that they have validated all transactions within the block. The difficulty present in mining blocks keeps the output of blocks steady (about every 10 minutes or so a new block is pushed onto the blockchain).
Hashcash Bitcoin Proof of Work
Bitcoin uses a proof-of-work function called “hashcash” which provides the “difficult problem” to solve before a block can be added to the blockchain.
We’ve talked about hashing in a previous article, but let’s provide a quick recap: Hashing takes a message of arbitrary length and changes it to a fixed-length output that cannot be reversed to find the original data. Bitcoin uses the SHA-256 algorithm in hashcash, so essentially a miner who needs to find a specific hash can end up with 2256 values (around 1.16 x 1077 – this is an incredibly large number, needless to say).
Bitcoin provides a target number to the network. All miners on the network are attempting to provide a hash value that results in a number lower than the target number.
Let’s make this a little more practical with a simple example.
BTC Mining Example
Suppose we have an 8-bit algorithm, so instead of SHA-256 producing 256-bit values, we are using our own made-up version called “SHA-8”.
This means that I can produce hashes between 00000000 and 11111111 in binary or 00 and FF in hex. Since our infrastructure wants to keep the output of blocks to around every 10 minutes or so, I can make it so that any miner who wants to get rewarded for solving a block must produce a hash that starts with three 0’s or less, i.e. a target number which must be less than 00011111 in binary or 3F in hex.
This is dramatically smaller than the overall size of the hashing algorithm’s available output. Now miners must make a number (in decimal) between 0 and 63; any number 64-255 will not meet the criteria. In this example, we have voided the applicability of 192 hash values.
Real World Crypto Mining
This is the exact thing that happens in the real-world of Bitcoin mining – more and more 0’s are added so that the hash values become increasingly hard to mine. As of January 2020, there have been as many as 74 0’s at the front of the number – which essentially voids about 18 x 1021 hashes. Because of this, miners have to output trillions of hashes before eventually finding one that is below the target number.
Every 10 minutes a hash meeting this criteria is found – but this after lots and lots of work on behalf of the worldwide mining pool.
Alright, we’ve discussed what it means to “solve a difficult problem” – what’s next? Miners add their block to the blockchain after completing the hashcash algorithm. Basically the first to complete the block and add it to the blockchain is the winner and receives a reward in BTC for their effort. As more and more miners add blocks onto the block chain, the verification of a specific block is solidified.
Early Days Of Bitcoin Mining
Back in 2009 when the Bitcoin network was formed, miners who solved for a block on the blockchain received 50 BTC as a reward for their efforts. However, Bitcoin was designed to halve this value after solving for 210,000 blocks (which averages to about every 4 years or so).
That means that around 2012, the reward became 25 BTC; in 2016 it was about 12.5 BTC and so on. Only 21,000,000 BTC will ever exist in the network; after this point mining will no longer produce new bitcoins to pay the miners, who will then be paid through transaction fees for their efforts in verification.
Bitcoin Mining Resources
Do you want to read more about the cryptographic aspects of mining? Here are a few links that will shed additional light on the topic:
- This site does a great job breaking down the overall process of mining.
- Here’s more from the official Bitcoin.org website explaining mining and its effects on the cryptocurrency ecosystem.
- Want to get in on the action? Learn more about how to start mining on your own or how to join a mining pool.
- Finally, this article digs into mining (pardon the pun), including the economics of the situation.