Module 1
Module 1
MODULE-01
SYLLABUS: Distributed systems, CAP theorem, Byzantine Generals problem, Consensus. The history of
blockchain, Introduction to blockchain, Various technical definitions of blockchains, Generic elements of a
blockchain, Features of a blockchain, Applications of blockchain technology, Tiers of blockchain technology,
Consensus in blockchain, CAP theorem and blockchain, Benefits and limitations of blockchain.
A blockchain is an open, distributed ledger that can record transactions between two parties efficiently and in a
verifiable and permanent waywithout the need for a central authority.
Key Characteristics:
● Open:Anyonecanaccessblockchain.
● Verifiable: Everyone can check the validity of information because each node maintains a copyofthe transactions.
Blockchain can be defined as the Chain of Blocks that contain some specific Information. Thus, a Blockchain is a
ledger i.e file that constantly grows and keeps the record of all transactions permanently. This process takes place in
a secure, chronological (Chronological means every transaction happens after the previous one) and immutable
way. Each time when a block is completed in storing information, a new block is generated.
➢ The main challenge in distributed system design is coordination between nodes and fault tolerance.
➢ Even if some of the nodes become faulty or network links break, the distributed system should tolerate
this and should continue to work flawlessly in order to achieve the desired result.
➢ This has been an area of active research for many years and several algorithms and mechanisms has
been proposed to overcome these issues.
➢ Distributed systems are so challenging to design that a theorem known as the CAP theorem has been
proved and states that a distributed system cannot have all much desired properties simultaneously.
The theorem states that any distributed system cannot have Consistency, Availability, and Partition tolerance
simultaneously:
1. Consistency is a property that ensures that all nodes in a distributed system have a single latest copy of
data
2. 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
3. Partition tolerance ensures that if a group of nodes fails the distributed system still continues to operate
correctly
➢ 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.
1.4 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.
Requirements
➢ Agreement: All honest nodes decide on the same value.
➢ 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.
1. 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.
2. 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.
➢ Similarly, Nick Szabo proposed BitGold in 2005, which also used computational puzzles to mint
digital currency.
➢ Hal Finney, in 2005, combined ideas from b-money and hashcash but still relied on a centralized
authority.
➢ These earlier schemes faced issues such as lack of dispute resolution, reliance on a trusted third party,
and trusted timestamping.
➢ In 2009, Bitcoin solved the problem of distributed consensus in a trustless network.
➢ It uses public-key cryptography and hashcash as PoW to create a secure, decentralized method of
minting digital currency.
➢ The key innovation was the use of an ordered list of blocks, secured cryptographically by the PoW
mechanism, which forms the foundation of Bitcoin and blockchain.
This can also be visualized with the help of the following diagram:
• Blockchain can be thought of as a layer of a distributed peer-to-peer network running on top of the
Internet, It is analogous to SMTP, HTTP, or FTP running on top of TCP/IP.
• At bottom layer there is internet, which provides basic communication layer for any network.
• Peer-to-peer network runs on top of internet which hosts another layer of blockchain.
• That layer contains transactions, blocks, consensus mechanisms , state machines and blockchain smart
contracts.
• Finally at the top here are users or nodes hat connect to blockchain and perform various operations
such as consensus, transaction verification and processing
• From a business point of view a blockchain can be defined as a platform whereby peers can exchange
values using transactions without the need for a central trusted arbitrator. This allows blockchain to be
a decentralized consensus mechanism where no single authority is in charge of the database
➢ A block is simply a selection of transactions bundled together in order to organize them logically.
➢ It is made up of transactions and its size is variable depending on the type and design of the blockchain
in use.
➢ A reference to a previous block is also included in the block unless it's a genesis block.
➢ A genesis block is the first block in the blockchain that was hardcoded at the time the blockchain was
started.
➢ The structure of a block is also dependent on the type and design of a blockchain, but generally there
are a few attributes that are essential to the functionality of a block, such as the block header, pointers
to previous blocks, the time stamp, nonce, transaction counter, transactions, and other attributes.
The structure of a generic blockchain can be visualized with the help of the following diagram:
→Bitcoin is a pseudonymous system, meaning users are not directly identifiable. However, research has shown
that analyzing transaction patterns can reveal a user’s identity.
→To protect privacy and prevent transactions from being linked to the same owner, it is recommended to use a
new address for each transaction.
3. BLOCK: A block is composed of multiple transactions and some other elements such as the previous block
hash (hash pointer), timestamp, and nonce.
4. PEER-TO-PEER NETWORK: As the name implies, this is a network topology whereby all peers can
communicate with each other and send and receive messages.
→Transaction scripts are predefined sets of commands for nodes to transfer tokens from one address to another
and perform various other functions.
→Turing complete programming language is a desirable feature of blockchains; however, the security of such
languages is a key question and an area of important and ongoing research.
6. IRTUAL MACHINE: This is an extension of a transaction script. A virtual machine allows Turing
complete code to be run on a blockchain (as smart contracts) where as a transaction script can be limited in its
operation. Virtual machines are not available on all blockchains; however, various blockchains use virtual
machines to run programs, for example
7. STATE MACHINE: A blockchain can be viewed as a state transition mechanism whereby a state is modified
from its initial form to the next and eventually to a final form as a result of a transaction execution and
validation process by nodes.
8. NODES: A node in a blockchain network has different roles and functions. It can validate transactions, help
secure the blockchain through mining, and follow a consensus protocol like Proof of Work (PoW) to keep the
system running smoothly. Some nodes have other tasks, such as checking payments quickly or verifying
transactions. The role of a node depends on the type of blockchain and its function in the network.
9. SMART CONTRACTS: These programs run on top of the blockchain and encapsulate the business logic to
be executed when certain conditions are met. The smart contract feature is not available in all blockchains but is
now becoming a very desirable feature due to the flexibility and power it provides to the blockchain
applications.
impossible. For example, in Bitcoin, altering old blocks would require redoing all the complex work,
which is too hard and costly. This keeps blockchain records safe and unchangeable.
9. UNIQUENESS This feature of blockchain ensures that every transaction is unique and has not been
spent already. This is especially relevant in cryptocurrencies where much desirable detection and
avoidance of double spending are a key requirement.
10. SMART CONTRACTS Blockchain can run smart contracts, which are programs that automatically
perform actions when certain conditions are met. This makes blockchain flexible and useful for
businesses, as it allows transactions and processes to happen on their own without manual control. It
helps automate tasks and adds security and efficiency.
2. The transaction is propagated (flooded) by using much desirable Gossip protocol to peers, which
validates the transaction based on pre-set criteria. Usually, more than one node is required to validate the
transactions.
3. Once the transaction is validated, it is included in a block, which is then propagated on to the network.
At this point, the transaction is considered confirmed.
4. The newly created block now becomes part of the ledger and the next block links itself
cryptographically back to this block. This link is a hash pointer. At this stage, the transaction gets its
second confirmation and the block gets its first.
5. Transactions are then reconfirmed every time a new block is created. Usually, six confirmations in the
bitcoin network are required to consider the transaction final.
Steps 4 and 5 can be considered non-compulsory as the transaction itself is finalized in step 3; however, block
confirmation and further transaction reconfirmations, if required, are then carried out in steps 4 and 5.
First, the three levels discussed below were originally described by Melanie Swan in her book Blockchain,
Blueprint for a New Economy as tiers of blockchain categorized on the basis of applications in each category. In
addition to this, Tier X or Generation X
BLOCKCHAIN 1.0: This was introduced with the invention of bitcoin and is basically used for crypto
currencies. Also, as bitcoin was the first implementation of crypto currencies it makes sense to
categorize Generation 1 of blockchain technology to only include cryptographic currencies. All
alternative coins and bitcoin fall into this category. This includes core applications such as payments
and applications.
BLOCKCHAIN 2.0: Generation 2.0 blockchains are used by financial services and contracts are introduced in
this generation. This includes various financial assets, for example derivatives, options, swaps, and bonds.
Applications that are beyond currency, finance, and markets are included at this tier.
BLOCKCHAIN 3.0 Generation 3 blockchains are used to implement applications beyond the financial services
industry and are used in more general-purpose industries such as government, health, media, the arts, and
justice.
GENERATION X (BLOCKCHAIN X): This is a vision of blockchain singularity where one day we will
have a public blockchain service available that anyone can use just like the Google search engine. It will provide
services in all realms of society. This is a public open distributed ledger with general purpose rational agents
(Machina Economicus) running on blockchain, making decisions and interacting with other intelligent
autonomous agents on behalf of humans and regulated by code instead of law or paper contracts
1. Proof of Work(PoW): This type of consensus mechanism relies on proof that enough computational
resources have been spent before proposing a value for acceptance by the network. This is used in bitcoin and
other crypto currencies.
2. Proof of Stake(PoS): This algorithm works on the idea that anode or user has enough stake in the system; for
example the user has invested enough in the system so that any malicious attempt would outweigh the benefits
of performing an attack on the system. This idea was first introduced by Peer coin and is going to be used in the
Ethereum blockchain. Another important concept in Proof of Stake(PoS) is coinage, which is a derived from the
amount of time and the number of coins that have not been spent. In this model, the chances of proposing and
signing the next block increase with the coin age.
3. Delegated Proof of Stake(DPoS): Delegated Proof of Stake(DPOS) is an innovation over standard PoS where
by each node that has stake in the system can delegate the validation of a transaction to other nodes by voting.
This is used in the bits hares blockchain
4. Proof of Elapsed Time(PoET): Introduced by Intel, it uses Trusted Execution Environment (TEE) to provide
randomness and safety in the leader election process via a guaranteed wait time. It requires the Intel SGX
(Software Guard Extensions) processor in order to provide the security guarantee and for it to be secure
5. Proof of Deposit(PoD): Nodes that wish to participate on the network have to put in a security deposit before
they can propose a block. This mechanism is used in Tendermint BC
6. Proof of importance(PoI): This idea is important and different from Proof of Stake. Proof of importance not
only relies on how much stake a user has in the system but it also monitors the usage and movement of tokens
by the user to establish a level of trust and importance. This is used in Nemcoin BC
7. Federated consensus or federated Byzantine consensus: Used in the stellar consensus protocol, nodes in
this protocol keep a group of publicly trusted peers and propagates only those transactions that have been
validated by the majority of trusted nodes.
8. Reputation-basedmechanisms: As the name suggests, a leader is elected on the basis of the reputation it has
built over time on the network. This can be used on the voting from other members.
[Link](PoA): It is combination of PoS and PoW which ensures that a stake holder is selected in a
pseudorandom but uniform fashion. It is relatively more energy efficient mechanism compared to PoW. It
utilizes a new concept called Follow the Satoshi. This scheme is more energy efficient because PoW isused only
in first stage of mechanism, after the first stage it switches to PoS which consumes negligible energy.
11. Proof of Capacity(PoC): This scheme uses hard disks pace as are source to mine the blocks. This is different
from PoW where CPU resources are used. In PoC hard disk space is utilized for mining and as such is also
known as hard drive mining. This concept was first introduced in Burst coin crypto currency
12. Proof of Storage(PoS): This scheme allows for out sourcing of storage capacity. It is based on concept that
particular piece of data is probably stored by a node which serves as a means to participate in consensus
mechanism. Many variations of this scheme have been proposed such as Proof of Replication, Proof of Data
Possession, Proof of Space, Proof of Space-Time.
The CAP theorem (which states that in a distributed system, you can only achieve two out of the three
properties: Consistency, Availability, and Partition Tolerance) is violated in blockchain, especially in Bitcoin.
However, this is not actually the case.
In blockchain, consistency is sacrificed in favor of availability and partition tolerance. This means that
consistency (C) is not achieved at the same time as partition tolerance (P) and availability (A), but it is
achieved over time. This is called eventual consistency, where consistency is reached after multiple nodes
validate transactions over time.
To facilitate this process, mining was introduced in Bitcoin. Mining is a method used to achieve consensus and
validate new transactions. It uses a consensus algorithm called Proof of Work (PoW). At a higher level, mining
can be defined as the process of adding new blocks to the blockchain, ensuring that all transactions are validated
and added in a secure, distributed way.
2. Transparency and trust: As blockchains are shared and everyone can see what is on the blockchain, this
allows the system to be transparent and as a result trust is established. This is more relevant in scenarios such as
the disbursement of funds or benefits where personal discretion should be restricted
3. Immutability: Once the data has been written to the blockchain, it is extremely difficult to change it [Link] is
not truly immutable but,due to the fact that changing data is extremely difficult and almost impossible, this is
seen as a benefit to maintaining an immutable ledger of transactions
4. Highavailability: As the system is based on thousands of nodes in a peer-to-peer network, and the data is
replicated and updated on each and every node,the system becomes highly available. Even if nodes leave the
network or become in accessible, the network as a whole continues to work, thus making it highly available
5. Highlysecure: All transactions on a blockchain are cryptographically secured and provide integrity
6. Simplification of current paradigms: The current model in many industries such as finance or health is
rather disorganized,where in multiple entities maintain their own databases and data sharing can become very
difficult due to the disparate nature of the systems. But as a blockchain can serve as a single shared ledger
among interested parties, this can result in simplifying this model by reducing the complexity of managing the
separate systems maintained by each entity.
7. Fasterdealings: In the financial industry, especially in post-trade settlement functions, blockchain can play a
vital role by allowing the quicker settlement of trades as it does not require a lengthy process of verification,
reconciliation, and clearance because a single version of agreed upon data is already available on a shared ledger
between financial organizations
8. Costsaving: As no third party or clearing houses are required in the blockchain model, this can massively
eliminate over head costs in the form of fees that are paid to clearing houses or trusted third parties
As with any technology there are challenges that need to be addressed in order to make a system more robust,
useful, and accessible. Blockchain technology is no exception; infact a lot of effort is being made in Academia
and Industry to over come the challenges posed by blockchain technology.
1. Scalability
2. Adaptability
3. Regulation
4. Relatively immature technology
5. Privacy