Consensus Algorithm

Consensus Algorithm

What is Consensus

We know that blockchain is a distributed ledger, so let’s say we have 4 mining nodes here. So, all these nodes will have a copy of a blockchain, all these copies will be of same state, so they are exact copies here. If we got a new block to add and it should be added to blockchain. Let’s say that node 4 is adding the block to its blockchain and it’s replicated in all nodes. Now what if node 4 is malicious. How will we make sure that all the nodes follow the same protocol and have the same copy of information?

That’s where consensus algorithm comes to play. In the modern world we have lot of consensus algorithm using which we ensure that all the nodes have the same state of information.

Consensus Mechanism

No alt text provided for this image


Based on it is permission less or permissioned blockchain, we have a lot of mechanism. The first one is Proof of Work (PoW) which is one of the famous algorithm and Bitcoin uses the PoW to achieve consensus. All of these nodes will utilise some computational power, and the node with the most computing power will solve the problem and adds a block to the blockchain.


Proof of Work (PoW)

As we saw above whoever adds the block to the blockchain to undergo some mathematical puzzle, where it undergoes inverse hashing technique to solve. The node which solves these puzzles using high computational power will receive some reward.

Why do we need PoW?

If you are using high computational power, the chances of being a malicious node is reduced.

Now if we have 30 blocks and if the malicious node wants to change the 25 blocks. It will affect the hash of all remaining block and we start to recalculate the hash of remaining blocks; it will take some time since each and every block has to under go proof of work and also it consumes some computing power. At the time of doing all these processes, some other node will add a new block. All these works will be in veins.

What is the mathematical puzzle?

The complexity of the puzzle depends on,

  • Network size
  • Active users
  • Blockchain size and many other factors

?The puzzle will be of mathematical calculation like, given a three-digit numbers and find the factors of that number and it also has some more logics. Now this problem may be easy one but the real-world problem will be a difficult one and it take some time to calculate.

There is a famous hashing algorithm called sha256 algorithm which gives a hexadecimal number for each and every input and if you change even a single letter in the input, the whole hexadecimal number will change. So we have regenerate every time to get the correct input.

So, if we have the hexadecimal code and if we want to find the information, that’s where we will be doing a lot of calculations.

DRAWBACKS

  • Loss of computational power, because many nodes will participate in solving mathematical puzzle, but only one node gets the reward.
  • 51 percent attack – if blockchain node have 100 nodes and 51 nodes are malicious, then more than 50 percent of the network is corrupted.

Proof of Stake(PoS)

To overcome the drawbacks of PoW, PoS was introduced. In order to participate in Pos, the validators has to produce some stake. In Pow, the block is mined by the node which has the high computational power. But in PoS the validators are selected in terms of some selection algorithm and the amount of stake they hold and only then that validator will be allowed to add the block and the other validators need not waste any computational power since they are not selected. If the validator founds to be malicious, then they will lose their stake.

要查看或添加评论,请登录

Dinesh Ravishankar的更多文章

  • Understanding the Importance of Layer 3 Blockchain

    Understanding the Importance of Layer 3 Blockchain

    Cryptocurrency has transformed the way we perceive and interact with digital assets. With the advent of Bitcoin, the…

    1 条评论
  • Unlocking the Secret World of Zero-Knowledge Proofs used in Blockchain,web3 and hyperledger

    Unlocking the Secret World of Zero-Knowledge Proofs used in Blockchain,web3 and hyperledger

    Secretly Share Sensitive Data Without Risk! Zero Knowledge: A Secure Approach to Data Security Zero knowledge is a…

    1 条评论
  • Gas Optimization Strategies: 8 Proven ways to reduce Ethereum transaction costs

    Gas Optimization Strategies: 8 Proven ways to reduce Ethereum transaction costs

    Introduction The Ethereum network, like any vehicle, requires gasoline to function properly. We call it a gas.

    1 条评论
  • ERC And Its Types

    ERC And Its Types

    ERC- Ethereum Request for Comment It is a set of rules and regulations that creates a blueprint for Ethereum based…

  • The Web 5 Is Here

    The Web 5 Is Here

    Currently we are working on web2 and we are excited about web3 and Jack Dorsey says, hey we are coming up with web 5…

  • Created a crypto Wallet

    Created a crypto Wallet

    This wallet can do all the functionality which other wallets can do, also additionally it can add allowance and it can…

  • The Fractional NFTs

    The Fractional NFTs

    NFT Market Limitations Everyone would be aware of NFTs and these NFTs are booming in the market. There is a number of…

  • Smart contracts

    Smart contracts

    SMART CONTRACTS IN BLOCKCHAIN What are smart contracts? Smart contracts are line of codes which you run on Ethereum…

  • Hyperledger And Its Frameworks

    Hyperledger And Its Frameworks

    #blockchain #hyperledger #web3 #hyperledgerfabric Hyperledger Fabric What is Hyperledger Before understanding about…

    1 条评论
  • How to perform events in solidity

    How to perform events in solidity

    EVENTS A contract's inheritable component, known as an event, records the parameters supplied when issued in the…

社区洞察

其他会员也浏览了