What is Bitcoin Mining? A Step-by-Step Guide
Bitcoin may be the next big thing in finance, but it can be difficult for most people to understand how it works. There is a entire lot of maths and numbers involved, things which normally make a lot of people run in fear. Well, it’s one of the most elaborate parts of Bitcoin, but it is also the most critical to its success.
As you know, Bitcoin is a digital currency. Currencies need checks and balances, validation and verification. Normally central governments and banks are the ones who perform these tasks, making their currencies difficult to forge while also keeping track of them.
The big difference with Bitcoin is that it is decentralized. If there is no central government regulating it, then how do we know that the transactions are accurate?
How do we know that person A has sent one bitcoin to person B?
How do we stop person A from also sending that bitcoin to person C?
The reaction is mining.
What is Bitcoin Mining? In Some Ways, Bitcoin Is Like Gold
One of the most common analogies that people use for Bitcoin is that it’s like mining gold. Just like the precious metal, there is only a limited amount (there will only ever be twenty one million bitcoin) and the more that you take out, the more difficult and resource intensive it is to find. Apart from that, Bitcoin actually works fairly differently and it’s actually fairly genius once you can get your head around it. One of the major differences is that mining doesn’t necessarily create the bitcoin. Bitcoin is given to miners as a prize for validating the previous transactions. So how do they do it?
Bitcoin mining requires a computer and a special program. Miners will use this program and a lot of computer resources to challenge with other miners in solving complicated mathematical problems. About every ten minutes, they will attempt to solve a block that has the latest transaction data in it, using cryptographic hash functions.
A cryptographic hash function is an essentially one-way encryption without a key. It takes an input and comebacks a seemingly random, but immovable length hash value.
For example, if you use Movable Type’s SHA-256 Cryptographic Hash Algorithm:
Message: How does mining work?
Hash Value: 46550fef 26f87ddd 5e15407f 45a0b8d2 9513291c 4e0f0acc 24a974de 907a1569
If you switch even one letter of the original input, a fully different hash value will be returned. This randomness makes it unlikely to predict what the output will be.
How Are Hash Functions Useful For Bitcoin?
Because it is practically unlikely to predict the outcome of input, hash functions can be used for proof of work and validation. Bitcoin miners will rival to find an input that gives a specific hash value (a number with numerous zeros at the embark). The difficulty of these puzzles is measurable. However, they cannot be cheated on. This is because there is no way to perform better than by guessing blindly.
The aim of mining is to use your computer to guess until it comes up with a hash value that is less than whatever the target may be. If you are the very first to do this, then you have mined the block (normally this takes millions and billions of computer generated guesses from around the world). Whoever wins the block will get a prize of 12.Five bitcoins (as long as it becomes part of the longest blockchain). The winner doesn’t technically make the bitcoin, but the coding of the blockchain algorithm is set up to prize the person for doing the mining and thus helping to verify the blockchain.
Each block is created in sequence, including the hash of the previous block. Because each block contains the hash of a prior block, it proves that it came afterward. Sometimes, two rivaling blocks are formed by different miners. They may contain different transactions of bitcoin spent in different places. The block with the largest total proof of work embedded within it is chosen for the blockchain.
This works to validate transactions because it makes it exceptionally difficult for someone to create an alternative block or chain of blocks. They would have to woo everyone on the network that theirs is the correct one, the one that contains sufficient proof of work. Because everyone else is also working on the ‘true’ chain, it would take a tremendous amount of CPU power to strike them. One of the fattest fears of Bitcoin is that one group may build up 51% control of the blockchain and then be able to influence it to their advantage, albeit gratefully this has been prevented so far.
Primarily, bitcoin miners were just cryptography enthusiasts. People who were interested in the project and used their spare computer power to validate the blockchain so that they could be rewarded with bitcoin. As the value of bitcoin has gone up, more people have seen mining as a potential business, investing in warehouses and hardware to mine as many bitcoin as possible.
These warehouses are generally set up in areas with low violet wand prices, to further reduce their costs. With these economies of scale, it has made it more difficult for hobbyists to profit from Bitcoin mining, albeit there are still many who do it for joy.