Simply stated, mining is the process of adding transaction records to Bitcoin’s public ledger of past transactions called a blockchain. This process is called “mining” because it is how bitcoins are created, similar to how gold is uncovered through mining. Mining is needed to ensure fairness and to keep the network stable, safe and secure. In this article, we will simplify the description of mining to make the concept easy for newcomers to understand. Visit more articles in this category for deeper explanations.
Bitcoin is a peer-to-peer network and no central authority controls it. Everyone can send transactions to the network, but if it is not valid, it will be rejected by the network and every transaction must be confirmed to be valid. Miners first collect transactions most recently made by bitcoin users, verify that the transactions are valid, and compile them into a block – a condensed record of all transactions for a period of time.
What stops miners from simply creating a transaction block and immediately adding it to the blockchain is the Bitcoin algorithm designed to make that a difficult thing to do. A miner must solve a very difficult computational puzzle called a “proof-of-work” (POW) scheme that other miners are also working to solve simultaneously. This POW has solutions that are easy to verify, but very difficult to find. When one miner finds that solution, they broadcast it to all other miners who then verify it is correct. Only then will the successfully “mined” block get added permanently to the publicly accepted blockchain. That winning miner is rewarded for the effort with 12.5 newly created bitcoins. This is the reward that incentivizes miners to invest computational time and effort, while at the same time adding to the overall bitcoin money supply.
The Bitcoin protocol (rules) sets the difficulty level of the computational puzzle miners must solve to ensure that it takes an average of 10 minutes to accomplish. When a miner tries to mine a new block, the number and ID of the previous block is included. Say for example someone mined block #100, which follows #99. It is possible that someone else did not notice that a valid block to follow #99 was found and also makes a #100 as well. We will call that second block #100* and while it may be valid, it is not part of the main chain – a detached or orphaned block. These can occur naturally when two miners produce blocks at similar times, both solving the puzzle at the same time.
When this happens, the block with the larger share of proof-of-work gets accepted, and the other is discarded with any valid transactions added to the next valid block accepted on the blockchain. For this reason, most clients and merchants require a transaction to be confirmed by at least 6 blocks – meaning 5 blocks must come after it and once that happens, a transaction is irreversible and final. Confirmation generally takes about an hour and means that a transaction will not be reversed, which creates a stable situation for users.
The system of rewarding successful miners with bitcoin has proved an effective way to get the currency into circulation. Conventional payment systems profit from the transaction fees paid by users, but that business model would not have worked for bitcoin in its early days, because of a lack of users. As bitcoin becomes more mainstream, the idea is that miners will be able to start charging significant transaction fees to replace mining as their main source of income. The Bitcoin protocol also cuts the reward for solving those puzzles every four years or so in half.
Safety and Security
Miners make the Bitcoin blockchain trustworthy and the system was specifically designed to keep everybody honest. Successful miners have to wait for a further 99 blocks of transactions to be processed before they get their rewards — so there is a constantly refreshed pool of participants with an interest in ensuring that everyone else keeps to the rules. When billions are at stake, vested interests tend to defend the status quo also.
Currently, if there is a general agreement for improvement and the solution has been proven workable, the system’s software code is updated by one of the five main, original developers. Then miners must accept the changes and signals acceptance by updating the software on their machines. Once the majority of miners does the same, only then does the change become part of the system.
The safety and security of Bitcoin as a payment system is in the hands of the miners in that every time one of them solves a block, that one has the power to decide what transactions are accepted to the blockchain. Miners are generally fair and include as many valid transactions as possible. Whenever a miner is not fair and selectively excludes some transactions, other miners include them in the next block.
As more people mine, the total computation power required rises and it will be much, much harder for anyone to obtain more power than all other miners combined to perform what is known as a 51% attack. Even now, in order to own hardware capable of performing such an attack would be so enormously expensive that it is economically unfeasible, if not completely impossible. Every miner contributing power to the Bitcoin network ensures that only fair miners will find blocks keeping it safe for people to trust.
Cryptocurrencies Not Mined
Some crypto coins like Ripple XRP and Stellar XLM are not mined at all. They use other mechanisms, such as voting, to create the currency and update their blockchain. Emerging “side-chains”, such as Lightning Network, are new blockchains pegged to that of bitcoin in such a way that the currency and other assets can be transferred between them.