In our previous, we examined what Consensus Algorithm is, how it works, how it is applied and the different types in the blockchain space. In this chapter, we are going to be looking at the Consensus Mechanism(algorithm) deployed on the Ethereum Blockchain which is Proof of Work(PoW)
According to Ethereum, Proof of Work is the mechanism that allows the decentralized Ethereum network to come to consensus, or agree on things like account balances and the order of transactions. This prevents users from “double spending” their coins and ensures that the Ethereum chain is tremendously difficult to attack or manipulate.
Proof-of-work is the underlying algorithm that sets the difficulty and rules for the work miners do. Mining is the “work” itself. It’s the act of adding valid blocks to the chain. This is important because the chain’s length helps the network follow the correct Ethereum chain and understand Ethereum’s current state. The more “work” done, the longer the chain, and the higher the block number, the more certain the network can be of the current state of things.
How Ethereum’s Proof of Work(PoW) Works
Ethereum transactions are processed into blocks. Each block has a:
Block Difficulty – for example: 3,324,092,183,262,715
MixHash – for example: 0x44bca881b07a6a09f83b130798072441705d9a665c5ac8bdf2f39a3cdf3bee29
Nonce – for example: 0xd3ee432b4fb3d26b
The proof-of-work protocol, Ethash, requires miners to go through an intense race of trial and error to find the nonce for a block. Only blocks with a valid nonce can be added to the chain. When racing to create a block, a miner will repeatedly put a dataset, that you can only get from downloading and running the full chain (as a miner does), through a mathematical function. The dataset gets used to generate a mixHash below a target nonce, as dictated by the block difficulty. The best way to do this is through trial and error.
The difficulty determines the target for the hash. The lower the target, the smaller the set of valid hashes. Once generated, this is incredibly easy for other miners and clients to verify. Even if one transaction were to change, the hash would be completely different, signalling fraud. Hashing makes fraud easy to spot. But proof-of-work as a process is also a big deterrent to attacking the chain.
Quite technical, isn’t it? You can go over it again for better comprehension.
Miners are incentivized to do this work on the main Ethereum chain. There is little incentive for a subset of miners to start their own chain – it undermines the system. Blockchains rely on having a single state as a source of truth. And users will always choose the longest or “heaviest” chain.
The objective of proof-of-work is to extend the chain. The longest chain is most believable as the valid one because it has had the most computational work done. Within Ethereum’s PoW system, it’s nearly impossible to create new blocks that erase transactions, create fake ones, or maintain a second chain. That’s because a malicious miner would need to always solve the block nonce faster than everyone else.
To consistently create malicious yet valid blocks, you’d need over 51% of the network mining power to beat everyone else. You’d need a lot of computing power to be able to do this amount of “work”. And the energy spent might even outweigh the gains you’d make in an attack.
What do you think of this article ? Let’s hear from you in the comment section!