Blockchain Technology, Part - 05

Blockchain Technology, Part - 05

Blockchain Architecture

Transaction Flow - Traditional systems

In order to understand the working of a blockchain network, first consider a?traditional?banking transaction model. Here Alice wants to send some money to Bob. Let's see what are the steps involved in a traditional banking system for this transaction to be finalized.

Now let's consider the transaction steps in a blockchain:

Need for a Consensus

The previous unit explained how a transaction takes place in a blockchain network. Also, the unit?mentions about?'consensus algorithm' that is used?to find the winning block.?Let's see what goes around it.

In simple words, the consensus is a process by which an agreement is reached between different nodes in a network on the final state of data. When different nodes are participating in a distributed network, achieving an agreement?becomes a challenge. In the case of a blockchain network, the agreement is about which block to be added to the blockchain network.?In a decentralized, distributed network no single person or entity is responsible for providing the single value of truth. Rather here, every member is equally responsible for providing the truth value, and the consensus algorithms help to reach an agreement among the various participants.??

Common types of consensus mechanisms in distributed networks are :

  1. Voting based consensus: This method depends on voting mechanisms to finalize a common state.??They are?not computationally intensive and relies on achieving consensus by sending signed messages as votes. These are considered as traditional mechanisms for achieving consensus. These types of consensus are commonly used in the private/permissioned blockchain networks. For example: PBFT, RAFT, etc.?
  2. Lottery based consensus: This type of consensus mechanism depends on the chance-based lottery election model to select a leader in the network. Here, the leader will?publish his block to?rest of the network. These types of consensus are commonly used in the public/permissionless blockchain networks. For example:?Proof of Work, Proof of stake, etc.?

Let's start with the theoretical background for consensus mechanisms. Before we take a read?into consensus mechanisms in blockchain networks, consider a problem.

Two Generals Problem

The Two Generals Problem is a classic computer science thought experiment. The Two Generals Problem is however related to the Byzantine Generals problem but is not the same.?

Let us imagine two Generals, General 1 and General 2 commanding two parts of the same army positioned on opposite sides of an enemy city. The city can defend against a single General’s army attacking. If both the Generals attack at the same time, the city would collapse. Therefore, Generals have to communicate with each other to synchronize their attacking time. The only way to communicate is through a messenger who will have to travel through the enemy territory.?

In the first scenario, let us assume that General 1 who is the leader sending a message “ Attack on Monday Morning” through a messenger to General 2. General 2 receives the message and sends an acknowledgment “I confirm Attack Monday Morning”. Thus General 1 receives General 2’s confirmation, however,?is this enough to achieve synchronization? General 2 still doesn’t know whether General 1 has received his confirmation message. One solution to this is for General 1 to send a message to General 2 stating that the confirmation was received. Then again General 1 doesn’t know whether General 2 has received the confirmation message from General 1 of receiving the confirmation message from General B.?Ultimately this scenario will lead to a loop with an infinite number of confirmation messages being exchanged.

In the second scenario, let us assume that General 1 sends a message “Attack on Monday Morning” to General 2. In this case, General 1 doesn’t get a reply message from General 2. There are two possibilities for this scenario. Either the messenger sent by General 1 was captured by the enemy or the confirmation messenger sent by General 2 was captured by the enemy. However, in both cases, synchronization is not achieved. Thus there is no solution to the Two Generals Problem and to this date, it remains unsolvable.

What if there are more than two nodes?

Byzantine Generals Problem

Now let's consider a slightly different problem.

Byzantine Generals Problem(BGP)

Byzantine Generals Problem is applicable?in distributed networks.

In the above diagram, a network with?a commander and two lieutenants are shown. In this case, the commander is a malicious node who gives different commands to different lieutenants. Thus failing the network in reaching an agreement.

In the second case, Commander is genuine but Lieutenant 2?acts as a malicious node and sends across different messages to its peers. Again failing the network in reaching an agreement. In both cases, Lieutenant 1 is not able to point out the malicious actor and is receiving contradictory messages from his peers. Thus the network fails to reach an agreement on whether to attack or retreat.

This concept was a thought experiment proposed by Lamport and others in 1982. It describes a group of army generals who lead different parts of the Byzantine army, planning to attack or retreat from a city. The generals need to agree to strike at the same time in order to win. They communicate among them using a messenger. Here the issue is that one or more generals can be traitors who could send misleading messages. Therefore there is a need for a feasible mechanism that allows for agreement among the generals, even in the presence of?disloyal ones, so that the attack can still take place at the same time. As an analogy to distributed systems, the generals can be considered nodes, the traitors as byzantine malicious nodes, and the messenger as a channel of communication among the generals.

