Bitcoin mining is the process of verifying transactions of people who send bitcoins from one address to another. Miners confirm that sent bitcoins are real and that the change of ownership from one address to another legitimate.
The Bitcoin network is decentralized, and there is no third-party to determine that information is real. Bitcoin is a peer-to-peer digital currency, a trustless system based on correct mathematics. The mathematical calculations serving as a validating mechanism are completed by miners.
Bitcoins are ‘mined’ by Bitcoin miners—network participants who perform extra tasks.
Bitcoin network participants are nodes operating the Bitcoin protocol. Nodes are computers that run Bitcoin and connect to others running the same software, creating a network. Nodes follow the set of rules encoded in the protocol, share information, and keep the record of confirmed transactions (Bitcoin Ledger).
A miner, a validating node, can be anyone providing computational resources and electricity. Bitcoin is a commodity minted from energy by using a proof-of-work (POW) protocol. PoW transmutes electricity into digital assets and, thus, bitcoin is mined. Money is a representation of the work required to produce the asset and can be viewed as stored energy.
Miners are computers that use energy resources to perform complex computational equations. Miners as validators who offer resources, and for their effort, they are rewarded with newly issued bitcoins and a miner fee, which every transaction includes.
Miners, like full nodes, maintain a complete copy of the blockchain and monitor the network for new transactions. New transactions are firstly recorded in the MemPool, a transaction database, where they wait for a miner to confirm them. Miners compete to successfully validate blocks by solving PoW computational problems known as hashes. The first miner to successfully validate the block announces the solution to the network. If all nodes agree on the block's correctness, the new block is added to the blockchain.
Mining Mining is a distributed consensus system used to confirm pending transactions by including them in a block. More precisely, mining is chronologically ordering transactions in the Bitcoin blockchain to protect the neutrality of the network and allow different nodes to agree on the state of the system.
The consensus mechanism used in Bitcoin mining is Proof-of-Work (PoW). A PoW algorithm uses application-specific integrated circuits (ASICs) to convert electricity into bitcoins through the block reward. The machine using PoW repeatedly performs hash operations (guesses or votes) until the assigned cryptographic puzzle is solved. In return for performing this task, the miner is given bitcoins (block reward). The solution to the puzzle proves that the miner spent energy in the form of ASICs and electricity, which proves that a miner put in work. PoW is proof that energy was burnt.
PoW becomes especially important when it comes to the Bitcoin Ledger. The blockchain can be immutable only if it is costly to do so. That is why PoW features a high cost, and the Bitcoin Ledger is secured by its collective hashing power, which is the sum of all energy expended. PoW was designed for apolitical votes (hashes) via the conversion of energy.
Mining follows a set of cryptographic rules that prevent previous blocks from being altered to secure the network and solve the double-spend problem. Miners spend energy to earn new bitcoins. If an attacker were to try to attack the chain and change a previous transaction, they would have to redo all the work the miners did and catch up to the longest chain by spending the same amount of much energy.
Energy must be invested to perform the mathematical equations for block confirmations. Miners provide the energy, and in exchange, they receive a mining reward. The miners’ incentive to burn the energy by packing transactions into blocks is the miner’s fee included in every transaction and newly minted bitcoins. Every new block includes one extra transaction, which is the miner’s reward. This process brings new bitcoins into circulation.
Around every 10 minutes, a miner is rewarded with new bitcoins. Every 210,000th block, this reward is cut in half, which is known as halving. The new amount of bitcoin is awarded to a miner who used energy to perform the task of mathematical computation (hash function).
A hash function is a function used to map data of arbitrary size to fixed-size values. The process is called hashing and is a computationally and storage efficient way to access data. The use of hash functions relies on statistical properties of key and function interaction. Worst-case behaviour is intolerably bad with a vanishingly small probability, and average-case behaviour can be nearly optimal (minimal collisions).
The miner’s task is to find a nonce—a number that, when combined with the data in the block and passed through a hash function, produces a hash. The result at the beginning of the hash string is an integer between 0 and 4,294967,296, and it must start with a predetermined number of zeroes. The hash function makes it impossible to predict the output, so miners make random guesses. The difficulty of calculating the number (expressed in zeros at the beginning of a hash string) is adjusted for each calculation process so that it takes about 10 minutes to solve the block.
Hash rate is a unit of measure for the processing power of the Bitcoin network (blockchain). It is also a unit of measure of the Bitcoin network’s health, expressed in hashes per second (or H/s). The hash rate measures the number of network attempts to complete a puzzle every second. A high hash rate compared is preferred over a low hash rate because it indicates that the network is secure from 51% of attacks or more. The higher the hash power of the network, the greater the number of miners needed to commit a 51% attack. The hashing power is estimated from the number of blocks mined in the last 24 hours and the current block difficulty.
The Bitcoin block size limit is a parameter in the Bitcoin protocol that limits the size of Bitcoin blocks. It limits how many transactions can be included in one block every 10 minutes. Block size used to be 1 megabyte or, depending on the size of a transaction, three to seven transactions per second on average. In 2017, the block size limit was replaced by a block weight limit of four million weight units, changing the way data in blocks was counted. Now, Bitcoin blocks have a theoretical maximum size of four megabytes, but more realistically, it’s about two megabytes.
Mining difficulty refers to how difficult it is to mine a Bitcoin block. Technically, it means how much computing power is needed to find a hash within the block target (10 minutes). To keep the rate of confirming blocks at 10 minutes, every 2,016th block (approximately every two weeks) the mining difficulty is adjusted, along with the overall hash rate. As the rate increases, so does the Bitcoin mining difficulty. High difficulty means that it will take more computing power to mine the same number of blocks, making the network more secure against attacks.
Due to the random nature of mining, individual miners can combine hash power and mine as one together in a mining pool. Sharing the hash rate with the pool guarantees that the team will find blocks more regularly and share earnings from mining rewards according to their contribution.
Another way to mine Bitcoins is through cloud mining. For cloud mining, a miner borrows funds to pay a company specializing in cloud mining, who uses the funds to buy mining equipment and maintain its current mining rigs. A mining rig is a computer system used for mining bitcoins.
Bitcoin miners over time:
- CPU mining: The first bitcoins were mined with central processing power (CPU), which is a part of personal computers. This method was possible when the mining difficulty was low.
- GPU mining: More people got involved in Bitcoin mining, and graphics processing units (GPU) became popular. They have 30x the power of CPUs. A GPU is a special component for computers used for more complex calculations and commonly used by gamers.
- FPGA mining: An FPGA is similar to a GPU but faster. It is a piece of hardware that can be connected to a computer to run a set of calculations.
- ASIC mining: ASIC mining has been the mining standard since 2013. ASICs were manufactured solely for the purpose of Bitcoin mining, and that function is hardcoded into the device.