Mining is the name given to the verification and validation process that means a cryptocurrency operates without the need for a central authority, as traditional fiat currencies do. When a fiat currency is transferred between parties, a central authority approves the transaction as having been made by a rightful original owner of the currency. It also confirms that ownership has been transferred to a third party and that the same currency units are deducted from the balance of the sender and not sent twice.
Cryptocurrencies rely, rather, on their peer to peer blockchain network to perform this role. The verification and validation process is resource intensive and the parties providing this resource are rewarded with ‘new’ cryptocurrency units. These units are finite because the total number that can ever come into circulation is set at the launch of the cryptocurrency. So, just like a miner of a physical commodity, like gold, crypto miners dedicate resources to the difficult process of extracting a finite digital commodity. Also like physical commodities mining, the more of the digital commodity that has already been extracted, the harder the process becomes. This controls the pace at which new cryptocurrency units are released into circulation until eventually, the full number has been.
But how does this mining process of cryptocurrency units verify transactions involving the same cryptocurrency unit, create a transaction history that cannot subsequently be tampered with, preventing fraud? When the owner of cryptocurrency units wishes to make a transfer, they create this transfer order in their e-wallet, which is known as a ‘client’. This is digitally signed by the sender using a personal key and the key of the currency units to be transferred, which includes the data of the previous chain of transactions which verifies ownership. The transaction is then broadcast to the peer to peer network, which consists of all of the other ‘clients’ of holders of that cryptocurrency. These clients all check that the keys are valid and the transaction is legitimate. If not, the transaction is rejected by the network.
If everything is in order, the transaction continues to be broadcasted throughout the network until it reaches miners. The job of the miners is then to bundle these transactions into data ‘blocks’ of the right size, to be added to the blockchain, which is the historical ledger of all transactions that have ever been made involving units of the cryptocurrency. Adding the new block to the blockchain locks the information in and is used to validate the new owner’s position in the chain of ownership.
However, to make the blocks secure, the data is encrypted into a ‘hash’ function, which is a code consisting of a series of seemingly random numbers and letters. It’s a one-way encryption process without a key, so reverse engineering the block back into the original data is extremely difficult. Creating a hash from a set of data is not difficult and miners, which are basically computers with processing power, could very quickly create new blocks. As the reward for creating a block is newly issued digital currency units, this would mean all of the units would be quickly released into circulation. To slow that process down, the cryptocurrency’s protocol (its software) makes things harder for miners.
The hash function of blocks must adhere to a certain format, such as beginning with four zeros. It is not possible to know what a hash will look like before a data set is encrypted into one. However, the same data will always result in the same hash. There is a minuscule chance that the hash will fit the format required by the protocol so the miner has to always add an extra piece of data called a ‘nonce’. Adding the nonce means the resulting hash will be completely different. Miners add thousands, hundreds of thousands, millions and potentially billions of different ‘nonce’ additions to the bundle of transaction data until one nonce leads to a hash being produced that matches the requirement set by the protocol.
Different miners compete to be the first to achieve this and to create the new ‘block’ which is then added to the chain. The miner is then rewarded with some new cryptocurrency units, the incentive for performing its function in the blockchain verification system.
As well as the transaction data and the nonce, each new block also contains the hash of the previous block in the chain. This means that if anyone were to attempt to create a false ownership record of cryptocurrency units, they would have to tamper with earlier blocks in the blockchain. Doing so would mean that tampering with the block would change the hash. It then wouldn’t match with the hash chain across the rest of the blockchain and the falsified block would be rejected.