Find out how cryptocurrencies are mined to create a blockchain and earn users tokens in this 2-minute read.
At Springwise, we have seen how cryptocurrency has grown in popularity. We have covered a number of innovations that seek to make cryptocurrency more accessible, including a TV that mines cryptocurrency and a cryptocurrency baseball game. Around the world, hundreds of thousands of specialised computers have been built to mine cryptocurrency. Mining is not only a way to earn cryptocurrency tokens such as Bitcoin, but it also authenticates cryptocurrency transactions and keeps the whole system of cryptocurrency running. So, how does cryptomining work?
The purpose of cryptocurrency is to provide a way to exchange tokens (digital money) without having to rely on a centralised system, such as a bank. However, in order for a decentralised system to be secure and trustworthy, there has to be a way of keeping a record of all of the transactions that have taken place. This is where blockchain comes in.
A blockchain is a constantly-expanding ledger that keeps track of all the tokens in circulation in a particular cryptocurrency. The blockchain of a cryptocurrency exists in the thousands of computers in the cryptocurrency network. But if there is no central authority, who decides which transactions are valid and should be added to the blockchain? Additionally, if the tokens only exist in digital form, how can people be prevented from spending the same one twice? The answer is mining. Mining is essentially a way to encode and decode the blockchain.
Cryptocurrencies are mined in units called ‘blocks’. Each block is made up of a number of pending transactions, and is first turned into a numerical problem. The first miner who solves the problem announces it to the others in the network. The other miners then validate the solution. If enough miners give their approval, the block is added to the ledger (i.e., the tokens are bought or sold and have a new owner) and the miners move on to the next block. The miner who found the solution also receives a certain amount of cryptocurrency for their effort.
While ‘solving a numeric problem’ may sound like hard work, there is actually no computation involved. Instead, miners are trying to be the first to come up with a 64-digit hexadecimal number (called a ‘hash’). This number encrypts the data from the block. Any transactions within a blockchain (such as buying and selling tokens) uses the hash rather than data (such as the person’s name and address). This provides secrecy and security to cryptocurrency buyers and sellers.
Each block contains a header which includes a version number, a timestamp, the hash used in the previous block, the Merkle Root (the hash of all the hashes of all the transactions in the block up to that point), the number the miners are solving for (called the ‘nonce’) and the target value for the hash. In order to encrypt the data and complete a hash, the miner must find the nonce, which is a string of random numbers. Finding the nonce is essentially guesswork. Miners use an algorithm to cycle through all the possible solutions until they find the correct one. The work involved in finding the nonce is called ‘proof of work’.
Once the nonce is found, it is added to the hashed contents of the previous block, and then rehashed. If the new hash is less than or equal to the target value in the header, then it is accepted as the solution; the miner is given the reward, and the block is added to the blockchain. However, this only happens if the miner is the first to present a hash that is less than or equal to the target hash. Simultaneous answers do occur. When this happens, the network will decide by a simple majority (51 percent) which miner to reward. Usually, it is the miner who has done the most work (verified the most transactions).
Hashing requires a huge amount of computer processing power, because it involves performing a large number of functions very quickly. High-powered mining computers (‘rigs’) can cost tens of thousands of dollars, and use a huge amount of electricity. In order to maximise their chances of finding the target hash first, miners are also increasingly joining with other miners to form a pool – a group of miners who combine their computing power and then split the mined currency. Most mining is now down in pools. This has led to a concern that mining is increasingly being monopolised by large pools, and by countries where electricity is cheap.
The size of the pools could also cause another problem. In order to double-spend a token, digital bank-robbers would need to rewrite the blockchain. In order to do this, they would need to control at least 51 percent of the network’s puzzle-solving capacity. However, as mining pools have gotten larger, they are also moving closer to amassing the capacity to mount a 51 percent attack.
11th December 2018