Consensus is an essential concept in blockchain and distributed ledger technology. In reading many articles, it is clear that it is also one of the most misunderstood.
The definition of consensus is “general agreement”. In the context of blockchain, a consensus means that the network has agreed. The confusion arises when we ask the questions:
“Agreement about what?”
“How is the agreement reached?”
The answer depends on the data and the blockchain protocol in use.
|Blockchain network: a group of computers working together to manage and maintain data. Computers in a blockchain network are nodes. Blockchain network nodes can contain a full or partial copy of the blockchain, can verify and validate transactions, can execute smart contract code, and both accept and create new transactions.|
In the context of cryptocurrency, the network must agree on two principal elements. Is the transaction allowed, and is the transaction possible? A consensus means the network must both validate and verify each transaction. The network also requires agreement on the validity of each new set blockchain data.
When submitting a cryptocurrency transaction to the network, it includes a digital signature. This signature is easy to verify but difficult to forge. Each of the nodes on the network will inspect the transaction and verify that the signature is valid. This step prevents individuals or systems from making unauthorised transactions.
The next step is to validate the transaction. The network will check the blockchain to confirm that there is sufficient balance of cryptocurrency associated with the transaction. Similar to checking your bank balance before the bank cashes a cheque, the network will validate that you have adequate funds before recording the transfer.
This validation step is how cryptocurrency networks prevent double-spend.
The network must come to a consensus that each transaction is both verified and validated.
A group of transactions is collected to form a block. The new block includes a unique cryptographic signature also known as a hash. The network must agree this signature is valid to maintain the integrity of the data stored in the blockchain.
What about data other than cryptocurrency transactions?
Blockchain technology can be used to record information related to transfers and transformations of raw materials in a supply chain. It can be used to record timestamped evidence of digital content such as digital photos or a digital track of music.
In these cases, the network still comes to an agreement in verifying the transaction’s signature. The network also verifies the signature of new information written to the blockchain. However, the network may not validate the transaction.
In some blockchain uses, new data is not directly related to other data already stored in the blockchain. Without historical data to refer to, there is no way to validate the new transaction.
A critical aspect of designing any enterprise blockchain or distributed ledger technology solution is data architecture. It is not possible to store everything on the blockchain. Deciding the minimum set of data which still ensures trust between multiple parties is vital.
Blockchain protocols that support smart contracts (like Ethereum) have another point of consensus. A smart contract is a piece of software. The software has some inputs, performs some calculations and creates an output. The network must reach consensus – come to a general agreement – that the smart contract for a specific transaction resulted in a particular output.
Isn’t consensus the part that uses so much energy?
Yes. And no.
Yes. The consensus method known as proof-of-work requires each of the nodes on the network to solve a complex problem. Solving the problem uses electricity and the more nodes on the network, the higher the use of power.
And no. Proof-of-work is not the only consensus method. Other methods such as proof-of-stake, proof-of-authority, etc. achieve the same function, but without the need to solve complex problems and thus without the need to use so much electricity.
Furthermore, these consensus methods address the need for networks to be decentralised and may also support the incentives for individuals and businesses to invest the resources to keep public blockchain’s running.
As a completely separate function, consensus mechanisms must agree as to the transactions in the block and the signature of the block. This part of the consensus is all about computer-to-computer communication. This functionality does not use massive amounts of energy.
The most important thing to understand is that the objective of consensus is, first and foremost, to maintain the integrity of the data on the blockchain and to verify the authenticity of the transactions as they are written. In only some cases does consensus include the accuracy of the data.
Next week’s Inside blockchain will look at the challenges of understanding what problem a blockchain solution can solve as opposed to what so many companies claim they solve with blockchain.
The definition […]