Proof Of Work

Proof Of Work

Consensus Protocol in Blockchain

Table of contents

No heading

No headings in the article.

Hashing Algorithm , Immutable Ledger ,Mining ,Distributed P2P these are the base for consensus protocol.

Consensus Protocol Consensus protocol protects us in 2 ways

  • Prevents from Attacks
  • Solves Competing Chain Problem .

there are 2 popular types of Consensus Protocol

  • Proof Of Work(POW)
  • Proof Of Stake(POS)

Proof-of-Work-1260x709.jpg

Prevent Attacks if any Attacker attacks a middle block in the blockchain and made some changes ,then all the rest block hash value and previous hash value will change too because it is immutable ledger as well as it is distributed ,so everyone get to know that some changes has been made by this node.and all the node will communicate and inform that malicious node to change it's data because that data will not match with others data. so the attacker have to change his data and have make it like others data.. But suppose if the a miners is an attacker and he tries to add malicious node at the last than here immutable ledger will not work, but if the last block is malicious then others will not know,because other nodes will not have any data to compare , so here the consensus protocol will work.

maxresdefault.jpg

how consensus works? why it is proof of work? If a miner adds a block in the blockchain, the miners have to put lots of efforts to solve a computational mathematical problem and when mathematical problem is solved then that block is mined. to solve this mathematical problem miner requires time and lots of electricity is consumed. this solve mathematical problem is the proof of work for the miner that they have solved problem and now they are adding that mined block. then miners are rewarded after solving the computational problem and adding the block into blockchain. for solving problem they get a bitcoin and for transaction miners get transaction fees.

so if the miner does some malicious activity then all the efforts are wasted time and cost of electricity they put that is wasted as well as they will not get any rewards. that's why miners themselves are responsible and aware that they cannot do any malicious act. another thing this protocol works on is whenever a miner adds a block in a blockchain and broadcast it to other nodes, so other node does not add that block directly into there blockchain, when the node adds a block in blockchain it apply the protocol alongside to all the nodes which runs an algorithm simultaneously to all node,where they checks the authenticity of that mined block when they all agree on its verification than that block is inserted in all the network. this is how all the malicious act by an attacked is cancelled by the Consensus protocol.