Blockchain is distributed database, where each node in the network must reach an agreement on the current state of the network. These are protocols or rules that make sure all nodes of the distributed network are in complete synchronization with each other and agree on transactions made and added to the Blockchain. Let’s understand How does Consensus Mechanism secure the Blockchain Network and prevents it from getting hacked.

For Example, Lets’ s consider a group of people going to watch a movie. If they all agree on the choice of the movie a consensus is achieved, in the worst case the group might split and watch their choice of movie.

In Blockchain the process is formalized and to reach consensus at least 51% of the nodes in the network must agree on the next stage of the network.

Different Consensus mechanisms?

The Consensus mechanism makes sure that the network is secured and is practically difficult to hack.

Below are the two most common types :

Proof-of-Work Explained

Proof-of-Stake in action, users stake their tokens to Validate the network.

Bitcoin and Ethereum both use Proof-of-Work (POW) protocols to validate and secure their network.

How is Block created in POW?

Proof-of-work is done by miners who use mining hardware (complex computing devices) to validate the network. Each transaction is part of a block which needs to be verified before saving it

to the Blockchain Once a block has a specific number of transactions, the mining hardware races to solve a complex mathematical problem(before other miners) to link this new block with the previous one.

For each transaction, a fee is paid (gas fee in ETH) to the network, and the miner who solves the problem first is rewarded with a freshly minted ETH token.

How is the Blockchain Network secured in POW?

The network is secured by the fact that the hacker will need to compromise 51% of the network’s computing power to corrupt the blockchain. This will be a very expensive process that will require a lot of investment and energy, the gains made with this are far less than the expenses incurred.

Explaining Proof-of-Stake

Proof-of-Stake in action, users stake their tokens to Validate the network.

Most modern blockchains are adopting Proof-of-Stake (POS) protocol as their consensus mechanism. Cardano, Avalanche, Polkadot, Solana, Tron, etc are a few of the many projects using Proof-of-Stake.

Ethereum is working with its dev team to switch from Proof-of-work (POW) to Proof-of-Stake (POS) in the near future.

How is a new Block created in POS?

Users with pre-existing ETH tokens stake them to participate in the system. Validators are chosen randomly by the network, based on the number of tokens staked, to create new blocks and share them with the network. The more you stake the higher your chances are to be selected as a validator. Once the block is verified and shared with the network validators are rewarded with newly minted ETH.

If the validator submits the fraudulent transactions to the network, they could be penalized by “slashing“. Their stake is burned and sent to a dead wallet address to which nobody has access, making them useless.

How is a Blockchain Network secured in POS?

The network is secured by the fact that you will need 51% of the total ETH staked to default the network. And your stake is “slashed” for submitting fraudulent transactions.

There are many other consensus mechanisms that are used widely in the Blockchain ecosystem, but the above two are widely used.

Conclusion

Securing a transaction and maintaining the privacy of its users is the most important aspect of any finance application. Blockchain stores the transaction data as Blocks that cannot be erased but to maintain the right state of the network a consensus mechanism needs to be put in place.

We discussed above How does Consensus Mechanism secure the Blockchain and prevents bad actors from stealing confidential details.