Blockchain Technology: 1.1. Distributed Systems
Blockchain Technology: 1.1. Distributed Systems
MODULE 1
1.1. DISTRIBUTED SYSTEMS
Precisely it is a decentralized distributed system.
Distributed systems are a computing paradigm whereby two or more nodes work with each other in a
coordinated fashion in order to achieve a common outcome and it's modelled in such a way that end
users see it as a single logical platform.
A node can be defined as an individual player in a distributed system.
All nodes are capable of sending and receiving messages to and from each other.
Nodes have their own memory and processor.
A node that can exhibit arbitrary behaviour is also known as a Byzantine node.
Generally, any unexpected behaviour of a node on the network can be categorized as Byzantine.
This term arbitrarily encompasses any behaviour that is unexpected or malicious:
CAP theorem
This is also known as Brewer's theorem.
The theorem states that any distributed system cannot have Consistency, Availability, and Partition
tolerance simultaneously:
Consistency is a property that ensures that all nodes in a distributed system have a single latest copy of
data
Availability means that the system is up, accessible for use, and is accepting incoming requests and
responding with data without any failures as and when required
Partition tolerance ensures that if a group of nodes fails the distributed system still continues to
operate correctly
It has been proven that a distributed system cannot have all the afore mentioned three properties at
the same time.
In order to achieve fault tolerance, replication is used.
This is a common and widely used method to achieve fault tolerance.
Consistency is achieved using consensus algorithms to ensure that all nodes have the same copy of
data.
This is also called state machine replication.
Blockchain is basically a method to achieve state machine replication.
In general there are two types of fault that a node can experience: where a faulty node has simply
crashed and where the faulty node can exhibit malicious or inconsistent behavior arbitrarily.
This is the type which is difficult to deal with since it can cause confusion due to misleading
information.
Byzantine Generals problem
Before discussing consensus in distributed systems, events in history are presented that are precursors
to the development of successful and practical consensus mechanisms.
In September 1962, Paul Baran introduced the idea of cryptographic signatures with his paper On
distributed communications networks. This is the paper where the concept of decentralized networks
was also introduced for the very first time. Then in 1982 a thought experiment was proposed
by Lamport et al. whereby a group of army generals who are leading different parts of the Byzantine
army are planning to attack or retreat from a city. The only way of communication between them is a
messenger and they need to agree to attack at the same time in order to win. The issue is that one or
more generals can be traitors and can communicate a misleading message. Therefore there is a need
to find a viable mechanism that allows agreement between generals even in the presence of
treacherous generals so that the attack can still take place at the same time. As an analogy with
distributed systems, generals can be considered as nodes, traitors can be considered Byzantine
(malicious) nodes, and the messenger can be thought of as a channel of communication between the
generals.
This problem was solved in 1999 by Castro and Liskov who presented the Practical Byzantine Fault
Tolerance (PBFT) algorithm. Later on in 2009, the first practical implementation was made with the
invention of bitcoin where the Proof of Work (PoW) algorithm was developed as a mechanism to
achieve consensus.
Consensus
Consensus is a process of agreement between distrusting nodes on a final state of data.
In order to achieve consensus different algorithms can be used.
It is easy to reach an agreement between two nodes (for example in client-server systems) but when
multiple nodes are participating in a distributed system and they need to agree on a single value it
becomes very difficult to achieve consensus.
This concept of achieving consensus between multiple nodes is known as distributed consensus.
Consensus mechanisms
A consensus mechanism is a set of steps that are taken by all, or most, nodes in order to agree on a
proposed state or value.
For more than three decades this concept has been researched by computer scientists in the industry
and Academia.
Consensus mechanisms have recently come into the limelight and gained much popularity with the
advent of bitcoin and blockchain.
There are various requirements which must be met in order to provide the desired results in a
consensus mechanism.
The following are their requirements with brief descriptions:
Termination: All honest nodes terminate execution of the consensus process and eventually reach a
decision.
Validity: The value agreed upon by all honest nodes must be the same as the initial value proposed by
at least one honest node.
Fault tolerant: The consensus algorithm should be able to run in the presence of faulty or malicious
nodes (Byzantine nodes).
Integrity: This is a requirement where by no node makes the decision more than once. The nodes
make decisions only once in a single consensus cycle.
Byzantine fault tolerance-based: With no compute intensive operations such as partial hash inversion,
this method relies on a simple scheme of nodes that are publishing signed messages. Eventually, when
a certain number of messages are received, then an agreement is reached.
Leader-based consensus mechanisms: This type of mechanism requires nodes to compete for
the leader-election lottery and the node that wins it proposes a final value.
Many practical implementations have been proposed such as Paxos, the most famous protocol
introduced by Leslie Lamport in 1989.
In Paxos nodes are assigned various roles such as Proposer, Acceptor, and Learner.
Nodes or processes are named replicas and consensus is achieved in the presence of faulty nodes by
agreement among a majority of nodes.
Another alternative to Paxos is RAFT, which works by assigning any of three states, that is, Follower,
Candidate, or Leader, to the nodes.
A Leader is elected after a candidate node receives enough votes and all changes now have to go
through the Leader, who commits the proposed changes once replication on the majority of follower
nodes is completed.
The various ideas that helped with the invention of bitcoin and blockchain.