There are three primary ways of obtaining Bitcoins: buying them on an exchange, accepting them for goods and services and mining new ones. Mining is a process of adding transaction records to the Bitcoin’s public ledger called the Blockchain.

It exists so that every transaction can be confirmed, and every single user of the network can access this ledger.
It is also used to distinguish legitimate Bitcoin transactions from attempts of re-spending money that has already been spent somewhere else.

Mining — a process of record-keeping, done through the use of computer processing power.

Blockchain — a public distributed ledger where records of every Bitcoin transaction are held.

The Blockchain is so called because it is literarily a chain of blocks, which are lists of transactions made during a set period of time. When a block of transactions is generated, miners put it through a process. They apply a complex mathematical formula to the information in the block, subsequently turning it into a far shorter, seemingly random sequence of letters and numbers called a ‘hash’.

Hash — a fixed-length unique sequence of random digits, which can be created from data of any size.

A hash doesn’t only consist of information from the block of transactions, some other pieces of data are used too. Most importantly, the hash of the previous block stored in the Blockchain is included.

While it’s relatively easy to produce a hash from a collection of data like a block of transactions, it’s practically impossible to know what data was used just by looking at the hash sequence. Moreover, each and every hash is unique, and changing just one character in a Bitcoin block completely changes the hash sequence.

 

As you can see in the example above, no matter how much data is used as input, the hash will always stay the same length.

Because of these attributes, hash works as a digital wax seal. If someone tampers with just one block of transactions its hash will immediately change, and so will all the following hash sequences in the Blockchain. Thus, every attempt at fraud within the Bitcoin network will be easily spotted by everyone using it.

 

Rewards

Essentially, miners are serving the Bitcoin community by confirming every transaction and making sure that every single one of them is legitimate. They all compete with one another, using software written specifically to mine blocks. Every time a new block is ‘sealed off’, meaning that a miner has successfully created a correct hash sequence, he or she gets a reward.

As of October 2017, the bounty stands at 12.5 Bitcoins per block, and this value will decrease by half every 210,000 blocks. The overall number of Bitcoins is limited, so the more coins are mined, the more valuable each of them becomes. Thus, even though the amount of Bitcoins per block will inevitably decrease, the value of miners’ rewards will most likely stay the same or even rise.

Normally, it would be extremely easy to produce a hash from a collection of information, computers are really good at this. Hence why, to prevent users from hashing thousands of transaction blocks each second and mining all of the available Bitcoins within minutes, the Bitcoin network has to deliberately make the process more difficult.

Complications

This is done via a required ‘Proof of Work’. It is a system that requires some work from the service requester, usually meaning processing time by a computer. Producing a proof of work is a random process with low probability, so normally a lot of trial and error is required for a valid proof of work to be generated. When it comes to Bitcoins, hash is what serves as a proof of work.

Proof of Work — an economic measure used to ensure against fraudulent activities by requiring some work from the service requester, usually meaning processing time by a computer.

To complicate mining even further, something called the Bitcoin Difficulty is implemented in the process. It is a measure of how difficult it is to find a new block compared to the easiest it can ever be.

Bitcoin Difficulty — a measure of how difficult it is to generate a correct hash.

This measure is recalculated every 2016 blocks. It is designed so that mining one block will take approximately 10 minutes. As more miners join in, the rate of block generation inevitably goes up. Then, after the difficulty level is recalculated, it rises in order to compensate and bring the rate of block creating back down. Any block released by fraudulent miners that does not meet the required difficulty level will be rejected by everyone on the network, thus becoming worthless.

So, this process requires exertion and through it new currency slowly becomes available. The rate at which new coins appear resembles the rate at which commodities like gold are mined from the ground. Hence why the process is called ‘mining’.

How Block Chain works