Bitcoin mining is an interesting way of trying to make a few bitcoin tokens on the side, but it also serves a very important purpose in maintaining and keeping the bitcoin blockchain secure.
Unlike regular fiat currencies (such as US dollars or euros) bitcoin assets are not controlled by a central government or bank, and new bitcoin (BTC) cannot be printed and issued like paper money. Instead, bitcoin tokens are introduced into the market via a process known as “mining”. BTC are awarded to the miners who have solved the math problems necessary to verify bitcoin transactions.
In this guide we’ll look at how mining works, why it’s a necessary component of bitcoin infrastructure, and whether it’s a good way of making a buck.
Compare bitcoin cloud mining providers
What is mining?
Whenever a transaction is made in bitcoin, a record of it is made on a block containing other recent transactions, like a page in a ledger. Once the block is full, bitcoin miners compete against each other to verify and validate the block and all its transactions by solving a complex cryptographic problem.
The first miner to accomplish this is awarded a set amount of bitcoin, based on the mining difficulty at the time. The verified block is then added to the blockchain, a history of all blocks verified since the beginning of bitcoin, and transmitted to all users of bitcoin so that they can have the latest blockchain.
Proof of work
At the heart of bitcoin mining lies a hard, mathematical problem. The goal is to ensure that the process of adding a new block to the blockchain requires a lot of work. That helps to ensure that any hacker tampering with the transactions needs not only to mess with the transactions but also win the “race” of bitcoin mining.
So how does it work?
Basics of cryptography
SHA-256 – the mining algorithm used by bitcoin – is a one-way cryptographic algorithm. When you pass a word through SHA-256 you will be given back an unrecognizable string of letters and numbers called a “HASH”.
For example, the SHA-256 of the word “BUTTERFLY” (source) is “8c62ace4f9ef8ccd08ca6fb992a8524bb7dbdc0530654bd254c9da07a660949a” (HASH). This seemingly random string of letters and numbers has three important properties:
- Only the word “BUTTERFLY” will ever give that specific HASH.
- The word “BUTTERFLY” will always give back that exact HASH.
- There is no way of figuring out the word “BUTTERFLY” if you only know the HASH.
With this information, we can now start piecing together the mining process.
The mining process
Bitcoin mining involves three variables: the block, the mining difficulty and a random number. Here’s how it all comes together:
Imagine our block consists of the word “BUTTERFLY” discussed earlier. In reality, the block would contain a list of recent, unverified transactions, but let’s keep it simple. In order for the block to be solved, bitcoin uses a deceptively simple test: If the HASH result of the block starts with a certain number of zeros, the block is considered verified. This number of zeros is the “mining difficulty” and is increased as more miners join the bitcoin network. For our example, let’s say that we have a mining difficulty of just two, ie, our HASH must start with two zeros.
The problem: “BUTTERFLY” will always return the same HASH, and it doesn’t start with two zeros. So what we need is the third variable, a random number (called a NONCE). We take this number, combine it with “BUTTERFLY”, and HASH again. If it doesn’t start with two zeros, we change the number and try again, and because changing one small number changes the whole HASH result, there is no way to predict the number we’ll need to solve this!
We repeat this process over and over until we find a number that, when combined with “BUTTERFLY”, gives us a HASH that starts with two zeros. That number is the solution to the block. Here are some tries:
This arduous process of randomly trying to find a number that gives the solution is what makes bitcoin mining such a computationally expensive process and as more miners join the network the harder it gets. As of November 2017, a regular home computer working alone, ie, not an application-specific integrated circuit (ASIC) and not part of a cloud mining network, would take 2.7 millionyears to mine one block.
This has led to the rise of ASIC computers built specifically for mining, and to an increase in cloud mining.
Evolution of the mining computer
- CPU mining. In the early days of bitcoin, mining difficulty was low and not a lot of miners were competing for blocks and rewards. This made it worthwhile to use your computer’s own central processing unit (CPU) to mine bitcoin. However, that approach was soon replaced by GPU mining.
- GPU mining. A graphics processing unit (GPU) is a powerful processor whose sole purpose is to assist your computer’s graphics card in rendering 3D graphics. GPUs are not built for executive decisions (like CPUs) but to be very good laborers, hence GPUs are able to execute over 800 times more instructions in the same amount of time as a CPU. Mining is a repetitive process that does not require any intelligent decisions, leading to GPUs replacing CPUs in the mining world.
- FPGA mining. Next came mining with field-programmable gate arrays (FPGAs). These greatly outperformed GPUs and CPUs in the mining process as FPGAs are processors that can be programmed to execute specific instructions, and only those instructions (instead of being repurposed for mining, like GPUs were).
- ASIC mining. Similar to FPGAs, application-specific integrated circuits are chips designed for a specific purpose, in our case mining bitcoin, and nothing else. ASICs for bitcoin were introduced in 2013 and, as of November 2017, they are the best processors available for mining bitcoin and they outperform FPGAs in power consumption.
- Mining pools. To offset the difficulty of mining a block, miners started organizing in pools or cloud mining networks. Whenever a miner in one of these pools solves a block, the reward is shared with everyone in the pool in a ratio representative of how much work you put into the pool (even though you personally never solved the puzzle).
- Cloud mining. Clouds offer prospective miners the ability to purchase mining rigs in a remote data centre location. There are many obvious advantages, the most obvious being: no electricity costs, no excess heat, and nothing to sell when you decide to hang up your virtual pickaxe.
Where do I store my mined bitcoin?
Once miners receive bitcoin, they are given a digital key to the bitcoin addresses. You can use this digital key to access and validate or approve transactions.
You can keep these digital keys safe with a number of wallet options:
- Desktop wallets. Software like Bitcoin Core allows you to send and store bitcoin addresses and also connects to the network to track transactions.
- Online wallets. Bitcoin keys are stored online by exchange platforms like Coinbase or Circle and can be accessed from anywhere.
- Mobile wallets. Apps like Blockchain store and encrypt your bitcoin keys so that you can make payments using your mobile device.
- Paper wallets. Some websites offer paper wallet services, generating a piece of paper with two QR codes on it. One code is the public address at which you receive bitcoin and the other is your private address you can use for spending.
- Hardware wallets. You can use a USB device created specifically to store bitcoin electronically and your private address keys.
Are people still making money mining bitcoin?
Making money mining bitcoin is much more difficult today. Some of the issues contributing to this difficulty include:
- Hardware prices. The days of mining using a standard CPU or graphic card are gone. As more people have begun mining, the difficulty of solving the puzzles has too increased. ASIC microchips were developed to process the computations faster and have become necessary to succeed at mining today. These chips can cost $3,000 or more and are guaranteed to further increase in cost with each improvement and update.
- Rise in corporate miners. Hobby miners must now compete with for-profits — and their bigger, better machines — when mining to make a buck.
- Puzzle difficulty. Bitcoin’s protocol adjusts the computational difficulty of the puzzles to finish a block every 2,016 blocks. The more computational power put toward mining, the more difficult the puzzle.
- Power costs. Power in the United States is more expensive than it is in other parts of the world, making it further difficult to compete with big-miner money.
When discussing the feasibility of bitcoin mining, an unexpected variable rears its head: power consumption. This catches a lot of prospective miners off-guard. After all, we rarely consider how much power our electric appliances are consuming. But computing hashes is a very intensive process, pushing whatever processor you’re using to the limit, and to its maximum power consumption. So the question we have to answer is this: will the small reward you earn from bitcoin mining be enough to offset the cost of power consumed?
If you’re using CPU/GPU/FPGA to mine, the answer is a definite no. As of November 2017, the BTC reward is so small that it doesn’t pay for the energy your computer will consume to verify a block.
This leaves us with Pools, ASICs and Cloud Mining. If you’re not willing to put a lot of money into setting up a mining operation, your best bet could be to get a cloud mining rig. These are relatively low cost, and require no hardware knowledge to get started, no extra electricity bills, and you won’t end up with a machine you can’t sell when bitcoin mining is no longer profitable.
Compare bitcoin marketplaces
The rising costs of mining effectively and competing against large mining pools have made it harder for the hobbyist to profit on mining bitcoin.
It’s virtually impossible to mine enough bitcoin to recoup your initial cost of equipment and electricity. But if you’re not so concerned about making a buck, you could have fun panning for this cool currency.