Byzantine Fault Tolerance

In a distributed network like blockchain, the chances of having malicious nodes are high. The scenarios described in previous?units need to be considered in such a network.?Byzantine Fault Tolerance (BFT) is the ability of a distributed system to reach consensus in a network, even when?some network nodes fail to respond or respond with incorrect information. In other words, Byzantine Fault Tolerance is the property of a system?to tolerate the class of failures?that belong to?the Byzantine Generals Problem.?Thus blockchains should find a mechanism to be Byzantine Fault Tolerant. This is where the relevance of consensus algorithms come in.

CAP Theorem

CAP stands for Consistency, Availability, and Partition Tolerance. CAP theorem, also known as Brewer’s Theorem is a concept that a distributed database system can have only two of the three: Consistency, Availability, and Partition Tolerance.?Eric Brewer introduced it?in 1998 as a conjecture.

  • Consistency:?Single, an identical copy of the data in the network.
  • Availability:?Nodes are accessible for use and accepting incoming requests and responding with data without failures as when required.
  • Partition Tolerance:?If a group of nodes is unable to communicate with other nodes due to some failure, partition tolerance ensures that the network continues to operate correctly.?

In blockchains, consistency is sacrificed in favor of availability and partition tolerance. In this scenario, consistency is achieved over time. Consistency is achieved as a result of validation from multiple nodes over time. Different consensus mechanisms are used for achieving this purpose.

Blockchain Features

Let's recap. By now you should be able to explain the importance of the following features in Blockchain.

  • Immutability:?It implies something cannot be changed or altered. Immutability is achieved using cryptography and hashing techniques. Hashing makes sure that the data stored in a blockchain is immutable and tamper-proof. Consensus mechanisms and blockchain replication in nodes also make sure that immutability is accomplished. Once a block is committed onto the blockchain, it cannot be modified, even if we wanted to. Immutability can be a double-edged sword. Since we cannot change or modify the blockchain, there could be a possibility of faulty or inaccurate transactions getting committed onto it. We cannot revert back these transactions or blocks like in a normal database. The once committed blocks remain permanently on the blockchain.
  • Decentralized System:?The blockchain system is decentralized, referring to no?centralized authority for controlling the blockchain network. A fully decentralized system is known as a public blockchain. In such systems, anyone can join the network and it is publicly available. Bitcoin and Ethereum are examples of public blockchains. Again one important aspect to achieve decentralization is consensus mechanisms. Bitcoin uses a Byzantine Fault Tolerant Proof-of-Work Consensus mechanism which allows the decision making power to be decentralized across all the participating nodes. Fully decentralized systems tend to have lower transaction throughput which is a serious limitation. There are other kinds of blockchains with varying degrees of decentralization, such as private and consortium blockchains. These blockchains use other consensus mechanisms and are not fully decentralized. Lower the decentralization, higher tends to be the throughput.?
  • Distributed Peer to Peer Network:?P2P network enables to share the ledger among all the participant nodes in the network. It is this distributed shared ledger that makes the blockchain immutable. Every peer in the network maintains a copy of the blockchain. This is known as blockchain node replication. This allows each node to independently verify the transactions in public blockchains.
  • Consensus:?Everyone has to reach an agreement about the current state of the ledger. This is known as achieving consensus. In Bitcoin, we achieve consensus with the help of an algorithm called Proof-of-Work. This is a Byzantine Fault Tolerant consensus mechanism that allows the system to be decentralized. There are many consensus algorithms used by different blockchain systems. The choice of a consensus algorithm depends on the usability and principles of the blockchain network. A fully decentralized blockchain like Ethereum or Bitcoin may use proof-of-work consensus. While a private or consortium blockchain may use RAFT or PoET consensus algorithms.?Consensus algorithms are thus the core principles that govern a blockchain network.?
  • Better Security:?Blockchain systems achieve several layers of security in different ways.?No one can easily change any properties of the blockchain network as the blocks in a blockchain?are sealed with cryptography techniques. Transactions are signed by the sender's private key which acts as a digital signature for the system. Consensus mechanisms make sure that rules are being followed by every node. Immutability property makes sure that the block of transactions are valid. Together all these properties of the blockchain ensures its security.


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

社区洞察

其他会员也浏览了