A Deeper Understanding of Bitcoin Mining & Proof of Work
There are several questions that people who want to start working with cryptocurrencies ask.If they know that you are already informed about the technology, you will find that they will ask similar questions repeatedly about Bitcoin, and how it is created.In this article, we will try to answer some of the questions that I have come across often from the beginners into this fantastic crypto journey.The Bitcoin MinerWhat is bitcoin mining?Only computers (nodes) operating on Bitcoin Core, the network that runs the blockchain, can create bitcoin. The nodes do this by ‘creating’ and ‘solving’ new blocks in a process known as mining.Whenever a new block is mined, communication is sent to the network, and the update of the ledger is done so that the current state is held by everyone in their copies of the ledger.This is the power of the distributed ledger. The updates are continuous, and it is near impossible to attack the network. This is because any ledger that is not identical to the others at any time is rejected by the network.Therefore, we can say that ‘creating’ + ‘solving’ = ‘mining.’How are blocks ‘created.’Any node on the network can create a block.When creating a block, several things are needed;The identity of the previous blockThe identities of all the transactions that are to enter the new blockA random number called a nonce.There are probably thousands, if not millions of nodes trying to find a valid block every 10 minutes. Only one block is allowed to continue the blockchain. It is, therefore, a race against time. So how does the network ensure that the race is won by only one person every time?Parameters enabling even bitcoin mining.It is estimated that the last bitcoins will be mined in the year 2140.When writing this, there are already roughly 16.8 million bitcoins already mined. This means that only 4.2 million bitcoins remain!So the question begs, how will they be evenly mined in roughly 123 years?By oversimplification of what happens, we can say that the code that runs bitcoin is designed such that the reward for mining blocks is cut by half after every 210,000 blocks, which is roughly four years.This is so because only around 2160 blocks can be mined in two weeks, or rather one block in 10 minutes.The code calibrates the rate by increasing or decreasing the difficulty of solving the mathematical calculation that computers must carry out to earn mine the block.The rewards started at 50 BTC per mined block, and this has been halved twice to the current reward of 12.5 BTC per block mined.Why Proof of Work (PoW)?Since every mining node is ‘creating’ a block, there has to be a way of ensuring that, of thousands of blocks being attempted at the same time, only an average of 1 block is successfully solved in 10 minutes.Satoshi found a way of doing this using ‘Proof of Work’.When a computer creates a hash for the new block, it computes a cryptographic equation using the identity of the previous block, the identities of the confirmed transactions and a random number.The hash thus created is of a definite length, and must be compared to the current value availed by the blockchain. It must be lower than or equal to that value.If it falls out of the valid range, the node picks another nonce value and tries to solve again. All the nodes will continue doing this until a valid block identity is found, and the race is won.Because of how random this process is, billions of computations are done by thousands if not millions of computers.The program allows the node that finds the answer first to claim a confirmed block and distribute the current state to the network. That block is said to be mined.The node will then claim a reward of newly minted bitcoins.How are the fees and rewards claimed?For a transaction to be complete, it has to be verified. This is done by other computers in the network. The transaction then enters a memory pool.You have to attach some transaction fees to each transaction so that you incentivize miners to pick your transaction when hashing a new block.The miner who has created a block that has your transaction will claim the fees you had attached to the transaction.Your transaction can now await confirmations in the blockchain. These confirmations happen whenever a subsequent block is added to the one which contains your transaction.What happens to discarded blocks?Blocks that did not win the race are discarded.Any transactions that are in them and are still not embedded in the blockchain are returned to the mem pool.How does the blockchain prevent the fraudulent addition of coins?Because of the pursuit of ‘a single truth,’ the bitcoin logic is that miners only add a valid block to the longest chain of blocks. If two blocks are confirmed at the same time, they are said to be ‘forking.’They are tentatively given time to establish their chains. Several block generations later, the network will only follow the longer chain, and the ‘orphaned block’ will be abandoned.However, blocks in the shorter chain will still exist, but the owner will not get any rewards.One of the Bitcoin Core rules is that claimed rewards must only mature after confirmations exceed 100 child blocks for the chain to be considered the ‘single truth.’That is when the mining reward gets deposited into the wallet of the miner by the protocol. At that point, there cannot be two claimants of the same reward.Aren’t there many wasted efforts to mine?The whole essence of mining is to prove that you worked to create the block. This is done on pain of expending electrical energy and computational power. This is why it is called Proof of Work.Proof of Work is, therefore, proving to be unsustainable in many areas of the world where electricity is expensive, and mining rigs are expensive to import and maintain.Other challenges is that transaction fees escalate due to the long queues that result when a blockchain becomes more mainstream.Bitcoin has also suffered from long wait times for transactions to go through due to the long queues.However, there are efforts by the community to reduce these wait times and fees by increasing block sizes and implementing other improvements into the blockchain.Meet the minersWhen bitcoin started, it was possible to mine bitcoin using a normal computer or laptop. This is because the competition was low, and therefore the difficulty was very low.However, when it gained traction, bitcoin mining started being done by more powerful computers, and soon, the Chinese made specialized mining processors called Application Specific Integrated Circuits (ASICs), and soon, mining rigs were born.Huge mining farms nowadays will be found where electricity is cheap. Private companies will specialize in investing in mine bitcoin. Examples are Tidbit, Bitmain, and BTCS.Another way of creating mining rigs that can compete is to have mining pools. In these pools, people pool resources to ‘rent’ mining space. Examples are AntPool, Slush Pool, BitMinter, and F2Pool.Final ThoughtsProof of Work is the concept in which computers solve mathematical problems to win the right to embed transactions on a blockchain and therefore earn rewards.It is a wasteful process that is necessary to claim that the reward was as a result of hard work.The blockchain regulates the number of blocks that can be created over time through hardcoded algorithms that also dictate how the reward for mining is distributed.The availability of bitcoin is near 80%, and the rest will be mined in a controlled and distributed manner for over 100 years into the future.
#News - https://gurubitcoin.tk/2017/12/a-deeper-understanding-of-bitcoin-mining-proof-of-work
Comments
Post a Comment