Cryptocurrency mining is performed by full nodes, that are part of the blockchain; mining is performed only by blockchains with a PoW based consensus system. Transactions are confirmed by the consensus system, and blocks of these transactions are created to be added to the blockchain; once a new block is added to the blockchain, which is commonly known as block is found, there is a certain reward, which is given to the miner for performing the task of adding the block in the blockchain; the process is not that simple, though. These blocks are added after performing a resource-intensive validation process to validate a transaction. The resource-intensive task is basically the hashing of certain algorithms associated with the currency.
Since the block generation time is kept to around 10 minutes, when the hashing power of miners increases, the difficulty has to be increased in the same proportion. This is done by difficulty adjustment and re-targeting algorithms, as discussed in the previous chapters.
When a miner connects with the network, there are various tasks that the miner performs to keep up with the network. Each coin has a different specification for miners; shown here, in the context of Bitcoins, are some of the prime tasks performed by the miners:
- Validation of transaction: This is the process in which the transactions are validated by verifying the signatures and outputs.
- Validation of block: Once each transaction in a block is validated, the nonce is validated to make the process of block validation complete.
- New block creation: Miners can create a new block at a higher height in the blockchain by adding the transactions that are not part of any other block after the transactions are verified over the network.
- Proof of work algorithm solution: In the task, the miners find a block on the blockchain by solving the required algorithm: SHA256 in the case of Bitcoins. The block header contains a 32-bit nonce field, and miners have to hash it using brute force techniques till the hash matches.
- Supporting the rewarding system: When a node hashes the algorithm, the results are sent over the blockchain network. Once this is done, then other miners in the network verify the block to make sure the height of the transactions in the block do not conflict with any prior block. Once the block is accepted by the network, the miner gets a certain reward in terms of coins.
Let's discuss each of these steps in detail, as well as the process involved in mining cryptocurrency.