Bitcoin mining in theory: what is the principle of mining?

There is a reason why bitcoin mining got just this naming. Solving mathematical problems in order to find Bitcoins is really similar to mining gold. Just like gold lies under the ground for a long time before it gets mined, Bitcoins also exist in a protocol's design and wait to be discovered. How exactly does Bitcoin mining work? How many Bitcoins are there and how many of them still remain unmined? Find all the answers in this article.

There is no centralized authority in the Bitcoin network which could control transfers of transactions like in the case of real currencies controlled by banks. To protect the system against cheating, all transactions are verified by other miners in the network. This process of verification and confirmation is called “mining”.

How does bitcoin mining work? By confirmatiion of transactions

When an owner of Bitcoins sends a valid transaction, it is added to the line of unconfirmed transactions where it waits to be processed. Each transaction contains an arbitrary fee for miners which they will receive as a reward for confirmation. The higher the fee, the higher probability of fast execution of the transaction. Certain number of transactions unites in a block with the maximum size of 1MB. It then depends on each miner or pool, what transactions and how many of them to lock in a block. The aim is to include the highest possible number of transactions to gain as many Bitcoins as possible.

After that, miners confirm the block by solving assigned mathematical task – they have to calculate the right hash which encrypts the block. The Bitcoin system itself assigns demands about what the hash should look like and each miner tries to find it before others do.

As soon as the demanded hash is found other miners verify its correctness and the confirmed block of transaction is added to the Blockchain. A Blockchain is basically a big account book to collect all Bitcoin transactions, it is transparent and enables you to watch each movement of Bitcoins.

If you are interested in how mining Bitcoins works in practice and what you need to do it, read our article Beginner´s guide to mining Bitcoins: How to mine Bitcoin step by step.

Miners get Bitcoin as a reward

Confirming transactions requires a large amount of electric power. That's why miners receive a reward (in case of finding the hash) in the form of Bitcoins and fees. In 2009, the first price of Bitcoin was derived from the price of spent energy. One Bitcoin then cost 0,00076 USD.

Nowadays, the price for confirmed block is 12,5 BTC. However, it is halved regularly (next decline is going to come in 2020). In 2140 all 21 million BTC should be mined. Today, there are about 16,7 million BTC in circulation, so 4,3 million BTC still wait to be mined.

Chart shows how much of all 21 million BTC was mined in the end of 2017. There are almost 17 million BTC in a circulation and 4,3 million BTC still wait to be mined.

How to find the right hash?

What is the mentioned “mathematical task” processed by miners?

There is no centralized authority in the Bitcoin network to register transactions. But then, what or who determines which transactions can unite in a block and which miner registres them? The miner who first solves the task has the right and duty of creating a new block and adding it to the Blockchain. Creators of Bitcoin used a cryptographic hash function SHA-256 in order to allow that.

Cryptographic hash function is an algorithm which transforms input data into a relatively small sum of symbols. It basically encrypts transactions included in a block. Each text has its specific hash and it takes less than a second for a computer to create it. However, Bitcoin is pre-established to be completely mined in 2140 so it is necessary to regulate the speed of mining and adjust its difficulty (in practice the mining of one block takes 10 minutes in average). In order to increase or reduce the difficulty of mining, the system monitors the speed and adds additional requirements what the hash should look like. It happens regularly every 14 days (you can check the graph of changing mining difficulty here).

The additional requirement in the Bitcoin network is the modification of hash by adding a certain number of zeros at its beginning. It is necessary to change the input data to change the hash. However, nobody wants to change the information about transactions, that´s why we use so called proof of work. It means we basically add a small arbitrary text (so called nonce) to the block. The mining programme simply adds a nonce, solves the hash and checks the result. If it doesn´t meet the requirements, it changes the nonce and continues by repeating the cycle till the right hash is found.

The picture (from Bitcoin Wiki) explains the principle of cryptographic hash function. The hash changes after adding the text to the input information. If the requirement is to begin hash with 4 zeros, it is necessary to add a modified nonce till the right combination is discovered.

There is no faster way to find a hash than trying again and again. The solution of a hash depends partly on chance, nevertheless you can increase your chances by using a really powerful mining rig. Modern machines manage to solve even millions of cycles per second. When a miner solves the task, he informs other miners, they check it and start solving another task.

How other cryptocurrencies work?

In general, mining cryptocurrencies is based on the same principle as mining Bitcoin. There´s only a few differences, e.g. various currencies use various algorithms or they modify running a mining network in some way. It is worth it for small miners to mine some less popular currency because the competition of computing power is not as rough and it isn´t even necessary to have specialized mining devices in some cases.

Nowadays, there are more than one and half thousand cryptocurrencies. Some of them already lost their value and ceased to exist, on the other hand new ones still arise. Frequently, new currency arises by separating itself from an existing currency after miners couldn´t agree on a significant change in the network (you can find graphic illustration of “Bitcoin forks” here). The most significant cryptocurrencies aside from Bitcoin are Lite Coin, Ethereum, Bitcoin Cash or Neo.

What do you need for mining?

Basically anybody with sufficiently powerful hardware can mine. At the beginning of the mining there is always quite a high investment into the mining rig. These days Bitcoins are mined almost exclusively by specialized ASIC devices that are dedicated directly to mine Bitcoins (and other currencies based on the same algorithm). Other currencies which use another form of hashing such as Litecoin or Ethereum can be mined by graphic cards. If you already own a mining rig, it is only up to you to set a Bitcoin wallet, download mining software, join a mining pool and start mining. If you want to find out how to mine Bitcoin step by step, read our article Beginner´s guide to mining Bitcoins: How to mine Bitcoin step by step.