Module 01
Module 01
4
LITTLE HISTORY
➔ 1991 - Stuart Haber & W. Scott - cryptographically secured chain of
blocks.
➔ 1992 - Merkle trees + cryptographically secured chain of blocks
➔ 2004 - Hal Finley - Reusable Proof-of-work (RPoW) - Digital cash
➔ 2008 - Satoshi Nakamoto - Bitcoin
➔ 2014 - Vitalik Buterin - Ethereum 1.0
➔ 2022 - Vitalik Buterin - Ethereum 2.0
5
BLOCKCHAIN COMPONENTS
➔ Peer-to-peer network
➔ Public-key cryptography
➔ Distributed ledger
➔ Consensus protocol
➔ Smart contracts
➔ A one or more client softwares
➔ Wallets
➔ Node
6
PEER-TO-PEER NETWORK
➔ All the communications (transactions) occur directly between peers
without a central entity.
➔ Each peer stores and forwards information to all other peers.
➔ Advantages with P2P networks:
◆ Decentralization
◆ High Availability
◆ Immune to DoS attacks
◆ No censorship by central authorities
➔ E x a m p l e s : N a p s t e r, Bit t o r re n t , S k y p e
7
PUBLIC-KEY CRYPTOGRAPHY
➔ Every peer in the Blockchain network is associated with a public-private key
pair.
➔ The public key is used to identify a peer uniquely in the network. All the
assets are listed under the public key.
➔ But a corresponding private key is required to transfer the ownership of
the asset.
8
DISTRIBUTED LEDGER
➔ A distributed ledger can be described as a ledger of any transactions or
contracts maintained in a decentralized form across different locations and
peers.
➔ Every peer in the network has access to information stored at the
distributed ledger, and no single peer can control the data stored at the
ledger.
9
DISTRIBUTED LEDGER VS BLOCKCHAIN
➔ Distributed ledgers can be of many types and Blockchain is a specific
type of distributed ledger.
➔ A Blockchain distributed ledger is maintained as a set of blocks, such that
each block is cryptographically chained to its parent block (except first
block).
10
BLOCKCHAIN VS BLOCKCHAIN (LEDGER)
➔ In general, to differentiate between the distributed ledger in
Blockchain and the whole Blockchain technology, the following
terminology is used
➔ blockchain - represents distributed ledger in Blockchain
➔ Blockchain - Network + ledger + consensus
11
BLOCK
STRUCTURE
➔ A Block contains:
◆ Header
● Hash of the previous Block
● Merkle hash of the transactions
● Consensus information
◆ Body
● Contains transactions
➔ Bitcoin Block structure
◆ [Link]
➔ Ethereum Block structure
◆ [Link]
12
GENESIS BLOCK
Genesis Block is the name of the first block of Bitcoin ever mined. In
2009, a developer named Satoshi Nakamoto created the Genesis Block.
The Genesis Block forms the foundation of the Bitcoin trading system and
is the prototype of all other blocks in the Bitcoin blockchain.
Regarding cryptocurrency transactions, for example, blocks hold all the records.
The blocks are hashed and encoded into a Merkle tree or hash tree. 13
CONT…
Every block in a blockchain has the cryptographic hash of the preceding block.
A block, plus all the blocks preceding and following it, form the blockchain.
Each block replicates all the data contained in the previous block.
Instead of having a central ledger with information of the whole system, each
block in the blockchain has all the data.
In other words, the blockchain uses a distributed ledger system and
not a centralized one. A blockchain is a list of records that is expanding all the
time. It begins with the Genesis Block.
14
T h e gen esi s block o f Et h e re u m is as
follows: [Link]
15
CONSENSUS ALGORITHM
➔ If all the peers have their own copy of ledger, how do they all have the
same copy of the ledger?
➔ In Blockchain, a secure consensus algorithm is executed by a set of
decentralized peers known as miners to agree on a common global state of the
distributed ledger.
➔ Consensus algorithm also guarantees the security of the ledger.
Consensus algorithm example:
P B F T ( Practical Byzantine Fault Tolerance (PBFT))
P o W ( Proof-of-Work (PoW))
P o S ( Proof-of-Stake (PoS))
D P o S ( Delegated Proof-of-Stake (DPoS))
P o A ( Proof-of-Activity (PoA))
16
SMART CONTRACTS
➔ A smart contract is a program deployed and stored in a Blockchain.
➔ A smart contract can hold many contractual clauses between
mutually distrusted parties.
➔ Similar to transactions, the smart contract is also executed by miners and, its
execution correctness is guaranteed by miners running the consensus protocol.
➔ Assuming that the underlying consensus algorithm of a Blockchain is secure, the
smart contract can be thought of as a program executed by a trusted global machine
that will faithfully execute every instruction.
23
WALLET
A blockchain wallet is a cryptocurrency wallet that is used to
manage cryptocurrencies like Bitcoin and Ethereum.
It helps to exchange funds easily and the transactions are more
secure as they are cryptographically signe.
24
HOW DO BLOCKCHAIN WALLETS WORK?
First, let’s discuss what private and public keys are and how these keys are related
to a blockchain wallet.
Whenever you create a blockchain wallet, you are provided a private key and a
public key that is associated with your wallet.
Let’s use email as an example. If you want to receive an email from someone, you give him or
her your email address.
But giving out your email address doesn’t mean someone will be able to send out emails via
your account. Someone would have to know your email account’s password to do that.
Blockchain wallets follow a similar process using a public key and a private key
together. A public key is similar to your email address; you can give it to anyone.
When your wallet is generated, a public key is generated, and you can
share the public key with anyone in order to receive funds.
The private key is top secret. It’s similar to your password; it should not get hacked
and you should not disclose it to anyone.
You use this private key to spend your funds. If someone gets access to your private
key, there is a high possibility that your account is compromised, and you might end
up losing all the cryptocurrency deposits in your account. 25
HOW DO BLOCKCHAIN WALLETS WORK?
26
BLOCKCHAIN WALLET FEATURES
Easy to use. It’s just like any other software or a wallet that you
use for your day-to-day transactions.
Highly secure. It is just a matter of securing your private key.
27
TYPE OF WALLET
There are two types of blockchain wallets based on private keys: hot wallets
and cold wallets.
Hot wallets are like normal wallets that we carry for day-to-day transactions,
and these wallets are user-friendly.
Cold wallets are similar to a vault; they store cryptocurrencies with a high level
of security.
28
TYPE OF WALLET CONT…..
29
SOFTWARE WALLETS
A software wallet is an application that is downloaded on a device; it could be a desktop or
a mobile device, or it could be a web-based wallet that can be accessed online. Breadwallet,
Jaxx, and Copay are popular software wallets. We can further categorize software wallets
as desktop wallets, online wallets (web wallets), and mobile wallets.
30
CONT…
Desktop Wallets: Desktop wallets are cold wallets in which the private keys are stored in
cold servers (in your desktop). You can unplug the wallet from the Internet, do some offline
transactions, and then bring it back online. In case the main server is lost, then a cold
server, basically your desktop, is used as a backup server.
Online Wallets: These are other kinds of hot wallets that run on the Internet. Users have
the benefit of accessing these wallets across any device. It could be a tablet or a desktop, or
you can access it from your mobile browser. The private keys are stored online and are
managed by a third party. For example, Green Address is a Bitcoin wallet that is available
on the web, has an Android app, is available on a desktop, and also is available on iOS.
Mobile Wallets: Mobile wallets are similar to online wallets except that they are built only
for mobile phone use and accessibility. These wallets have a user-friendly interface that
helps you do transactions easily. Mycelium is the best available mobile wallet.
31
HARDWARE WALLETS
A hardware wallet is a type of cold storage device, typically like a USB,
that stores the user’s private key in a protected hardware device. These
wallets are similar to portable devices that can be connected to the
computer (plugged in).
As noted earlier, they are less prone to malicious attacks and are hack-
proof. Ledger, Trezor, and KeepKey are the top hardware wallets on
the market.
To make a transaction from your hardware wallet, you have to ensure
that the hardware wallet is plugged into your computer system.
32
PAPER WALLETS
A paper wallet is an offline process for storing cryptocurrencies. This wallet is a
printed paper that has both your private key and public key, which are accessed
using a QR code. Since these wallets are safe, they are widely used for storing
large amounts of cryptocurrencies. Bitcoin Paper Wallet and MyEtherWallet are
two widely used paper wallets.
A paper wallet works with your software wallet to transfer funds from your
software wallet to the public address shown on your paper wallet. First, you
park your funds in a software wallet, then you transfer the funds from your
software wallet to the public address printed on the paper wallet.
33
NODE
Node is a electronic device (computer, mobile device, server etc.)
that is connected to the internet.
All the nodes in the network have a copy the blockchain ledger
and are interconnected.
Node supports the network by maintaining a copy of the
blockchain.
A node can be :
A full Node: Nodes maintain a full copy of transaction
history of blockchain.
A Partial or Lightweight or Light Node: Nodes maintain
a partial copy of the ledger as they could be early users or
those who do not have sufficient space for the full blockchain.
34
ELEMENTS OF A BLOCKCHAIN
Decentralization
Immutability
Transparency
Persistency
Public Auditability
Privacy
Programmability
35
FEATURES OF BLOCKCHAIN
1. Increased Capacity
This is the first and an important feature of Blockchain. The most remarkable thing about this Blockchain
technology is that it increases the capacity of the whole network. Because of the reason that there are a lot of
computers working together which in total offers a great power then few of the devices where the things are
centralized.
A perfect example of this increased capacity is a project started by Stanford University which created a
supercomputer that simulates protein folding for medical research.
2. Better Security
Blockchain technology is considered more secure than its contemporaries because of lack of a single point of
failure. Blockchain operates on a well-distributed network of nodes, hence data at all times is circulated
through not one but multiple nodes, which makes sure that even if one node is hacked or faulty in any way the
integrity of the original data will not be compromised.
3. Immutability
Creating immutable ledgers is one of the main values of Blockchain. Any database that is centralised is
destined for hacks and frauds since it requires trust in some third party intermediary to keep the database
secure.
Blockchain like Bitcoin keeps its ledgers in a never-ending state of forwarding momentum. Every node on the
system has a copy of the digital ledger. To add a transaction every node needs to check its validity. If the
majority thinks it’s valid, then it’s added to the ledger. This promotes transparency and makes it corruption-
proof. 36
CONT….
37
HOW BLOCKCHAIN TECHNOLOGY WORKS
(Example : Joe sent 0.5 btc to ann through the block chain )
38
Figure: Public Key Cryptography
HOW BLOCKCHAIN TECHNOLOGY WORKS: STEP BY STEP
(EXAMPLE : JOE SENT 0.5 BTC TO ANN THROUGH THE BLOCK CHAIN )
39
HOW BLOCKCHAIN TECHNOLOGY WORKS: STEP BY STEP
40
HOW BLOCKCHAIN TECHNOLOGY WORKS: STEP BY STEP
41
HOW BLOCKCHAIN TECHNOLOGY WORKS
� One More example:
42
TYPES OF BLOCKCHAIN
Public Blockchain
Private Blockchain
Hybrid Blockchain
43
TYPES OF BLOCKCHAIN : PUBLIC BLOCKCHAIN
It is a permissionless distributed ledger on which anybody can join
and conduct transactions.
It is a non-restrictive form of the ledger in which each peer has a copy. This
also means that anyone with an internet connection can access the public Blockchain.
This user has access to historical and contemporary records and the ability
to perform mining operations.
These complex computations must be performed to verify transactions and
add them to the ledger.
On the blockchain network, no valid record or transaction may be altered.
Because the source code is usually open, anybody can check the transactions,
uncover problems, and suggest fixes.
44
ADVANTAGES OF PUBLIC BLOCKCHAIN
Trustable: Public Blockchain nodes do not need to know or trust each other
because the proof-of-work procedure ensures no fraudulent transactions.
Secure: A public network can have as many participants or nodes as it wants,
making it a secure network. The higher the network's size, the more records are
distributed, and the more difficult it is for hackers to hack the entire network.
Open and Transparent: The data on a public blockchain is transparent to all
member nodes. Every authorized node has a copy of the blockchain records or
digital ledger.
45
DISADVANTAGES OF PUBLIC BLOCKCHAIN
Lower TPS: The number of transactions per second in a public blockchain is
extremely low. This is because it is a large network with many nodes which take
time to verify a transaction and do proof-of-work.
Scalability Issues: Its transactions are processed and completed slowly. This
harms scalability. Because the more we try to expand the network's size, the
slower it will become.
High Energy Consumption: The proof-of-work device is expensive and
requires lots of energy. Technology will undoubtedly need to develop energy-
efficient consensus methods.
Fundraising: Businesses or initiatives can use the public Blockchain to improve transparency
and trust.
46
PRIVATE BLOCKCHAIN
47
ADVANTAGES OF PRIVATE BLOCKCHAIN
Speed: Private Blockchain transactions are faster. This is because a private
network has a smaller number of nodes, which shortens the time it takes to
verify a transaction.
Scalability: You can tailor the size of your private Blockchain to meet your
specific requirements. This makes private blockchains particularly scalable since
they allow companies to easily raise or decrease their network size.
49
HYBRID BLOCKCHAIN
Organizations who expect the best of both worlds use a hybrid blockchain,
which combines the features of both private and public blockchains.
It enables enterprises to construct a private, permission-based system
alongside a public, permissionless system, allowing them to choose who has
access to certain Blockchain data and what data is made public.
In a hybrid blockchain, transactions and records are typically not made public,
but they can be validated if necessary by granting access via a smart contract.
50
ADVANTAGES OF HYBRID BLOCKCHAIN
Secure: Hybrid Blockchain operates within a closed environment, preventing outside
hackers from launching a 51 percent attack on the network.
Cost-Effective: It also safeguards privacy while allowing third-party contact.
Transactions are inexpensive and quick and scale better than a public blockchain
network.
DISADVANTAGES OF HYBRID BLOCKCHAIN
Lack of Transparency: Because information can be hidden, this type of blockchain isn't
completely transparent.
Less Incentive: Upgrading can be difficult, and users have no incentive to participate in
or contribute to the network
USES OF HYBRID BLOCKCHAIN
Real Estate: Real-estate companies can use hybrid networks to run their systems and
offer information to the public.
Retail: The hybrid network can also help retailers streamline their processes.
Highly Regulated Markets: Hybrid blockchains are also well-suited to highly regulated 51
areas like the banking sector.
CONSORTIUM BLOCKCHAIN
In the same way that a hybrid blockchain has both
private and public blockchain features, a
Consortium blockchain, also known as a federated
blockchain, does.
However, it differs because it involves various
organizational members working together on a
decentralized network.
Predetermined nodes control the consensus
methods in a consortium blockchain.
It has a validator node responsible for initiating,
receiving, and validating transactions.
Transactions can be initiated or received by
member nodes.
52
ADVANTAGES OF CONSORTIUM BLOCKCHAIN -
Secure: A consortium blockchain is more secure, scalable, and efficient than a
public blockchain network.
It, like private and mixed blockchains, has access controls.
� Distributed ledger technology (DLT) is a digital system for recording the transaction of
assets in which the transactions and their details are recorded in multiple places at the
same time. (Unlike traditional databases, distributed ledgers have no central data store or administration
functionality.)
� In a distributed ledger, each node processes and verifies every item, thereby generating a
record of each item and creating a consensus on its veracity.
� Distributed ledger technology (DLT) refers specifically to the technological infrastructure
and protocols that allow the simultaneous access, validation and updating of
records that characterizes distributed ledgers. It works on a computer network spread
over multiple entities or locations.
� DLT uses cryptography to securely store data, cryptographic signatures and keys to
allow access only to authorized users.
� The technology also creates an immutable database, which means information, once 55
stored, cannot be deleted and any updates are permanently recorded for posterity.
56
DLT FEATURES
� Decentralized: It is a decentralized technology and every node will maintain the ledger, and if any
data changes happen, the ledger will get updated. The process of updating takes place independently
at each node. Even small updates or changes made to the ledger are reflected and the history
of that change is sent to all participants in a matter of seconds.
� Immutable: Distributed ledger uses cryptography to create a secure database in which data
once stored cannot be altered or changed.
� Append only: Distributed ledgers are append-only in comparison to the traditional database where
data can be altered.
� Distributed: In this technology, there is no central server or authority managing the database, which
makes the technology transparent. To counter the weaknesses of having one ledger to rule all, So that
there is no one authoritative copy and have specific rules around changing them. This would make the
system much more transparent and will make it a more decentralized authority. In this process,
every node or contributor of the ledger will try to verify the transactions with the various consensus
algorithms or voting. the voting or participation of all the nodes depends on the rules of that ledger.
In the case of bitcoin, the Proof of Work consensus mechanism is used for the participation
of each node.
� Shared: The distributed ledger is not associated with any single entity. It is shared among the
nodes on the network where some nodes have a full copy of the ledger while some nodes have57
only the necessary information that is required to make them functional and efficient.
BENEFITS OF DLT
� Transparent and Secure: Data is shared and visible to all nodes, it not easy to
make unauthorized changes. Every node that participate in the network maintain a
copy of ledger, thereby preventing a single point of failure . Any entry has to be agreed
upon by all parties making a distributed ledger secure and tamper proof.
� Efficient : with trustless and distributed nature of blockchain's DLT, the efforts of
capturing, validating , and synchronizing individual sets of information by mediators
can be eliminated, thereby reducing the chances of human error and improvement of
operational efficiency.
� Cost Saving : Dis-intermediated system can save on additional/bottom-line costs
while realizing near-time transaction and efficiency.
58
� How DLT Can Replace Traditional Book-Keeping Methods?
� Distributed ledger technology has the potential to effectively improve these traditional methods
of bookkeeping by updating and modifying fundamental methods of how data is collected,
shared, and managed in the ledger. To understand this, traditionally paper-based and
conventional electronic ledgers were used to manage data that had a centralized point of
control. This types of the system require high computing resource and labor to maintain ledgers
and also had many points of failure. Points of failure like:
⚫ Mistakes made during data entry.
⚫ Manipulation of data could happen which increases the risk of errors.
⚫ Other participants contributing data to the central ledger will not able to verify the legitimacy of data
coming from other sources.
� However, DLT allows real-time sharing of data with transparency which gives trust that data in
the ledger is up to date and legitimate. Also Distributed Ledger Technology eliminates the
single point of failure which prevents data in the ledger from being manipulations and errors. In
DLT, there is no need for a central authority to validate transactions here different consensus
mechanisms are used to validate transactions which eventually makes this process very fast and
real-time. Similarly, DLT can reduce the cost of transactions because of this process
59
TYPES OF DISTRIBUTED LEDGER TECHNOLOGY
60
TYPES OF DISTRIBUTED LEDGER TECHNOLOGY
62
ADVANTAGES OF DISTRIBUTED LEDGER TECHNOLOGY
� High Transparency: Distributed ledger presents a high level of transparency because all the transaction records
are visible to everyone. The addition of data needs to be validated by nodes by using various consensus
mechanisms. and if anyone tries to alter or change data in the ledger then it is immediately reflected across all
nodes of the network which prevents invalid transactions.
� Decentralized: In a centralized network, there may be a single point of failure and it can disrupt the whole
network because of mistakes at the central authority level. But in the case of distributed networks, there is no risk
of a single point of failure. because of the decentralized structure trust factor also increases in participating nodes.
This decentralized nature of validation reduces the cost of transactions drastically.
� Time Efficient: As this network is decentralized so there is no need for a central authority to validate transactions
every time. Hence this time for validation of each transaction reduces drastically. In the case of DLT, transactions
can be validated by members of the network itself by using various consensus mechanisms.
� Scalable: Distributed ledger technology is more scalable because many different types of consensus mechanisms
can be used to make it more reliant, fast, and updated. Because these many advanced DLT technologies are
introduced in the last few years. Such as Holochain, hashgraph are considered to be advanced and more secure
versions of Blockchain DLT. Blockchain itself is advanced and secure but DLT provides a way to more advanced
technologies.
63
DISADVANTAGES OF DISTRIBUTED LEDGER TECHNOLOGY
� 51% Attack: The 51% attack is a bit concerning part of this distributed ledger technology that is to be checked
routinely.
� Costs of Transaction: The connected nodes are expected to validate the transaction of a given Distributed Ledger
Technology which gives high transaction cost as the other nodes are paid incentives to validate the transaction.
� Slow Transaction Speed: The major disadvantage of this DLT is the slow speed of transactions as multiple nodes
are attached to this network and it takes time to validate the transaction by all the other nodes.
� Scalability Issues: Due to low speed and high transaction costs DLT faces very difficulties to expand on a large
scale.
64
EXAMPLES OF A 51% ATTACK
� Most 51% attacks occur on smaller cryptocurrencies. Experts say it’s unlikely that major
cryptocurrencies will face a successful 51% attack because it is prohibitively expensive to
take control of more than half of mining power. 65
USES OF DISTRIBUTED LEDGER TECHNOLOGY
� Because of all these benefits from distributed ledger technology and this
technology has the potential to revolutionize many sectors like Financial,
energy, healthcare, governance, supply chain management, real
estate, cloud computing, etc.
66
BLOCKCHAIN AND DISTRIBUTED LEDGER DIFFERENT
It is more scalable because it does not need the It is a subset of DLT, the power of the work
Power of Work power of a work consensus mechanism for the consensus mechanism adds more functionalities and
validation of each transaction. security.
Sequence It does not require any specific sequence of data. All blocks are arranged in a particular series.
67
� Advantages of Using Distributed Ledger Technology In Blockchain
� Security: All records of every transaction are securely encrypted. Once the transaction is validated, it is completely secure and
no one can update or change it. It is a permanent process.
� Decentralization: All network members or nodes have a copy of the ledger for complete transparency. A decentralized private
distributed network improves the reliability of the system and gives assurance of continuous operations without any
interruption. It gives control of information and data in the hand of the user.
� Anonymity: The identity of each participant is anonymous and does not possibly reveal their identity.
� Immutable: Any validated transactions can not be changed as they are irreversible.
� Transparency: Distributed technologies offer a high level of transparency. Which is necessary for the sectors like finance,
medical science, banking, etc.
� Speed: Distributed Ledger Technology can handle large transactions faster than traditional methods.
68
CAP THEOREM
71
AVAILABILITY OVER CONSISTENCY (A + P)
� Every request to the network receives a response,
even if the network cannot guarantee it is up to date
due to network partitioning (failing nodes).
� Choosing Availability over Consistency for a world-
wide distributed system will make it highly available,
but its data will be out of date for 99.99% of the time.
� Furthermore, no-one will be able to guarantee that the
data returned is in fact the most recent.
� The best example is Facebook, as it’s much more
important to get into the network, than to see the latest
updates of a particular person.
72
CONSISTENCY OVER AVAILABILITY (C + P)
74
CAP THEOREM EXAMPLES
� Example 1: A mobile phone has been designed in such a way that it has space for only
one sim card which means no sharing.
Solution: This system guarantees Consistency, Availability, and Tolerance to Partitions.
� Example 2: Immediately after sending a message to someone, that individual might not
get it.
Solution: With this system, availability and partition tolerance are compromised
without compromising consistency, or AP.
� Example 3: When we build a form for a group of individuals, the others can only access it
once we provide them permission to do so.
Solution: CP, or Consistency and Partition Tolerance without Compromising Availability,
is ensured by this system.
76
WHY DOES BLOCKCHAIN VIOLATE CAP THEOREM?
77
BYZANTINE GENERALS PROBLEM
[Link] 78
ATTACK!
Byzantine generals problem
● Generals should reach ATTACK!
a consensus on the plan
● It could be ATTACK
ATTACK!
ATTACK!
RETREAT!
Byzantine generals problem
● Generals should reach RETREAT!
a consensus on the plan
● Or RETREAT
RETREAT!
RETREAT!
ATTACK!
Byzantine generals problem
● But there might be ATTACK!
traitors
● All loyal generals should
reach a consensus
ATTACK!
ATTACK!
ATTACK!
Byzantine generals problem
● But traitors can act ATTACK!
randomly
● All loyal generals
should reach a
consensus
Let’s RETREAT!
ATTACK!
ATTACK!
Opps!
Byzantine generals problem
● But traitors can act Opps!
randomly
● All loyal generals
should reach a
consensus
Haha!
???
Byzantine generals problem
● A simplified version
RETREAT!
ATTACK!
RETREAT! RETREAT!
ATTACK!
ATTACK! ATTACK! RETREAT!
RETREAT! RETREAT!
ATTACK!
ATTACK! ATTACK! RETREAT!
ATTACK!
ATTACK!
ATTACK!
OM(1) - 3*OM(0)
ATTACK!
ATTACK!
ATTACK!
ATTACK!
ATTACK! RETREAT!
RETREAT!
ATTACK!
Solutions - with oral messages
● OM(k)
○ k == 0
■ commander sends the value to every one
■ everyone return the value they received
○ k>0
■ commander sends the value to every one
■ everyone start a smaller bgp OM(k-1) containing all ones but the current commander
and become the new commander
■ everyone participated n-1 OM(k-1) and get n-1 values, return the majority
● Intuition: for every message M received, solve a smaller bgp containing all but
the current commander to tell others you received M
Solutions - with oral messages
● OM(k)
○ k == 0
■ commander sends the value to every one
■ everyone return the value they received
○ k>0
■ commander sends the value to every one
■ everyone start a smaller bgp OM(k-1) containing all ones but the current commander
and become the new commander
■ everyone participated n-1 OM(k-1) and get n-1 values, return the majority
● Intuition: for every message M received, solve a smaller bgp containing all but
the current commander to tell others you received M
● OM(m) for m traitors when 3m < n
Solutions - with oral messages
● OM(k) - Message complexity: (n-1)*MC(OM(k-1)) + n-1 = O(n^m)
○ k == 0
■ commander sends the value to every one
■ everyone return the value they received
○ k>0
■ commander sends the value to every one
■ everyone start a smaller bgp OM(k-1) containing all ones but the current commander
and become the new commander
■ everyone participated n-1 OM(k-1) and get n-1 values, return the majority
● Intuition: for every message M received, solve a smaller bgp containing all but
the current commander to tell others you received M
● OM(m) for m traitors when 3m < n
Solutions - with signed messages
● SM(k)
○ every lieutenant maintains a value set V(i)
○ the commander sends the value to every lieutenant with its signature
Solutions - with signed messages
● SM(k)
○ every lieutenant maintains a value set V(i)
○ the commander sends the value to every lieutenant with its signature
○ for every lieutenant
■ every time it receive a new value v
■ put it in V(i)
■ if v is associated with less than m lieutenants’ signatures, sign it and send to everyone
Solutions - with signed messages
● SM(k)
○ every lieutenant maintains a value set V(i)
○ the commander sends the value to every lieutenant with its signature
○ for every lieutenant
■ every time it receive a new value v
■ put it in V(i)
■ if v is associated with less than m lieutenants’ signatures, sign it and send to everyone
○ when there will be no more messages, return choice(V(i))
○ choice(V)
■ return v then V = {v}
■ return RETREAT when |V| = 0
SM(1)
0
RETREAT!:0
ATTACK!:
0
2
1
SM(1)
0
RETREAT!:0
ATTACK!:
0
RETREAT!:0:2
ATTACK!:0:1
2
1
SM(1)
0
RETREAT!:0
ATTACK!:
0
RETREAT!:0:2
ATTACK!:0:1
2
1
V(1) = V(2)
SM(1)
0
RETREAT!:0
ATTACK!:
0
RETREAT!:0:2
ATTACK!:0:1
2
1
Choice(V(1)) = Choice(V(2))
Solutions - with signed messages
● SM(k)
○ every lieutenant maintains a value set V(i)
○ the commander sends the value to every lieutenant with its signature
○ for every lieutenant
■ every time it receive a new value v
■ put it in V(i)
■ if v is associated with less than k lieutenants’ signatures, sign it and send to everyone
○ when there will be no more messages, return choice(V(i))
○ choice(V)
■ return v then V = {v}
■ return RETREAT when |V| = 0
● intuition: ensure every message received by a loyal lieutenant is sent to every
loyal lieutenant
Solutions - with signed messages
● SM(k)
○ every lieutenant maintains a value set V(i)
○ the commander sends the value to every lieutenant with its signature
○ for every lieutenant
■ every time it receive a new value v
■ put it in V(i)
■ if v is associated with less than k lieutenants’ signatures, sign it and send to everyone
○ when there will be no more messages, return choice(V(i))
○ choice(V)
■ return v then V = {v}
■ return RETREAT when |V| = 0
● intuition: ensure every message received by a loyal lieutenant is sent to every
loyal lieutenant
● SM(m+1) for m traitors
Solutions - with signed messages
● SM(k) - message complexity: O(n^2)
○ every lieutenant maintains a value set V(i)
○ the commander sends the value to every lieutenant with its signature
○ for every lieutenant
■ every time it receive a new value v
■ put it in V(i)
■ if v is associated with less than k lieutenants’ signatures, sign it and send to everyone
○ when there will be no more messages, return choice(V(i))
○ choice(V)
■ return v then V = {v}
■ return RETREAT when |V| = 0
● intuition: ensure every message received by a loyal lieutenant is sent to every
loyal lieutenant
● SM(m+1) for m traitors
Solutions - with signed messages
● SM(k) - message complexity: O(n^2)
○ every lieutenant maintains a value set V(i)
○ the commander sends the value to every lieutenant with its signature
○ for every lieutenant
■ every time it receive a new value v
■ put it in V(i)
■ if v is associated with less than k lieutenants’ signatures, sign it and send to everyone
○ when there will be no more messages, return choice(V(i))
○ choice(V)
■ return v then V = {v}
■ return RETREAT when |V| = 0
● intuition: ensure every message received by a loyal lieutenant is sent to every
loyal lieutenant
● SM(m+1) for m traitors
Minimum number required for which an f-resilie
consensus protocol exists
synchrony asynchrony partial synchrony
RETREAT! RETREAT!
ATTACK!
ATTACK! ATTACK! RETREAT!
the commander said “RETREAT!” It takes less than T_r to reach a consensus
It takes less than T_l to reach a consensus
1990 2008
142
CONSENSUS MECHANISM AND ITS TYPES
143
PROOF OF WORK (POW)
145
DELEGATED PROOF OF STAKE (DPOS)
146
PROOF OF IMPORTANCE (POI)
147
PROOF OF CAPACITY (POC)
148
PROOF OF ELAPSED TIME (POET)
149
PROOF OF ACTIVITY (POA)
� Proof of Activity (PoA) combines PoW and PoS mechanisms. First, the
miners must do the heavy computation to add an empty block with header
information and reward address.
� Afterward, one empty block gets chosen based on the number of coins they
hold in their respective accounts. Then, the miner of that empty block gets
the chance to add its transactions to the block. Moreover, the transactions
are verified by network validators.
150
PROOF OF AUTHORITY (POA)
151
PROOF OF BURN (POB)
� PoB allows miners to add their block by sending some of their coins
to an unspendable account. This process of sending your earned
coins to an escrow account is called burning the coins.
� PoB eliminated the burnt coins permanently from regular transactions.
Hence, they become unspendable even by its owner.
� The more coins a miner burns, the higher his chances of adding his new
block of transactions to the network. Burning coins brings virtual
mining rights to the miner.
� Blockchain using PoB algorithm: Slimcoin
152
BYZANTINE FAULT TOLERANCE (BFT)
� BFT aims to resolve Byzantine Generals’ decisional puzzle. It’s
based on the communication problem generals of different armies might
have to decide to attack or retreat at the same time.
� BFT mechanism regulates the communication between nodes
using hashes, digital signatures, and metadata. It embraces the
synchronization among nodes of a decentralized network.
� Blockchains using BFT algorithm: Hyperledger Fabric and Zilliqa
153
PROS CONS
154
MERKLE TREE
155
� What Is a Merkle Root?
� A Merkle root is a simple mathematical
method for confirming the facts on a
Merkle tree.
� They're used in cryptocurrency to ensure
that data blocks sent through a peer-to-
peer network are whole, undamaged, and
unaltered.
� They play a very crucial role in the
computation required to keep
cryptocurrencies like bitcoin and ether
running.
156
� Working of Merkle Trees
� A Merkle tree totals all transactions in a block and generates a digital fingerprint
of the entire set of operations, allowing the user to verify whether it includes a
transaction in the block.
� Merkle trees are made by hashing pairs of nodes repeatedly until only one hash
remains; this hash is known as the Merkle Root or the Root Hash.
� They're built from the bottom, using Transaction IDs, which are hashes of
individual transactions.
� Each non-leaf node is a hash of its previous hash, and every leaf node is a hash of
transactional data.
157
EXAMPLE OF A MERKLE TREE IN BLOCKCHAIN
159
BENEFITS OF MERKLE TREE IN BLOCKCHAIN
160
161