Bitcoin 104 (101 part 4): mining
Tuesday 21 June 2016
Miners are critical to the security of bitcoin. They are the ones that make direct, online money transfers possible without running into problems of fraudulent transactions.
The key feature of bitcoin is that it allows transfers of funds between users over the internet, without any single third party like a bank or government keeping track of accounts. Instead, the work of preventing fraud is shared amongst every active member of the network.
These active members are called miners. Anyone can use the bitcoin network, but it is maintained by thousands of dedicated computers, all running the same software, distributed around the world. Miners bundle together recent transactions submitted by users and incorporate them in the blockchain - the shared ledger of every transaction that has ever been made.
The question naturally arises: how does the network know that a transaction is legitimate? After all, digital information can be copied easily, so what is to stop someone from trying to spend funds they don’t really have?
Bitcoin deals with this by making it very, very difficult for miners to add a bundle of transactions to a new block, but very easy to check whether transactions are legitimate. Individual miners are pitted against the whole network, so that any fraudulent transaction would require that the miner controls more than half of the entire network’s resources. Thus it is not worth the resources and expense of trying to trick the rest of the network.
Like regular mining, bitcoin mining is resource-intensive
The hard work of mining
Bitcoin miners or ‘mining rigs’ are dedicated computers that perform a very simple task many billions or even trillions of times per second. They look to find a ‘hash’ - a cryptographic function - that meets certain extremely limited criteria. This is known as a proof-of-work and is a little like looking for a needle in a haystack. The odds of finding the right answer to the puzzle are so small that only one is found by the entire network of bitcoin miners every 10 minutes, on average. (How difficult it is to find one is adjusted depending on the amount of computing power directed at the network, so although there may be some variation, 10 minutes remains the average.) Bitcoin mining therefore has costs in terms of special hardware and electricity, so it is expensive to try to trick the network for no gain.
When a miner finds a hash that meets the right criteria, it is allowed to add that bundle of transactions to the blockchain. Information about the whole of the previous blockchain is included in the new block - hence blocks are 'chained' together. As a reward for doing this work, the miner is given a number of new bitcoins, called block rewards. Since miners are the only ones allowed to add transactions to the blockchain, only a miner can try to dupe the network by adding a fraudulent transaction.
Because there are so many miners and it is so hard to find a valid hash and add a bundle of transactions to the blockchain, it is practically pointless for a miner to try. It is extremely hard to find a valid new hash, but extremely easy for other miners to check that miner’s work and ensure it is correct. If a new miner tries to cheat, the others will notice that there is a problem (since the blockchain is shared amongst everyone) and that the transaction submitted by the last miner does not match the record everyone else has. At that point, the fraudulent transaction is discarded by the vast majority of the network and the rogue miner’s efforts have been in vain.
The '51% attack'
The only way a miner can ensure a fraudulent transaction will be added to the blockchain is to have support from a large proportion of the computing power (‘hashrate’) in the whole network - ideally over 50%. There are so many miners and so much computing power that this would be far too expensive to succeed.
The bottom line is that it is far safer and more profitable for miners to support the official blockchain than to try to deceive the rest of the network and create a different version for their own ends.
comments powered by Disqus