How does the blockchain mining process work? (A step by step guide)
So, how does a blockchain actually mined? Let’s discuss the step by step procedure of mining a blockchain (and cryptocurrencies).
Mining as the name suggests is reference to something that is to be bored or dug to get the best outcome. Blockchain mining refers to the activity performed by miners on the network to get the new blocks added to the blockchain. In other words, ”Mining is the mechanism that allows the blockchain to be created securely and in a decentralized manner. It provides the basis for the cryptocurrency system and enables a peer-to-peer network without a central authority.
So, how does a blockchain actually mined? Let’s discuss the step by step procedure of mining a blockchain (and cryptocurrencies).
Blockchain Mining Process
#1 Token dispatch
When a user tries to perform a transaction of some value through the network, he/she dispatches crypto or tokens to another user from their wallet application.
#2 Broadcasting of transaction
Once a transaction is performed, it is advertised by the wallet application to be selected and confirmed by the miners on the blockchain. This transaction is added to the pool of unconfirmed transactions where it waits for its turn to be picked up by a miner. The transactions which are not confirmed by any miner form small groups referred to as a pool of unconfirmed transactions, under a big group.
#3 Selection of a transaction for a block
Now, a miner picks up the transaction from the pool of unconfirmed transactions to create a block. Block is an association of transactions in addition with some extra metadata.
A miner forms his/her own block of transactions. The same transaction can be chosen by different miners by verifying the eligibility of transaction to be executed with the history of the blockchain. Miners validate new transactions and record them on the global ledger (blockchain). On average, a block (the structure containing transactions) is mined every 10 minutes.
For example, two miners x and y will first check the transaction to confirm whether it should be added to this particular block or not by going through the various characteristic of that particular blockchain. For instance, a particular blockchain has its own maximum block size. If we take Bitcoin blockchain, the maximum block size is 1 MB of data. So, before adding a transaction to their block, a miner needs to examine its suitability. If the sender’s wallet balance has sufficient funds according to the existing blockchain history, the transaction is treated as eligible and can be added to the blockchain.The transaction with a high fee set will be taken into priority because of the high reward provided by them. Some miners choose to set a certain fee threshold for selecting transactions so that their mining application selects only the most profitable transactions.
#4 Mining the signature and Formation of block
Miners elect the transactions and club them together to form a new block. Now, the block needs a signature to be added to a blockchain. This signature is known as Proof Of Work. Signature or proof of work (PoW) symbolizes that a miner has spent a lot of time and resources to solve very complicated mathematical problems. Each block of transactions gets different mathematical problems to be solved so every miner will work on a different problem which is unique to the block they built. Every mathematical problem is quite complex and requires a lot of computational work resulting in a lot of electricity consumption. This activity of solving a complex problem by mathematical calculation is known as mining. Mining is the efforts done to get the signature of a block.
In order to better understand the whole process of formation of the block we must know the following terms:
Hash input: Hash input is a string of digits and data inside the block, which is there to be hashed to bring out the hash output.
HASH OUTPUT (aka signature) is a 32 digit string formed out as a combination of existing letters and numbers, budded out of hash function. It outsets with a certain consecutive zero.
The output string generated by an input string is always random for each different input string.
Hash function is simply put a mathematical problem that is very hard to solve, but where the answer is very easy to verify.
A hash function turns an input string of random numbers, symbols, and letters, into a new 32 digit string -hash output. The modification in input results in variation in output. However, the same string of input will always give the same string of output.
Hashing power: miners are known as hashing powers.
Nounces: The part in the hash input that is changed to get the desired hash output .
So, the whole process of mining is done to get the hashed output out of hash input through a hash function to form a valid block for a blockchain.
There are one or two projects working in the direction of resolving the electricity overhead and cost issue of the mining process. Pieta is one such project. It is a new kind of blockchain mining platform which utilizes the X20 algorithm to reduce the energy consumption in the mining. It does so by controlling the overheating of mining hardware through its multi-hashing process. Other than that, Pieta also focuses on enhancing the use of solar energy in mining in order to reduce the electricity cost while protecting the environment from the adverse impacts of carbon release.
#5 Addition of block in to the blockchain
The miner, who is the first to get the qualified output or signature for the next block to be added in the blockchain, will introduce this block and its signature to other miners.
#6 Verification of signatures legitimacy
In this step, the other miners will examine the validity of the signature launched by the miner by hashing the string of data of the broadcasted block and matching the hash out with the signature. If it matches the miners gives their confirmation on its validity. The higher number of confirmations makes it difficult for hackers to work on it. This is how the definition ‘proof of work’ can be elucidated. The signature is the ‘proof’ of the work done in the form of the computational calculations. The block is now ready to be added in to the blockchain, and is spread across all other nodes on the network. The other nodes will greet and save the data into their transaction data, subject to the condition that it coherence correctly with the current wallet balances (transaction history) at that point of time.
#7 Confirmation count
After the addition of new block in the blockchain, every subsequent block which is added after that block is considered as a ‘confirmation’ for that particular block. For example a new block is included in the blockchain at 06 position and the blockchain is 09 blocks long, then the confirmation blocks for the 06 block are (607 to 609) = 3 .Everytime a new block is added to the blockchain, the miners are needed to restart with the step 3 by preparing a fresh block of transaction.