Hello Friends, Hope you are doing fine and having fun in your lives. In my previous tutorials on blockchain and Ethereum, I have talked about mining a few times. So, in today’s article, I am going to discuss the concept of mining with you. This is an important part of learning the working of blockchain to see how the decentralization of blockchain happens. Let’s start today’s article by defining mining.
As blockchain is a peer-to-peer network. Mining is also a peer-to-peer process.
Blockchain (or Ethereum) mining is used to verify transactions on the network.
In this process, miners (the person or node who performs mining) add transaction records to the decentralized distributed ledger of the blockchain.
The transactions are added to the blocks, and the blocks are secured and linked after mining in the form of a chain.
Mining requires computational power and effort from miners. And basically, it is the process of adding blocks.
In this way, the transactions get confirmed and money and assets move from one account to another.
This was the idea of mining. In the next part, I am going to define the miner and discuss its role in the Ethereum blockchain network.
As defined earlier, a miner is a person or computer that performs the mining process.
Miners provide their time, efforts, and computer resources for mining and serve the blockchain system.
As a reward for their contribution, miners get transaction fees. The sender (or initiator) of the transaction pays this fee to the miner.
A miner adds a number of transactions in the new block and collects the transaction fee for each of them.
Any person can become a blockchain miner. A blockchain mining software needs to be installed and executed by the miner. This allows them to communicate with the blockchain network.
A computer performing this process then becomes a node. The nodes interact with each other to collaborate for verifying transactions.
This was all about the miners and their importance. Now, I will explain the idea of decentralization in the context of mining in the upcoming section.
Mining and Decentralization
I have discussed the concept of decentralization in previous articles. Decentralization means no central server or no central authority to manage and control the data. An example of centralization is our traditional banking system. And an example of decentralization is blockchain.
Decentralization is related to the mining process. Miners contribute to the blockchain system by providing their computing powers in verifying the blocks of transactions. This verification process is mining and it eliminates the need for a central entity.
The agreement of everyone on the state of the Ethereum network is essential for this system. Miners make this possible by solving the blocks and this increases the trust and security in this system. The decentralized process and consensus happen from these four processes.
Each transaction is verified by every node independently. The verification is done based on complete criteria.
The addition of these verified transactions into new blocks by miner nodes independently. The addition is done with a computation via a proof of work algorithm.
The new blocks are then verified by all nodes independently. The next step is assembling these blocks into the chain.
The selection of the chain having computation via proof of work, by every node independently.
In the next part, I will discuss the step by step process of mining via nodes.
For explaining the procedure of mining in steps, let’s start with the transaction generation.
The first step is the initiation of a transaction by an account.
A person (an externally owned account) starts a transaction by providing all the necessary data and then signing it via his private key.
The transaction is transmitted to the Ethereum network via some node requesting to be confirmed by miners.
When nodes of the network get a request from a transaction, they add that unconfirmed transaction to the pool of other such transactions.
All unconfirmed and unadded transactions will wait in that pool.
Any miner starts the process of mining by adding hundreds of different transactions in its block. More number of transactions means a more rewarding fee for the miner.
The miner verifies each transaction in its block and executes any code with it.
The miner would change the state of the Ethereum virtual machine and produce the proof of work certificate for its block.
The miner also produces a checksum of the new Ethereum virtual machine (EVM) state.
When the computation is complete and a certificate has been produced for the block, it would be transmitted to the network.
When other nodes receive the new block, they check the authenticity of the block certificate.
Then execute all transactions included in the new block and check the state of the Ethereum virtual machine.
They produce a checksum of their EVM state and match it with the checksum of the EVM state provided by the miner.
If the checksum matches, the new block is added to the blockchain. The resulting EVM state is accepted as the new state.
The transaction confirmed via a new block is then removed from the pool of unconfirmed transactions.
Every new node that joins the blockchain network downloads the complete blockchain starting from the genesis block.
Each transaction of every block is executed again until the final state of EVM is obtained. This state matches with the EVM of all other nodes.
In this way, transactions get verified again and again increasing trust and security features.
So, guys, this was the process of mining. I tried to make this easy to understand for beginners. Before concluding this article, I want to introduce you to another concept related to mining and that is “Mining Pools”.
With time, the mining competition has been increased.
Mining a block requires a lot of electricity and hardware resources and the likelihood of successful mining is very low.
Therefore, miners now group and work together in mining pools where they share their resources and also the reward.
In this way, everyone gets something out of their input.
In conclusion, I hope you have got an idea of how mining works from this article. Next time, I will present another new concept to you. Till then, take care!
I am Syed Zain Nasir, the founder of The Engineering Projects (TEP). I am a
programmer since 2009 before that I just search things, make small projects and now I am sharing my
knowledge through this platform. I also work as a freelancer and did many projects related to
programming and electrical circuitry. My Google Profile+Follow