How does the blockchain work ? Consensus

A decentralized network, due to absence of a central authority, needs a mechanism to regulate the addition of blocks and to keep check over fraudulent transactions. Fraudulent transactions are those where a malicious node spends a token which he/she does not own. This activity is known as “double spending”. Double spending has been a major concern is various ledger systems, where people spent or gave away money or tokens which they did not own. It’s just like how your cheque bounces when you don’t have sufficient balance. To avoid these kind of fraud transactions from malicious network participants, the blockchain or Distributed Ledger Technology (DLT) uses a consensus mechanism.

Now you know what blockchains use to avoid frauds, but how do they do it ?

Lets understand this piece wise.

Suppose, a participant Mona wants to send a $1000 to a participant Sneha. After transaction is completed the record must be updated in the ledgers of entire network. That means the copy of the ledger stored with every node on the network must be updated, with the new balances of Sneha, Mona and the entire state of the ledger after the transaction was done. So before the ledgers could be updated the blocks have to be verified for, if Mona actually had the $1000 that she sent to Sneha. Due to absence of central authority to do so, the network cannot take a single noes words for it, it depends on a majority vote. If 2/3 of the network votes for the block, it gets committed to the longest chain in the network. This verification is a complicated process and is the mining part we all hear and dream about, for which in return some rewards are given away.

The consensus mechanism in blockchain is of 4 types :

  1. PBFT or Practical Byzantine Fault Tolerance
  2. PoW or Proof of Work
  3. PoS or Proof of Stake
  4. Delegated Proof of Stake

Practical Byzantine Fault Tolerance

soldier-1939385_1920

The PBFT method follows a voting based system to achieve consensus in the network. A group of nodes are designated as the voting nodes in the system and among them a leader is selected. On occurrence of a transaction the node must forward his block to any voting node who then puts up the transaction to be voted for. Every voting nodes conveys its vote to other voting nodes and if 2/3 of the votes are for the transaction then it is committed to the ledger. As of now, the PBFT is the most popular and preferred consensus mechanism, being followed in some big projects like Linux-Hyperledger’s

Proof of Work

farm-2852024_1920

The proof of work, follows a hashcash agenda to achieve consensus. It calculates the hash of the transaction and again rehashes it until a required nonce value is found. This nonce value defines the difficulty of the problem. The hashing function adds a zero leading the hash output everytime it is sent into the function. Hence if the number of zeroes of the final output matches the difficulty of the problem, then you have found the correct hash, and the block can be committed to the longest chain.
More info on PoW mechanism – Link given below.

Proof of Work – Consensus

Proof of Stake

The PoS consensus technique was innovated as a need for the network. A miner uses computational power to verify the validity of a block, and gets rewarded for it. But, the problem arises when the investment in computational power would reduce the chances pf making a good earning for miners and gradually there will be less miners. This situation would make the network vulnerable to a 51% attack where a node acquires 51% of the computational power of the network and can become rogue validate or invalidating transactions on will. To protect the network from this situation PoS mechanism was introduced where the mining capacity of a miner is decided by the number of tokens he/she owns. If a miner has 1% of the total tokens available then he can mine 1% of the blocks in the chain, thus justifying it’s name 😉

Delegated Proof of Stake

workplace-1245776_1920

Delegated proof of stake is quiet a bit different from the traditional proof of stake. This mechanism considers or appoints a group of delegates who could validate the transactions or blocks to be updated to the ledgers.  All of the delegates are eligible to create blocks and also forbid malicious or suspicious parties from participating in the network. This seems like some extra power, but the technique works and soon we’ll see how.

So, that’s it for today my starboys.

I’ll upload some reading materials for you to dig in.

Leave your comments or questions below. You can also suggest topics for my next blog.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *