Bitcoin mining is the process of adding new blocks of transactions to Bitcoin’s blockchain and is the innovation that lets Bitcoin to function as peer-to-peer electronic cash.
Legacy forms of electronic cash (dollars, euros, yen) are digits in databases of financial institutions, like banks. Trust is required that those institutions won’t block, limit, manipulate, or arbitrarily print money and cause inflation – a trust that has been repeatedly betrayed.
Bitcoin offers a way to manage a financial database without needing any such central authorities. Bitcoin’s solution is a blockchain, a system that democratizes the management of the database by awarding the rights to update the database in a fair, public, and transparent way, in a process known as “mining”.
Mining works kinda like a public lottery system, where any computer (called a “miner”) can participate by doing specific computational work, called “hashing”. The more computational power a miner deploys to produce hashes (aka hashpower), the more likely they’ll be to win the lottery and earn the right to add the next block of transactions to the blockchain and get paid a reward for doing so.
Bitcoin mining serves four main functions:
- Confirming new transactions: New bitcoin transactions are assembled into groups, called “blocks,” and when a block is added to the blockchain, these transactions are confirmed.
- Re-asserting all previous transactions: Each new block serves to re-confirm the validity and permanence of all preceding blocks’ transactions upon which it’s been added.
- Issuing new bitcoin: Miners receive a reward for their work, which includes an amount of newly issued bitcoin, following Bitcoin’s strict supply schedule.
- Securing the network: The global network of miners deploying their computational power makes it prohibitively expensive to prevent or reverse transactions that have been added to the blockchain.
Mining is the open and competitive process of adding blocks of transactions to Bitcoin’s decentralized blockchain, without any need for a central authority.
How does Bitcoin mining work?
Bitcoin mining works in conjunction with Bitcoin node-operating.
Nodes are computers that run Bitcoin’s software, forming the Bitcoin Network and enforcing its rules, such as its supply limit and the timing and sizing of blocks. Nodes maintain their own copies of the Bitcoin blockchain (the history of transactions), and are continuously checking to make sure that proposed transactions and new blocks follow Bitcoin’s rules.
Miners work to add new blocks, which must be accepted by the nodes as valid for them to add it to their copies of the blockchain.
Here’s the basics of how Bitcoin mining works:
- Transaction collection: Miners gather proposed transactions that have been broadcast by users and check that they follow bitcoin’s rules, then assemble them into a group, called a “block”. Transactions that pay higher fees are more likely to be added sooner.
- Hashing: Miners perform hashing, which takes both fixed and variable input data to try to produce an output that meets specific criteria set by the Bitcoin protocol. Since hashes are unpredictable, the only way to produce a desired output hash is through trial and error, by continuously re-running the hash function with a new variable input data.
- Proof of work: The first miner to find a hash that meets the criteria broadcasts their new block of transactions to the network. The block includes their winning hash to prove that they performed the necessary work.
- Block validation: Nodes receive the new block with its proof of work and verify that all its transactions follow Bitcoin’s rules and that the hash meets the necessary criteria. If valid, the nodes append the new block to their copy of the blockchain.
- Reward: The successful miner includes a set amount of newly issued bitcoin in the new block, payable to themselves (known as the “block subsidy”), as well as the fees from the transactions included in the block. This reward acts as the incentive for miners to continue operating and as the mechanism for new bitcoin to be issued.
- Repeat: Once a new block has been added, that block serves as part of the fixed input data for the next round of hashing, and the process repeats.
- Difficulty adjustment: Approximately every two weeks, Bitcoin’s software automatically adjusts the difficulty of output hash’s criteria to ensure blocks are mined roughly every 10 minutes, regardless of the total hashpower on the network. This ensures a steady and predictable issuance of bitcoin and pace of transactions, regardless of total hashpower.
If there are ever conflicting versions of the blockchain, the version that has the most proof of work applied to it is the correct one. Any miner can freely disconnect and reconnect, and easily verify what occurred in their absence, then continue hashing the latest block.
Why is Bitcoin mining important?
Mining is a way to manage a financial database, without anyone in charge.
Rather than a single master copy of a database held by a bank, Bitcoin’s blockchain is maintained equally across a decentralized network of nodes. The current state of the blockchain and the rules that govern it are established by consensus, not any individual’s authority.
A leaderless financial database opens new possibilities for a monetary system:
- Fixed money supply: Bitcoin’s supply is immune from money printing and arbitrary inflation, since the supply limit rule is universally enforced and everyone is incentivized to keep it unchanged.
- Immutable transactions: Once a transaction is confirmed to the blockchain, it’s exceedingly difficult or impossible to alter. Changing a previous block’s transaction requires performing enough computational work to surpass all the work since that block was added.
- Financial freedom: No individual or group can block, reverse, or manipulate transactions. Everyone is free to broadcast their transactions, and if it’s valid and pays the necessary market fees it will be included in the blockchain.
- Transparent monetary system: Bitcoin’s blockchain is open and free to download, so that anyone can audit the transaction history, ruleset, and current supply for themselves.
- Peer-to-peer electronic cash: Bitcoin allows for direct transaction between parties, reducing costs, eliminating middle-men, offering scalability, and increasing transaction speeds (especially across borders). With the advent of the Lightning Network as a second layer to Bitcoin, transactions can be sent at lightspeed with low-to-no cost.
Bitcoin is a rules-based peer-to-peer electronic cash system that operates 24/7, and mining is the incentive-based innovation that makes it happen.