DEV Community

Cover image for Why are miners rewarded?
Aditya
Aditya

Posted on • Originally published at adityas.hashnode.dev

Why are miners rewarded?

If you are not new to Ethereum or in Blockchain space in general, you have already heard about "Miners".

Before we start with the rewards the miners get, let's know what is "Mining"?

Mining?

Ethereum is a blockchain network, i.e it is a network/chain of blocks of transactions. The process of creating new blocks and adding them to the chain is called Mining.

Until recently, before September 15, 2022, Ethereum miners used to invest their time and computation power to execute transactions and create new blocks. Now the process is changed.

So is that all to miners? No, they also help to keep the network safe.

In decentralized systems, every participant should agree on the order of transactions that are occurring as some process happens: A -> B -> C steps.

If the steps are not followed like A->C->B, etc the transaction order will not work. It is important that participants in the network agree in what order (steps) should the transaction occur.

This job also falls on the shoulders of miners. They are responsible for validating the transactions, and their orders on the blockchain.

Double-spending

Miners are important in the Ethereum network because they prevent this problem in the digital currency space.

Double spending is a flaw in any digital cash protocol like Ethereum, Bitcoin, etc. where the same single digital token is spent more than once.

How does this happen? Outside the digital world, you might call this counterfeit money. Anyone with expertise can create lots of counterfeit bills of currencies like $, ¥, ₹, etc. and spend it resulting in the inflation of the currency.

The validation process and adding the transaction to the chain by a miner help to prevent this issue.

Blockchain 🤝 Miners: How?

When someone executes a transaction function which results in a change in the current state of the chain, it must be reflected in the new state of the blockchain.

Miners have another job. Large digital services are under constant threat of attacks and manipulation. So when miners validate transactions they produce a certificate of legitimacy, saying that their proposed transactions are legit.

This is a complex process. Chains like Bitcoin which uses proof of work do require the miners to work out this certificate. Due to this, it becomes convenient for others to check a transaction.

But what do miners get in return? Miners are rewarded with new tokens for their work. As there is no central authority in a decentralized system, miners are crucial for safety and reward acts as an incentive for their participation.

Transaction Mining Process

  • A user will sign transactions using their wallet such as Metamask

  • A node will be responsible to broadcast this transaction event on the entire network

  • Then every node will add the transaction data to its own mempool. It is a list of pending transactions that are yet to be included in a block.

  • When the miner can maximise the transaction fee and also stay under the block gas limit, then they group the transactions from the mempool into a block.

  • The validity of each transaction is verified, and execution is performed on the local Ethereum Virtual Machine.

  • After the certificate is produced, the miner broadcasts the completed block on the blockchain. The event includes the metadata such as the certificate, the latest state of the chain, etc.

  • The other nodes also check this event and they update their local copies of the blockchain to accept the new state. And then the transaction event is removed from each node's mempool.

That's all :)

Top comments (0)