Pick a topic, any topic.

Blockchain consensus – when and why?

The Fast Lane whitepaper, Enabling Digital Business with Blockchain, introduced some basic blockchain concepts - transactions, blocks, ledgers and chaining - but didn’t expand upon how blocks are added to the ledger. A blockchain “consensus” is the agreement among possibly untrusted parties to add a block to the ledger (and consequently to the replicated ledgers). The consensus process is currently a major area of innovation and competition among blockchain developers.

It might seem obvious, but consensus is only required when there is more than one node and there are transactions needing to be processed. Today, without blockchain, a bank can update the customer’s account without needing agreement from any other party, but it gets more complicated when two people who don’t know each other want to directly transfer something of value (funds or other objects) without the involvement of a trusted intermediary. No standard mechanism currently exists for blockchain consensus protocols.

Consensus mechanisms are often labelled as “proof of something” – the Proof of Work (PoW) approach used with Bitcoin is the best known so far. Other forms of consensus protocol include Proof of Stake, Delegated Proof of Stake, Proof of Activity, Proof of Authority, Proof of Approval, Proof of Elapsed Time, and Practical Byzantine Fault Tolerance (PBFT).

Executing the Bitcoin PoW process is called “mining” and the participating nodes are “miners.” The basic steps in the process (some details are not included here) are:

A user submits a transaction (i.e., an instruction to transfer funds/coins) to a Bitcoin node via a wallet; new transactions are verified and broadcast to all other nodes. Multiple transactions can be submitted at approximately the same time anywhere in the network.

Each node collects the transactions it receives into a holding file, periodically assembles them into a block, and calculates a Merkle Root Hash.

The block header is produced by doing the work (i.e., the mining) needed to find a “nonce” that goes into the header. As was noted in the whitepaper, the nonce is a number that makes the hash of the header meet specific criteria – and this takes considerable processing to determine. The miner that completes this task first earns the right to have their block added to the chain (and gets paid a fee for being the winner). Miners can work independently or in groups.

When a miner finds a nonce, it completes the block and sends it to all other nodes.

Nodes accept the block only if all transactions in it are valid and not already spent. Nodes accept the block by working on creating the next block in the chain, using the hash of the accepted block as the previous hash.

Since multiple nodes compete to issue a block, collisions (i.e., different blocks may be created and issued by different nodes at roughly the same time) are possible and rules are defined to choose which block will be accepted onto the chain. Nodes always consider the longest chain to be the correct one and will keep working on extending it. Blockchains can be classified by the complexity of their consensus mechanisms. The most complex is arguably Bitcoin - a public, permissionless system where participating nodes are anonymous, untrusted and potentially malicious. At the other end of the spectrum is Hyperledger Fabric - a private, permissioned system where the nodes are known, are generally trusted and are cooperative.

When looking for a blockchain solution, its important to compare your requirements to the consensus mechanism that is being used.