Bitcoin has changed the future and will redesign finance and the way we all store value. While it’s easy to say that it all runs off the backs of miner’s it becomes more difficult to actually explain what they are doing. The truth is that they are doing a whole lot of math.

As you’ve probably heard, Bitcoin solved the age old Byzantine General’s Problem by validating signal’s outside the bounds of direct communication. This solution is what allows bitcoin verify the balances and transfers of bitcoins across the network without relying on a central source. This is revolutionary in itself as this would have required a central source before. Now this task is resolved to the miner’s.

Personally I’ve often described Bitcoin as being similar to gold. This opens up the brain’s mind to recognize the concept of mining and that in doing so it can be resource intensive to complete. Apart from that, Bitcoin actually works quite differently and it’s actually quite genius once you can get your head around it. So how does it all work?

Bitcoin mining requires a computer and a special program. Miners will use this program and a lot of computer resources to compete with other miners in solving complicated mathematical problems. About every ten minutes, they will try to solve a block that has the latest transaction data in it, using cryptographic hash functions built from the block that was before it.

 

A cryptographic hash function is essentially one-way encryption without a key. It takes an input and returns a seemingly random, but fixed 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 change even one letter of the original input, a completely different hash value will be returned. This randomness makes it impossible to predict what the output will be.

How Are Hash Functions Useful For Bitcoin?

Because it is practically impossible to predict the outcome of input, hash functions can be used for proof of work and validation. Bitcoin miners will compete to find an input that gives a specific hash value (a number with multiple zeros at the start). 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 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 reward of 12.5 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 reward 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 competing 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.

2016-12-21-1482326831-9438069-bitcoinblockchainsmall.png

source: Bitcoin.org

This works to validate transactions because it makes it incredibly difficult for someone to create an alternative block or chain of blocks. They would have to convince 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 beat them. One of the biggest fears of Bitcoin is that one group may gain 51% control of the blockchain and then be able to influence it to their advantage, although thankfully this has been prevented so far.

Who Are Bitcoin Miners?

Initially, 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 electricity prices, to further reduce their costs. With these economies of scale, it has made it more difficult for hobbyists to profit from Bitcoin mining, although there are still many who do it for fun.