What is the Blockchain Mining?
Mining is another of those terms that one hears repeatedly in the blockchain space.
The literal understanding of the word itself applies to a part of what the process achieves, in that it leads to the creation (“mining”) of new coins in the blockchain.
A coin is the generic term used to describe a cryptocurrency. In a blockchain network, mining refers to the process by which a transaction block is verified and added as a block on the blockchain.
This process also leads to the creation of new coins which are given as a reward to the node that successfully “mines” the block.
In some blockchains, there is no reward for mining the block as the mining receives a transaction fee. In any case, there is always some form of reward (or incentive) for mining nodes in a blockchain network.
Most mining processes are based on cryptographic hashing, where mathematical computations are used to solve the complex mathematical algorithms that make up the block header parameters. Recall, that block headers contain a cryptographic hash.
Imagine this hash to be like a complex math problem requiring a solution. It is the job of the mining node to discover the unique solution to this problem in order to verify the block. The blockchain is coded in a way that makes this solution difficult to obtain yet easy to verify by other nodes.
Blockchain mining helps to maintain the structural integrity of the blockchain. With so many nodes working independently, it can be difficult to ensure uniformity of process but mining solves this process easily by introducing mathematical proofs which are a universal language.
Steps Involved in Verifying a Blockchain Transaction
Remember Lulu’s transaction? Having been validated, it now sits in something called the memory pool where it will await the authentication of a mining node.
The memory pool (or transaction pool) is a place in the blockchain environment where all the validated transactions temporarily reside while waiting for authentication by mining nodes during the mining process.
The verification process for transactions in a blockchain is also a step-wise process.
Different blockchains utilize diverse mathematical proofs but the focus will be given to the proof-of-work algorithm in this section. This is the mining algorithm used by Bitcoin. The steps are as follows.
Mining nodes search the memory pool, looking for unconfirmed transactions. One of them will come across Lulu’s transaction, alongside a group of other unconfirmed transactions. These transactions are then aggregated into something called a “candidate block”. The candidate block is an aggregation of data structures (transactions) into a single block for mining.
This is where the cryptographic hashing process takes place. Mining nodes will seek to find a solution for the proof-of-work algorithm of the candidate block that contains Lulu’s transaction.
This action is being carried out simultaneously by numerous mining nodes on the blockchain. All of them race against each other to arrive at the solution first so that they can claim the reward.
The basic principle in the computation stage is to obtain a value that is less than that of a specific target. Part of the architecture of the blockchain specifies a target that is unique for every candidate block. During the mining process, a mining node has to arrive at a value that is less than this specific target.
Only then can the block be said to have been mined. Think of this specific target to be a picture puzzle. Only by fitting the pieces together can the puzzle be completed. Using hashing techniques, mining nodes will perform multiple trial and error computations using something called “nonce values” until a solution for the proof-of-work algorithm is obtained.
The common hash function used by most blockchains that favor the proof-of-work algorithm is the SHA256 hashing function. During the trial and error hashing process, when a nonce value does not produce a value that is less than that of the specific target value, it is modified.
After modification, the process is repeated until the block header value of the candidate block becomes less than that of the specific target.
Depending on the computing power of the mining hardware being utilized, as many as 1 quadrillion trial and error attempts might be required before the correct nonce value is arrived at. For this reason, a considerable amount of computing power and electricity is utilized by large mining node setups.
A mining node will eventually be successful in finding the solution to the proof-of-work algorithm for the candidate block that contains Lulu’s transaction. Once this happens, the mining node will broadcast it to the entire network for others to verify.
The verification process involves examining the proof-of-work solution to make sure that it is indeed of a lower value than that of the target. There are also some other checks that are carried out to ascertain the validity of the solution.
The way blockchains are built, the mining process is a complex one but the process of verifying the work done by miners is actually simple and straightforward.
The complexity of the mining operation adds a robust fidelity component to the network while the ease of verifying drastically speeds up transaction lag times. This is one of the many ingenious aspects of blockchain technology that makes it such a revolutionary concept.
At this stage, the mined candidate block containing Lulu’s transaction is being broadcast throughout the entire network.
Other nodes review the solution to see if it is correct. With each successful validation by peer nodes, a distributed consensus begins to develop as these peer nodes add the mined candidate block to their local copy of the blockchain.
Soon, this distributed consensus becomes a majority consensus and the candidate block becomes a legitimate block on the blockchain.
Once the majority consensus is formed, the mined candidate block becomes a verified block and it will now reside permanently on the blockchain.
At any time, participants in the network can examine the block and they will find Lulu’s 20 Satocoin payment. The successful mining node also receives a reward for being able to mine the block.
Source: Indrek Lasn