100% found this document useful (1 vote)
930 views222 pages

Blockchain Tech Neo This Is The Techneo Guid Book For Blockchain

Blockchain notes for reference

Uploaded by

Raghav Joshi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
930 views222 pages

Blockchain Tech Neo This Is The Techneo Guid Book For Blockchain

Blockchain notes for reference

Uploaded by

Raghav Joshi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 222

Mohd Laraib

Module
Introduction to Blockchain
1

Sylabus

11 What is a

Merkle trees.
blockchain, Origin of blockchain (cryptographicallysecure hash functione), Foundation of blockchain:
1.2 Components of blockchain, Block in blockchain, Types: Public, Private, and Consortium, Consensus Protocol,
imitations and Challenges of blockchain.

1.1 introduction.. * *****************************************************************"**** **************** * ********* 1-3


GQ. Define blockchain and explain it with a suitable example..***** ***************************"***************** 1-3
1.1.1 Problems with a CentralizedSystem.. 14

Ga. What problems are associated with a centralized system?.. 4


Ga Differentiate between centralized, decentralized, and distibuted architecture..
.***********************************"****
.14
1.1.2 An ldeal Solution using
Blockchain. 5
1.1.3 SimplifiedArchitectureof a Blockchain..
********** **********************************************************.. 1-6
GQ Explain with a suitable diagram, the simplified architecture of a bloCKchain... .. . .. 0
1.1.4 Formal Definition of a Blockchain..
1.2 Origin ofBiockchain. **************************************************************************************************sstnesneo.*..
. . .. -9
1.2.1 History of Blockchain ********************************************************************snnnnee**....******....
.. 1-10
Ga. Explain the historicalperspectiveofblockchain.. ********************************** ************** 1-10
1.2.2 Foundation of Blockchain..**************************************************************************************o**... 1-11
Ga. What are Merkle trees ? Explain the structure of a Merkle tree.. *********************************************************** 1-11
1.2.2.1 Other uses of Merkle Tree.. ************************************************************* 1-12
1.3 Blockchainsolution. **************************************************e*****sssenneunens*.......... . .. 1-12
GQ. List and explain various actors in a blockchain solution... 1-12
1.4 Componentsof Blockchain.. *********e**********************************************************
oroe 1-14
****************o**o*****
GQ. State and explain different components of a blockchai. -14
1.4.1 Block in a Blockchain in a Simplified Format...
*************an 1-15
***********************************************************
1.4.2 Ledger Example: A Change of Ownership Transaction..
***************************************************....o..***snone
1-15
14.3 How External ApplicationsInteract with the Blockchain Ledger?. 1-16
*********************************.o********ooooooonnnnnoos

1.4.4 Blockchain Events ********************************************************ssnannsnnna*****nassnnn*ssnnnessnnno.oennonsen...soano


1-17
GQ What are blockchain events ?.. 1-17
*********°"****"*******************e****************************************************o***oros**anoonen

1.5 Block in Blockchain...**********************************************************************************************************************e***********oarosnen*o


1-18
GQ. What are the various components that are present inside a block that help in forming a blockchain ? -18
1.5.1 Structure of a Block****************esssesns*****eno** *********************************************oeo*nonnonnnanornonosmennan
1-18
GQ. With a suitable diagram, explain the structure of a block header with a list of transactions.. 1-21
Mockohain(MU-Sem 7-Comp) (Introductionto Blockchain)....Page no.. (1-
152 DoubleSpending *****"********** **°*° . 1-22
** * ***********

Eplain the ooncept of double spending with a suitable example?.. -22


6 The Technology 1-23
* ****
1.61 EBiockchainLayers. . 1-23
Write a short note on: Blockchain 1-23
layers.
162 Advantages of Blockchain.. .... 1-24
GO Enlist various
advantages and disadvantages of blockchain. 1-24
1.6.3 Disadvantages of Blockchain.. 1-24
1.7 Blookchain Types and Consensus
Mechanism. 1-24
1.7.1 Introduction. . 1-24
1.7.2 Decentralization and Distribution... . 1-25
a ******
GO. What is a distributed 1-25
ledger?. .. 1-26
GO. State several benefits of distributed ledger technology...
1.7.3 Types of Blockchain.. .. . 1-26
Ga Explain different types of blockchain.. 1-26
Ga What is a public blockchain? Enlist few examples of a public blockchain and state its advantages and
disadvantages.. 1-26

Ga What is a private blockchain? Enlist few examples of a private blockchain and state its advantages and

Ga.
disadvantages.
What is a consortium/federated blockchain? Enlist few examples of a consortium/federated blockchain
and state its advantages and
disadvantages. **. 1-28
GQ. Differentiate between different types of blockchain.. . 1-29
1.7.4 Consensus Protocol. 1-29
GQ. What is a consensus protocol?. 1-29
1.7.4.1 Consensus.. 1-29
1.7.4.2 Distributed Consensus. 1-31
GQ. What is distributed consensus ? . ... 1-31
GQ. State the properties of a distributed consensus protocol. .
. 1-32
1.8 Limitations and Challenges of Blockchain. 1-33
1.9 Biockchain Implementation Limitations..*** ** 1-33
GQ. What are the potential solutions for the scalability problem of blockchain?. 1-33
1.9.1 Limited Scalability. 1-33
1.9.2 Limited Privacy . ..1-36
9.3 Lack of Technical Knowledge.. o******** 1-36
1.9.4 Security Concems and Flaws. .. 1-36
1.10 Blockchain Implementation - Challenges...
1-37
1.10.1 Transaction Processing Speed. 1-37
1.10.2 Complexity.. . 1-37
1.10.3 Implementation and Operation Cost..
1-37
1.10.4 Storage Constraints..
1.10.5 Lack of Governance and Standards..
GO. How does lack of govemance and standards affect the blockchain ?..
1.10.6 Lack of Formal Contract Verification... ***.

1.10.7 Energy and Resource Consumption.


1.10.8 Simplified Mining....
1.10.9 Human Errors.
Chapter Ends...
1-40
Blockchain(MU-Sem.7-Comp.) (lintroductionto Blockchain)..Pageno...(1-3)
W 1. INTRODUCTION

GQ Define blockchain and explain it with a suitable example.

By definition. blockchain is a decentralized computation and information sharing platform that enables multiple
authoritative domains, who do not trust each other, to cooperate, coordinate, and collaborate in a rational decision
making process.
The keyword that we have in the abovementioned
definition is decentralized, which is an important aspect
of blockchain.
Computation and information sharing platform is the
next keyword that will help in specifying blockchain
broadly to be a decentralized database, which helps in
cooperation between multiple authoritativedomains
This technology is useful when multiple parties or
individuals want to cooperate with each other and they
want to come to a common platform so that they can
share information amongst themselves. (JAT)Fig. 1.1.1 : Structure of a decentralizednetwork
Multiple authoritative domains do not trust each other, so what blockchain does is it combines these multiple
authoritative domains in a common platform so that they can cooperate, coordinate, and collaborate in application
development process or business intelligence process.
Traditional way of sharing documents, which we do

using Microsoft Word. For example, Person A wants to


share some document with Person B. So, ideally what
Person A will do is he/she will write the content in a GeEng btrud

Microsoft Word document and then he/she will share


that document with Person B. Gettrg tanad

Person B will first receive the document sent by Person


A and then Person B will update the document with
his/her content and share the document again with
Person A. (A2)Fig. 1.1.2

This was the traditional way of cooperation between


Person A and Person B when they wanted to write
something in a shared document. In this specified
****

Person A
process, one of the main disadvantagesis that
and Person B will not be able to simultaneously edit the
document. The ideal solution where simultaneous
editing of the document can be done is with the help of
shared Google docs where both Person A and Person B
can edit or write the document simultaneously.
However, the problem of shared Google doe platform is
that the environment is still centralized. (A)Fig. 1.1.3

(MU-New Syllabus w.e.f academic year 22-23)(M7-85) Tech-Neo Publications.ASACHIN SHAH Venture
Blockohain(MU-Sem 7-Comp.) (Introductionto Blockchain)....Page no... (1-
on arises that does this type of centralized system harm or what is the disadvantage that if we use
a
d ehvironment for cooperation during this kind of information sharing plattorm.
1.1.1 Problems wlth a Centralized System
- -.
What problemsare associatedwith a centralized
Q Differentiatebetweencentralized,
system?
-
decentralized,
---- ----
and distributed
architecture
e
major problem of
centralized system is that it works as a
a
Dandwidth is single point of failure. For example, if sufficient
available to load the Google doc, then a
not
person will not be able to edit the document. You will have
to
un you connect to the Internet and
load the Google doc platform. The other
Google's server or your computercrashes. problem that could arise is what if
One crazy morning

What's the master


Man, the servers Client service? It looks like
a botteneck
came down yet
again today It's like a load
Dude, again? Well that's your balancer but
What's the Load Balancer problem. The master
does more
architecture overloads and the
look like? whole cluster
Web
Server Web craps out Yep-
Server

Master Service

Slave Slave Slave

(1A4)Fig. 1.14
In that case, the entire informationgets lost or even if you want to take
only after loading the backup, you will be able
a
backup, you will have to load the backup and
to
necessary to shift from a centralized process it further. Because of the
platformto a distributed abovementionedreasons, it is
In a distributedplatform, there platform.
are three different
types of architecture:
1. Centralized architecture: There is a
coordination system and whatever informationcentral coordinationsystem and every node is
the nodes want to connected to the central
central coordinationsystem. The share, the information shall be
all of the individual nodes will
problem with this architectureis that if the central shared by the
get disconnected. coordinationsystem fails, then
2. Decentralized architecture: Here, there are few
coordinatorscooperate with each other, and the coordinatorsrather than a
individual nodes, single coordinator,and all these
architecture, if a particular coordinator fails or they are connected to these
coordinators.In this
coordinatorshave failed can get connectedto other multiple coordinators fail, then the individual
perform the operation with the available coordinatorsthat are nodes whose
coordinators. working and can share the
number of failures can be tolerated until the In' this
type of architecture,the informationor
network and because of multiple network becomes advantage is that
multiple
simultaneous failure if thedisconnected.This architecture works on top of a
disconnected,then the individual nodes will not be able network gets
partitioned or the network grts
to
by a complete distributedarchitecture. cooperate with each other. This
problem can be solvd
(MU-New Syllabusw.e.f academic year 22-23)(M7-85)
Tech-NeoPublications
A SACHIN SHAH Venture
Blockchain(MU-Sem.7-Comp.) (Introductionto Blockchain)...Pageno...(1-5)
3. Distributed architecture : There is no centralized coordinator and all the nodes participate in the information
sharing process or application development where they coordinate with each other and collectively develop the

applicationor share the information amongst themselves.

Completerelianceon single
point (centrallzed) Is not safe
Decentralized: Multdple
points of coordinatioon
Distributed: Everyone
collectively execute the job

Link

Station

(a) Centralized (b) Decentralized (c) Distributed

(145Fig. 1.1.5

These are the advantages or disadvantages of a decentralized platform and distributed platform over a centralized
platform. However, in the today's world, it has been observed that centralized architectures are good but are not
scalable and not robust to failure.
Therefore it is essential that we move from a centralized architecture to a decentralized architecture or distributed
architecture. Blockchain is a platform that supports a decentralized platform or distributed platform where information
can be shared amongst users in a trust worthy manner.

1.1.2 An ldeal Solution using Blockchain


In a blockchain platform, Person A has his/her owa copy of the document, and Person B too has his/her own copy of the
document. Person A and Person B can simultaneously write to their own document and there is a network in between
that has the task to ensure that information consistency is maintained between the documents with Person A and Person
B who hold the documents individually.

Geng strted

ewww.rs

E
Everyone edits on their local copy of the document
the Internet ta kes care of ensuring consistencCy

(1A6Fig. 1.1.6

This is an ideal use case where blockchain platform can be used. This platform, which is spanned over a network, will

help in creating this type of coordination where Person A will keep his/her own copy of the document and Person B will
keep his/her own copy of the document.

(MU-New Syllabus w.e.f academic year 22-23)(M7-85) Tech-Neo Publications..ASACHIN SHAH Venture
Bloockchain (MU-Sem. 7-Comp.) (Introductionto Blockchain)..Page no... (1-61
em can independently write their personal copy and then the blockchain platform will ensure that they ae
g nside the document are getting synchronized with each other, and with time, both of them will be able to see
the most
updated copy
they will be able to update over the most updated copy.
or

the advantage of a blockchain technology over a complete centralized architecture or an architecture where a
shared copy exists between
multiple parties.

Geting Sted Getng Started

Blockchain
A decentralized database with strong consistency
support
(147)Fig. 1.1.7
1.1.3 Simplified Architecture of a Blockchain
-

GQ. Explain with a suitable diagram, the


--- --- ---.

--
simplified
----
architecture of a blockchain.
--- - -- - - - -
In a typical blockchain
architecture,every individual node maintains a local
the copy of the blockchain (i.e., ä local copy of
global data sheet). The systems task
is to ensure that all these
individual copies are consistent with each other.
Consistency means that the local copies that every node has are identical and
these copies are
the global information. always updated based on
For instance, if node A wants to enter some
information to its blockchain,then the entered
to all the copy of the blockchain that information will get updated
every node (i.e., nodes B, C, D, E, F, and G)
platform of blockchain which possess. This is the architectural
supports strong consistency among the local
has. replica/local information that every node
The local information is called a
public ledger. A
public ledger works like
database where it contains
a

historical information which is available to


everyone
and this type of historical information can be
utilized
for future computation.
An example of
public ledger could be a banking
a

transaction. You keeping the banking transactions


are

inside a public ledger and the old transactions which


are there are basically used to validate the new
transactions.
In a typical banking system, we usually maintain a
passbook and the bank works like a centralized
authority which stores all our transaction information
and whene individual visits a bank and making a
ver an

transaction, the bank validates everything with the Public Ledger


centralized information that it has.
(1A8Fig. 1.1.8: Simplified Architecture
Now, in case of a pubic ledger, there is a shift from a
centralized banking
of a Blockchain
where every individual has his/her own system to a
decentralizedbanking system
copy of the global
consistent, and whenever individual attempts to make a new
transactions, which not
only
transaction, during that time synchronized
an
but also
validated against the old transaction
thatis already the
inside a there new transaction is
public ledger.
(MU-New Syllabus w.e.f academic year 22-23)M7-85)
Tech-NeoPublications..ASACHIN
SHAH Venture
Blookchain(MU-Sem. 7-Comp.)
(ntroductiontoBlockchain)..Pageno..(1-7)
Example of a public ledger from a banking sector

Public Ledger PublicLedger


ofAlice ofBob

Alice: F100 Alice: T100

Alice Bob
F100
Public Ledger Public Ledger
offEve of Jane

Alice:F10o Alice: F10o

Eve Jane

(1A9)Fig. 1.1.9

There are four participants Alice, Bob, Eve, and Jane. Now, Alice wants to make a transaction of Rs. 50 to
Assume that Alice has Rs. 100 with here. The public Bob. In this case, another information needs to be
ledger is available to Alice, Bob, Eve, and Jane, which updated to all the public ledgers available with Alice,
has the initial content/information that Alicehas Bob, Eve, and Jane.
(i.e., Rs. 100). Therefore, this transaction gets updated in all local
copies of the public ledger.

Public Ledger Public Ledger PublicLedger Public Ledger


offAlice of Bob of Alice of Bob

Alice:100o F50 Alice: F10o Alice:100 50 Alice: F100

Alice Bob AliceBob:


T50 T50

Alice Bob Alice Bob


T100 T100
Public Ledger Public Ledger Public Ledger
PublicLedger of Jane of Eve of Jane
of Eve

Alice:F100 Alice: F100 Alice: F100 Alice: F100


Alice Bob: Alice Bob:
F50 T50

Jane Eve Jane


Eve
(1A11Fig. 1.1.11
(1A10Fig. 1.1.10

(MU-New Syllabus w.e.f academic year 22-23)(M7-85)


Tech-NeoPublications..A SACHIN SHAH Venture
Blockchain(MU-Sem. 7-Comp.) (Introductionto Blockchain)...Page no... (1-8)
Now, Bob wants to make a transaction of Rs. 30 to So, the public ledger of Alice, Bob, Eve, and Jane
Eve. gets updated with this latest information and this
transaction gets updated in all local copies of the
public ledger.
Public Ledger Public Ledger Public Ledger
of Alice
Public Ledger
of Bob of Alice of Bob
Alice:100 Alice:F100 Alice:F100 Alice:100
Alice Bob: Alice Bob Alice Bob: Alice Bob:
50 T50
T50 50
Alice
BobEve:
T30
U BobEve:
T30
Bob Alice Bob
F30 F30
Public Ledger Public Ledger Public Ledger
of Eve
Public Ledger
of Jane of Eve of Jane
Alice: 100 Alice: 100 Alice: 100 Alice:100
Alice Bob: Alice Bob: AliceBob:| AliceBob:
T50 F50
R50 T50
BobEve
30 BobEve:
T30
Eve Jane Eve Jane

(1A12Fig.1.1.12 (1A1Fig. 1.1.13

Now, Alice wants to make a transaction of Rs. 80 But, from Alice's public ledger, it is evident that she
to Jane. initially had Rs. 100 out of which she gave Rs. 50 to
Bob. So now by
combining both the transactions,she
has only Rs. 50 available with her. If
Alice tries to
make a transaction of Rs. 80, then this
transaction is not valid.
particular
Therefore, all parties will come to know from their
public ledger that
this transaction is not valid and it is
blocked and it cannot be included in their
public
ledger.
Public Ledger Public Ledger
PublicLedger Public Ledger
of Alice of Bob of Alice of Bob
Alice: F10o Alice:1000 Alice:10o
Alice Bob: Alice Bob: Alice Bob: Alice:100
50 50 T50 Alice
F50
Bob:
BobEve:
30
80 BobEve: BobEve: 80
Alice Bob 30 30 Alice
Bob
BobEve
T30
PublicLedger Public Ledger Public Ledger
of Eve of Jane of Eve Public Ledger
Alice:100 Alice:100 Alice:100 of Jane
Alice Bob: Alice Bob: AliceBob: Alice:100
T50 50
50 AliceBob:
50
Bob Eve BobEve: BobEve:
S30 30 30
BobEve
Eve Jane T30
Eve
Jane
(IA14Fig. 1.1.14
(1A15) Fig. 1.1.15

(MU-New Syllabus w.e.f academic year 22-23)(M7-85)


eTech-NeoPublications.ASACHIN
SHAH Venture
Blockchain(MU-Sem.7-Comp.) (IntroductiontoBlockchain)..Pageno...(1-9)
In this way a public ledger works in case of a decentralized system. Blockchain can be viewed as a public ledger.
However, there are numerous aspects that need to be considered.
Protocols for commitment: "Ensure that every valid transaction from the clients are committed and included in
the blockchain within a finite time". Whenever someone is making a new transaction, it has to be ensured that this
transaction, if it is valid, then it should be committed to existing public ledgers or blockchain otherwise that entry
will not be there in the blockchain. So, there should be a mechanism for validity checking of every upcoming
transactions from the clients and based on those validity checks, the transaction should be accepted and added in
the public ledger/blockchain or deleted or discard such transaction.

Consensus: "Ensure that local copies are consistent and updated." This is an essential aspect in the concept of
blockchain. As discussed earlier, there exists a local copy of the information available to every individual parties
and there is no such central platform like the bank which will maintain the consistency of the information.
Therefore, consensus mechanism ensures that whatever local copy every individual party has, they are
consistent/identical with each other.
Security: "Data needs to be tamper proof. Clients may act maliciously or can be compromised." The data that is
inserted in a public ledger or blockchain needs to be secure and tamper proof. Because blockchain is distributed to
individual parties, everyone is maintaining their local copy of their blockchain. So, it is possible that an individual
might make a change in the local copy and broadcast saying that this is the updated information. But the other
nodes in the network must be able to understand that whatever this individual is broadcasting is a false/tampered
information and the other nodes should not accept such type of information.
Privacy and Authenticity: "Data/transactions belong to various clients; and privacy and authe nticity needs to be
ensured." The data that is present in the blockchain belongs to several clients, and so, it is essential that both
privacy and authenticity needs to be safeguarded.

1.1.4 Formal Definitionof a Blockchain


A blockchain is an open, distributed ledger that can record transactions between two parties efficiently and in a
verifiable and permanent way.

Essential keywords
Open:Acessibleto al Distributedor Decentralized:No single party control
Efficient:Fast and scalable Verifiable: Everyone can check the validity of information

Permanent: Information is persistent

1.2 ORIGIN OF BLOCKCHAIN


In this section, we shall look into the historical perspective of blockchain and how this concept of blockchain evolved
over time and utilized into different applications.
The fundamental aspects behind the evolution of blockchain are as follows:
Cryptographically secured hash functions
Hash function : It is a function that maps any sized data to a fixed size. For example, we define a hash function
Hx) = x % n,

o Wherex and n are integers and % is the modular (reminder after division by n) operations. x can be of any arbitrary
length, but H(r) lies between 0 to n -1.

(MU-New Syllabusw.e.f academicyear 22-23)(M7-85) Tech-Neo Publications.A SACHIN SHAH Venture


no...(1.1a
Blockchain (MU-Sem.7-Comp.) (Introduction to
Blockchain)...Page
10
Why are they called cryptographicallysecured ? Digest
Input
Property 1: Hash functions are called one Cryptographic
DFCD 3454 BBEA 788A 751A
hash 969C 24D9 7009 CA99 2017
way functions. One way means given x and Fox
funcion
n, we can compute H(x), but when H(r) is
The red fox Cryptographic 0086 46BB FB7D CBE2 8230
given, We cannot say what is the
jumps over hasn ACC7 6CD1 9081 EE6E 3ABC
corresponding value of x (i.e., no fhe blue dog functon

deteministicalgorithmcan computex).
The red fox Cryptographic BFD8 7558 7851 4F32 D1C6
Property 2: For two different x and
r
umps ouer
the blue dog
hash
function
7581 79A9 ODA4 AEFE 4819

Ha) and Hx) should be different.

H
The red fox
o
Property 3: Avalanche effect: Let us jumps oevr
Cryptographic
hash
FCD3 7FDB 5AF2 C6FF 915F
the blue dog functon D401 COA9 7D9A 46AF FB45
consider x is the message and H(r) is its
The red fox
respective message digest. Avalanche jumps oer
Cryptographic 8ACA D682 D588 4C75 4BF4
hash 1799 7D88 BCF8 9289 6A6C
effect means a small change in x results in he blue do0g function

a
significantchange in H(x). (1A1Fig. 1.2.1

DICD 3454 BBEA 788A 751A


in the above figure, theinputxis "Fox" and its digest is 896c 24D9 7009 CA99 2D17
In
the second case, the
input is "The red fox
jumps over the blue dog" and its digest is
0086 468B BD CBE2 823C
ACC7 6Co1 9031 Z6L 3AC
. Now, in the third case, we
change "over" to "ouer" and we

8rD8 7558 7851 4P32 D1c6


observe a
significantchange in the message digest 681 79A 0DA4 ALTz 4819

So, by simply observingthe


message digest, we cannot say that the
original input was similar.
Similarly,in fourth and fifh cases, the
message digest looks completelydifferent.
Therefore, avalanche effect ensures that by
merely looking at the digest, it is
Examples of cryptographichash functionsare MDS and SHA256. impossible to identify what was the input.
1.2.1 History of Blockchain

GQ. Explainthe historicalperspectiveof


blockchain.
Cryptographicallysecured chain of blocks
The first use of the concept of
cryptographicallysecured chain of blocks came
Stornetta. They have developed a mechanism for in 1991 in a
time
stamping a digital document. In other paper by Harber and
document that is edited by multiple
people from time to time. words, you have a digital
Person 1 has created the document, Person 2
has edited the
forth. You want to maintain a list of document, Person 3 has edited the
which person in a secure manner such timestamp when the document
was " document...soon and so
that no created followed
people will by when it was
change in the time stamp value. edited by
be able to make a

(MU-New Syllabus w.e.f academic year


22-23)(M7-85)
Tech-NeoPublicationsA
SACHIN SHAH Venture
Blockchain(MU-Sem.7-Comp.) (Introductionto Blockchain)...Pageno...(1-11)
This is important from the document purpose because you
would like to know or see when the document was last
edited or some people would claim that they haven't made H=Haso.c,TS,.Ho Block 1

changes in the document but in reality they could have


made the change. AU
To solve this problem, Harber and Stornetta used the
concept of chain of blocks. They considered parameters
HHas1.C TS, H Block 2

like sequence number of access, client ID, timestamp, a


hash value from the previous request and the entire thing
is hashed to connect to the previous blocks. Ha-Has2.C, TS, H2 Block 3

In the Fig. 1.2.2, 0 is the sequence number of access,C is


the client ID, TS is the time stamp, H, is the hash value
from the previous request and (0, Ci, TS1, and H) are
hashed and stored in H1. H, is one of the components that
HHas3.CTS4Ha Block 4

is hashed to obtain H2. (GAmFig. 1.2.2 : Cryptographically secured chain of blocks


The advantage of this hash chain is that if you want to make a change in the time stamp value (i.e., TS,), then we need
to make changes in Hz, H, and H4 and people will be able to observe that values have been changed.

This is how the concept of chain of block by connecting them with the hash function was used to cryptographically
secure the time stamp value of a digital document. This is how individual hash values are helping to connect the blocks
one after the other and making the blocks as tamperproof.

1.2.2 Foundation of Blockchain

GQ What are Merkle trees ? Explain the


Root Hash
structureofa Merkletree
-

HrooHash(HotH,)
Merkle Trees : It is a tree structure
where the leaf nodes will contain the
hash of the document and every
L Hash L, Hash
individual node or the intermediate node
will contain the hash of the combination
Ho=Hash(HootHo1) H,Hash(H10tH11)
of the left child and the right child.
The example of a binary Merkle tree is L2 Hash 2 Hash L2 Hash L2 Hash
Fig. 1.2.3.
The leaf node (L) contains the hash of
HooHash(DHoHash(D,) H10Hash(D|H,=Hash(D)
the contents of the documents D, D2. D Da
D, and D4. The intermediate node
contains the hash value of Hoo and Ho1
and their combined hash value (i.e., H). (1A18)Fig.1.2.3 : Structure of a Merkle tree
At root level, the root contains the combined hash (i.e., Hoo) of its left child and the right child. This means that if any
change is made in any of the documents, then the change will get reflected in their respective hash values. For instance,
if any change is made in D, then the change will get reflected in Ho. Ho, and
H
Now, if we wish to secure a number of documents together (ie., D,, D,, D, and D,), then we can just propagate or
publicize the root value.

(MU-New Syllabus w.e.f academic year 22-23)(M7-85) ETech-NeoPublications..ASACHIN SHAH Venture


Blockchain(MU-Sem. 7-Comp.) (Introductionto Blockchain)..Page no...(1-1 -12
cnange in one of the four documents, then that change will get reflected in the root vaue. 1his is how
we
can
COlectively secure a number of documents together by reusing this concept of Merkie
The concept of Merkle tree was used in 1992 by extending the work of Harber and Stometta. Bayer, Harber, and
Stometta used Merkle tree for time The efficiency was improved
stamping and verifying a digital document. by
combining time stamping of several documents into a single block.

1.2.2.1 Other uses of Merkle Tree

Feer-to-peer networks : Whenever data blocks are shared in a peer-io-peer network, it is essential that data blocks are
eceived in an undamaged or in an unaltered way and other peers are not lying about a block (i.e., they are sharing a
Dlock, but that block is not an updated block). In that case if the root hash of the Merkle tree, which is the Merkle root,
is shared, then Merkle root ensures that
none of the documents has been altered.

Bitcoin implementation: This is one of the most popular use of the Merkle tree (i.e., bitcoin implementation).It is one
of the most
popular cryptocurrency which forms one of the basis for blockchain technology. We want to identify that
the shared information is
unaltered, and no one is lying about a transaction.
So, here too we can construct a Merkle tree of all transaction
together, and if someone is denying one particular
transaction, then the Merkle root will change, and by looking into the Merkle root, we would be able to validate
whether
a set of transactions have been transmitted from node
one to another node in an unaltered way.
Blockchain 2.0 : Because of the revolution in bitcoin,
many mainstream companies began to use the central blockchain
idea and build alternative systems for use in
industry, manufacturing,supply chain, finance, governance, IoT, etc. This
movement of academia, industry,and startups is termed Blockchain 2.0.

1.3 BLOCKCHAIN SOLUTION


-.

List and explain variousactors in a blockchain solution.


- -----
-- - -- --
Who are the actors in a blockchain solution?

R
Regulator
B2B
Blockchain
Performs transaction User
Blockchain oversight
Architect
J Designs
Accesses Membership
security Services
Creates Blockchain certificates
Blockchain applications
Developer

Accesses
data
Operates Accesses Traditional
Data Sources
to logic
Blockchain
Network Traditional
Operatoor Processing
Platforms

IA19Fig. 1.3.1 : Blockchain solution actors

(MU-New Syllabus w.e.f academic year 22-23)(M7-85)


el Tech-Neo
Publications..ASACHIN SHAH Venture
(Introductionto Blockchain)....Page no... (1-13)
Blockchain(MU-Sem.7-Comp.)
1. Blockchain Architect

Responsiblefor the architecture and design of the blockchain solution.


A blockchain architect will design how a blockchain solution is going to be built. He/she will identify what
information needs to be stored, what are some of the transactions and business logic that need to be embedded onto
a network, how the network itself should to be created, etc.

2 Blockchain developer
A blockchain developer will take what has been architected and he/she will develop the actual code that will run on
the blockchain network.
The developer of applications and smart contracts that interact with the blockchain and are used by blockchain
users.

3. Blockchain network operator


A blockchain network operator manages and monitors the blockchain network.
Each business in the network has a blockchain networkoperator
4. Traditional processing platform
There are traditional processing platforms or other systems of record that the blockchain connects to and might
send or get information.
An existing computer system which may be used by the blockchain to augment processing. The system may also
need to initiate requests into the blockchain.

5. Traditional data sources


Traditional data sources and databases are also part of the blockchain solution.
An existing data system which may provide data to influence the behavior of smart contracts.

6. Membership services
It is an important component. It defines or provides the identity for users to come and transact on the blockchain.
For example, when you open an account in the bank, the bank gives you a username and password for login to
access web services.
The membership service will provide a digital certificate that will allow an individual to transact on the network.

It manages different types of certificates required to run a permissioned blockchain.

7. Blockchain user
A blockchain user will perform business transactions on the blockchain. These users could belong to multiple
organizations that are participating in the blockchain network.

He/she is a business user operating in a business network. Blockchain users interact with the blockchain using an
application. However, they are unaware of the blockchain.

8. Blockchain regulator
The regulator could be an optional actor in a blockchain solution. The regulator might have read only access onto
the network where he/she might have some oversight into whether the transactions performed are legitimate or not.
Whether the transactions are compliant with the policies set by the blockchain regulator.
A blockchain regulator is responsible for the overall authority in a business network. In paticular, they may
require broad access to the contents of a ledger.

(MU-New Syllabus w.e.f academic year 22-23)(M7-85) eTech-Neo Publications..ASACHIN SHAH Venture
Blockchain(MU-Sem.7-Comp.) (Introductionto Blockchain)..Page no.. (1-14

M14 cOMPONENTSOF BLoCKCHAIN


GQ State and explain diferent componentsof a blockchain.
--- -----

. or Dlockchain components are available in the market. Some of the major components in a blockchain

solution are as foliows:


Ledger: "t contains the current world state ofthe ledger anda blockchain of transactioninvocations.
Every node in the blockchain network will maintain a
state of the data that is
ledger of all transactions, and the transactions will maintain the
being stored on the blockchain network. In other
words, a ledger is a channel's chain and current
state data which is
maintained by each peer on the channel. The ledger is
replicatedacross all nodes in the network.
Smart contract: "It
encapsulatesbusiness network transactions in code. Transaction invocations result in gets and sets
of ledger state." The smart
contract is the business logic. An individual can encode
his/her own business logic as
code/functions and each invocation of this function
becomes a transaction on the blockchain. A smart contract is
software running on a a
ledger to encode assets and the truncation instructions (business
Peer network: A
logic) for modifyingthe assets.
broaderterm overarchingthe entire transactional flow, which serves to generate an
order and to confirm the correctness of
the set of transactions
agreement on the
constitutinga block.
Consensus network : It is a collection of
network data and processing
peers forming a blockchain network. It is
responsible for
maintaininga consistentlyreplicatedledger.
Membership: "It manages identity and transaction certificates as well as other
membershipservice provides identities for the users to transact on the aspects of permissioned access." A
blockchain.
Events: "It creates notifications
of significantoperations on the blockchain (e.g., a new
related to smart contracts. It does not include event block) as well as notifications
distribution."Whenever a transaction
individualcan create an event notification.So, blockchain happens on a blockchain, an
will specify that a
and will provide the details of the
transaction, which can be used to particulartransaction has been committed
can also be used to integrate
trigger other transactionsthat might be internal to an
with existing systems of record. Events
System management:The blockchain network is a organization.
distributed
it requires new ways to create, change, and monitor blockchain system that is running across multiple organizationsso
Wallet: "It securely manages a user's
components.
security credentials." Each user has a
performing transactions using the digital certificate. There needs to be a digital certificate and is going to be
private information. So, a digital certificatecontains the place where a user can
securely store that
the informationwith anybody else, which is private identity of an individual. He/she should not be
securely managed in a wallet. sharing
Svstem integration: It is responsiblefor
integratingblockchain bi-directionallywith external
of the blockchain, but used with it. systems. It is not a part
A ledger often consists
of the following data structures
1. Blockchain
A linked list of blocks Block
(a hash chain)
Each block describes a set of transactions
(i.e., the inputs to a bxn
smart contract invocation, output, identities,or bxn bxn
certificates)
Hash chaining leads to certain
propertiesof immutability(i.e.,
blocks cannot be tampered).
Blockchain
(1A20 Fig. 14.1
(MU-New Syllabus w.e.f academic year 22-23)(M7-85)
Tech-NeoPublications...A
SACHIN SHAH Venture
Blockchain (MU-Sem. 7-Comp.) (Introductionto Blockchain)..Pageno...(1-15
2. World state
lt is the information that smart contracts can work with.
It stores the most recent state of smart contracts (i.e., the output of transactions)
In bitcoin, the world state can be thought as the account balances.
It is stored in a traditional database (e.g., key - value pair)
World State
Data clements can be added, modified, deleted, all recorded as transactions on blockchain. (121)Fig. 1.4.2

1.4.1 Block in a Blockchain in a Simplified Format

As can be seen in the figure, every block has a hash, which is being chained together. For instance, Block 15 has a hash
value 57ec2fda71, which is getting stored in Block 16. The same process is observed in Block 16 and Block 17.
A block is a sequence of transactions, i.e., each block can have multiple transactions in them and each transaction can
specify which smart contract got invoked or which specific funetion got invoked and which user invoked the transaction
.e., some identity of the user will be there in the transaction followed by other details).
"Each block can have zero or more transactions and some additional metadata". Note that the first block that is getting
created the blockchain is called the genesis block, which has special information about the configuration of the
network itself, who the participants are, and other configuration information. The genesis block does not have any user
transactions, but other blocks in the blockchain can have one or more transactions.

Block15 Block 16 Block 17


--. Block Hash: 57ec2fda71 Block Hash: 87ea2ffe94 BlockHash: 44bf2efe32
PreviousBlockHash:
d68b2f0a3b
Previous Block Hash: Previous Block Hash:
57ec2fda71 87ea2ffe94

Transaction Transaction Transaction

Transaction Transaction

Transaction

(1A22)Fig.14.3 : Simplified view of a block in a blockchain

Blocks achieve immutability because of the result of a hash


Application
function of the previous block and also because of the fact
that blocks are getting added through consensus in a
decentralized manner. So, not a single organization can
unilaterally manipulate blockchain. Smart
Contract
a14.2 Ledger Example : A Change of Ownership f(abc):

Transaction
Block
The Fig. 1.44 shows an example of a transaction and how a
ledger might work.
myCar.vin=
As it can be seen from the ig.1.4.4 that there is a smart
1234.
contract that takes it input for instance an owner
(let's say a car) and the owner of the car is set to Matt. Wortd State "Invoke,myContract
setOwner, myCar, Matr

(IA2)Fig.1.4.4:Exampleof atransaction&workingof aledger


(MU-New Syllabus w.e.f academic year 22-23)(M7-85) eTech-Neo Publications.ASACHIN SHAH Venture
(Introductionto Blockchain) Page no..(1.1
Blockchain (MU-Sem. 7-Comp.)

#Transactioninputsent from applicatlon


invoke (myContract, setowner, myCar, Matt)

# Smart contract implementation


setoner (Car, nemowner)
set Car.owner = newowner

#World state: New Contents


myCar.vin = 1234
nycar.owner= Matt
myCar.make : Audi

From the above code snippet, we have a setOwner( ) where it sets the owner of a car to a new person, and the new

person in this case will be Matt.


The inputs to the setOwner( ) are Car and the newOwner of that car. We can see that Car.owner is getting modified to

newOwner, which will be the final output of the transaction.


Now, in the world stalte, we see how the myCar object has been modificd (refer #World state: New Contents), which is
getting stored in the world state.
The transaction that contains this information (dotted circle in the figure) says to invoke myContract with setOwner,
myCar, and Matt as the arguments. Moreover,

myCar. vin 1234

myCar owner=Matt
myCar,make Audi
is the output that got written from the contract. All of this gets writen as a blockchain transaction in the blockchain as
one of the blocks.

1.4.3 How Extemal ApplicationsInteract with the Blockchain Ledger?


A blockchain developer will develop a client applicationthat will interact with the smart contract.
The developer also
develops the smart contract. So, this is the business logic that runs inside the blockchain in a decentralized manner.
In the previous example, setOwner)was the part of the smart contract and there is a client applicationthat will invoke
functions over a period of time. So, the client applicationsays that Matt is now the new owner of
the car and then Matt
will be set as the owner. Note that the client applicationuses an SDK to submit
transactionson to the blockchain.
The client applicationcan also access the blockchain directly to see whether the transactionsare
also look at historic transactions. actually committed or
Every transaction that is being invoked gets recorded on the
blockchain, and all the elements that are
such get, put, or delete will get recorded on the world state, and whatever getting modified
is getting modified in the
part of the transaction. So, this is how a blockchain world state will be a
gets constructed. All this
every peer in the network will be performing such a function/task. represents single peer, which means
a

(MU-New Syllabus w.e.f academic year 22-23)(M7-85)


Tech-NeoPublications..ASACHIN SHAH Venture
Blockohain (MU-Sem. 7-Comp.) (Introductionto Blockchain)...Pageno... (1-17)
When a cliemt applicationsubmit its information to a smart contract, the smart contract gets executed on all the nodes
All the nodes simultaneously update their world state and will agree that the output is actually valid and consistent

throughout and then the hlock gets added with the legitimatetransactionon to the blockchain,and once a transactionis
committed on to the blockchain, it will be called as the final transaction.
There is an eent that gets emited, as shown in the figure, which means that the transaction has been simultaneously
committed on all the nodes in the blockchain. The generated events can be used to perform additional processing within
an organization.

Client
Develops Application
Blockchain
Developer D
SDK

Develops Submits

Smart
Contract
Emits
Event

get, 'put, 'delete'


Accesses
Recorded

Ledger
Block
Emits

World State Event


Blockchain
Peer

(1A24)Fig. 1.4.5 : Interaction of an external application with the blockchain ledger

1.4.4 BlockchainEvents

GQ. What are blockchainevents ?


--

In computing, an event is an occurrence that can trigger


handlers (e.g., disk full, fail transfer completed, mouse
clicked, message received,etc.).
Events New txn
are important in asynchronous processing systems
like blockchain.
A blockchain can emit events that are useful to application New txn
programmers (e.g, transaction has been validated or Event Handler
rejected, block has been added, etc.) Transfer
Events irom external systems might also trigger a
confirmed
blockchain activity (e.g., exchange rate has gone down
below a threshold value, temperature has risen, time period
has elapsed, etc.). Application
(1IA25Fig. 1.4.6: Blockchainevents

(MU-New Syllabus w.e.f academic year 22-23)(M7-85) Tech-Neo Publications..ASACHIN SHAH Venture
Blockchain(MU-Sem. 7-Comp.)
(Introductionto Blockchain).Pageno...(1-1R
Integrating with existing systems

T
2. Blockchain
1.System
Events Events
Existing
3. Call into Blockchain Network Systems
from ExistingSystems

= 4. Call out
Transfom

to
Two-way exchange
Blockchain Network
Existing Systems Existing
Systemss
-Events from blockchain network create
actions in existing systems
-

Cumulativeactions ininteraction
result in blockchain existing systemns -
Transfomation between blockchain and
existing systems formats
(1A26) Fig. 14.7

M 1.5 BLOCK IN BLOCKCHAIN

GQWNhat are the various components that are present inside a block that help in forming a blockchain ?
.

What is there inside the block of a blockchain ?


To put some data in the blockchain we want to secure the data and how a block is securing the data by utilizing the
concept of cryptography.
We shall take the example of bitcoin in this
Block 51 Block 52 Block 53
case to explain what all things are present
Proof of work: Proof of work: Proof of work:
inside a block and how individual blocks
0000009857vv 000000zzxvzx5. 00000090b41bx
are getting connected.
Previous block: Previous block: Previous block:
Block contain digitally signed and 000000462qrza1 0000009857vw 000000zzxvzx5
encrypted transactions that are already
Transaction Transaction Trar a ction
verified by the peers. Ik541fvx dd5g31 bm 941xcv14
Inside a block, there could be multiple
transactions, which are verified by the
Transaction Transaction Transaction
09345w1d 22qsx987
these transactions are there abb7bxx
peers. Note that
in an encrypted format or they are digitally Transaction Transaction Transaction
vc4232v32 001hkO09
signed. This the participants
ensures that 34oiu98a
can only view the information on the ledger

that they are authorized to see. (1A27Fig. 1.5.1: Components within the block of a blockchain

a 1.5.1 Structure of a Block


A block is a container data structure that contains a series of transactions. In case of a bitcoin, a block may contain more
than 500 transactions
on an average. The average size of a block is approximately 1 MB as proposed by Satosti
Nakamoto in 2010. Nowadays, the size of a block may grow up to 8 MB or sometimes higher. Also, larger blocks can
help in processinglargenumberoftransactionsinonego. Inthecontextof bitcoin, we shall see the structureof a bock
(MU-New Syllabus w.e.f
academic year 22-23)(M7-85) Tech-Neo Publications...ASACHIN SHAH Venture
(Introductionto Blockchain)...Pageno...(1-19)
Blockchain(MU-Sem.7-Comp.)
The two major components are: (i) Block header (ii) List of transactions

Block #500312
Summary Hashes
0000000000000000000301fcfeb141088a93b77dcOd5257
1a1185b42526ae2tb
NumberOf Transactions 2580 Hash
Previous Block 0000000000000000004b1ef0105dc1275b3adfd067aed63a43324929bed64d7
Output Total 10,857.62500453BTC
EstimatedTransactionVolume 2,331,80756289BTC Next Block(s) 000000000000000000282ac9977c3d103a3c6bd873b
1f7744eBd42b8329baa6
Marked Root a8976ed0487a29c73057e12d89afata0c01e02782cba6c89b7019e51296475oc
TransactionFees ,19384324BTC
Height 500312(Main Chaln)
Timestamp 2017-12-2020:02.40
2017-12-20 20:02:40
RecelvedTime
Relayed By BTC.TOP Be YourOwn Bank
Use yourBlockchainwallet
Difficulty 1,873,105,475,221.61 to buy bítcon now
Bits 402691653 OETSTARTED
Size 1093.292kB BLOCKCHAIN
Weight 3992.963kWU
Version Ox20000000
Nonce 900685155
Block Reward 12.5 BTC

Transactions
2017-12-2020:02:40
Nkhja23hjhikajditijkihilkidijhuyebduejikusk7 19.08384324BTC
No inputs (Newly Generated Coins) NIkhja23hjhj|kajdfhjkjhlikjdfjhuyebduel|kusk]7
Unable to dectde output address
0BTC

19 0338432 Brc

(1A2BFig. 1.5.2: Exampleof a block header with a list of transactions

(i) Block header


In the block header, in blockchain, there exists a sequence of blocks which are connected by the hash of the previous
block.
As we can see from the Fig. 1.5.3, H is connected with the hash
of Ho, H, is connected with the hash of Hi, Hs is connected with
the hash of H, and Ha is connected with the hash of H. This is
Ho Block 1

how hash functions construct a chain kind of a structure. Inside a


block header, there exists
Previous block hash: This is utilized to construct the current H Hash(H) Block 2

block hash. Every block inherits from the previous block. Herein,
we use previous block's hash to create the new block's hash,
thereby making blockchain tamperproof.For instance, if we wish Ha= Hash(H) Block 3

to make a change in Block 2, then Hi's value would change, and


as a result, the hash values in Hg, Hy, and H, would also
change
So, in a distributed network, some person is trying to tamper the H Hash(H2 Block 4

block, then he/she has a make changes in all blocks which are
there after the tampered block. We want to make this problem as
complicated such that by the time some person will tamper cetain Block 5
H4=Hash(Ha)
blocks, new blocks will get added and he/she will never be able to
reach up to the last block (ie, changing the hash value for the last
block). This how the blocks are made tamperproof. (1A29) Fig. 1.5.3

(MU-New Syllabus we.f academic year 22-23)(M7-85) Tech-Neo Publications..ASACHIN SHAH Venture
(1.2
Blockchain(MU-Sem. 7-Comp.)
(Introductionto
Blockchain)..Page no...
= (1-20)
Mining statistics used to construct the block
H Hash(H-1|IT II Nonce)
Mining is the mechanism to generate the hash.
Generated Previous Set of Random
The mechanism needs to be Nonce Value
complicatedenough Hash Value Hash Transactions

to make the blockchain tamper proof. In case of


(1I430) Fig. 1.5.4
bitcoin mining, the hash function looks like
he task of a miner is to determine the nonce value such that they can ensure certain difficulty on the generated hash

value. For example, the complexity in bitcoin is such that whenever we are generating this hash value, we need to find

out the nonce such that whate ver be the value of H, it will have 20 zeros in its prefix or 1" 20 bits will be zero.

By the propertyof the hash function, if H, is known, then we will not be able to find out the nonce (message), but if the
nonce (message) is known, then only it is possible to find out H. So, the miners have to change the value of nonce so
that the objective is met.

The objectiveis that the generatedhash value will have some certain number of zeros in the beginning.The complexity
of the mining algorithm depends on the number of zeros that are
present at the beginning of the generated hash value.|
The complexityincreaseswhen more time is required to calculate the nonce value.
The blockchainheader contains the
following parameters(i.e., mining statistics):
Timestamp:It contains the timestampto identify when mining has been performed.
o Nonce: It provides the corresponding hash value.

o Difficulty:It determines how difficult it is to obtain the nonce to meet the criteriaof the
certain number of zeros
complexity of having
at the prefix of a hash value.
Merkle tree root: This stores the informationor a hash
value of all transactions. All
transactionsare organized in a
Merkle tree structure. Note that the root of the Merkle tree is a
verificationof all the transactions.
o In a Merkle tree, at the leaf node, there exist a
hash of the transactions
node (i.e., Ho and Hi) contains the hash of the (i.e., T, Ta, T3, and Ta). Every intermediate
combined hash values (i.e., Hoo and
respectively). Hoi and Hio and H
o Also, the root contains again the
combined hash values of its left tree
Root Hash
(i.e., Ho) and right tree (i.e., H).
Interestingly, if we wish to make a HroolFHash(Hg+H) KMerkle Root
change in T3, then Hio would get
changed followed by changes in H and L Hash
L Hash
finally changes in Hot So, it is evident HoFHash(HootHo1)
that if someone changes a transaction, H-Hash(H10tH)
then the root hash will change, and once L2 Hash
L Hash
the root hash changes, then L2 Hash
theooHash(T,) HoFHash(T2
all L Hash
subsequent hash of all the blocks will
get change because they are linked with
HAoFHash(T)H,HashT
each other.
(IA3)Fig. 1.5.5 Merkle tree root
(MU-New Syllabus w.e.f academic year 22-23)M7-85)
Tech-NeoPublications.A SACHIN SHAH enture
Blockchain(MU-Sem.7-Comp.) (Introductionto Blockchain)...Pageno...(1-21)
How does a block header look?

GQ. With a suitable diagram, explain the structure of a block header with a list of transactions.

Summary
Number Of Transactions 2580
Output Total 10,857.62500453 BTC
Estimated Transaction Volume 2,331,80756289 BTC
Transaction Fees 7,19384324 BTC

Height 500312 (Main Chain)

mestamp 2017-12-20 20:0240


Received Time 2017-12-20 20:02:40

Relayed By BTC.TOP

Difficulty 1,873,105,475,221.61
Bits 402691653
Size 1093.292 kB

Weight 3992.963 kWU


Version Ox20000000
wwww.w
Nonce 900685155
Block Reward 12.5 BTC

(1A32) Fig. 1.5.6

Hashes in a block header


A block header also contains certain number of hashes, ash shown below:

Hash value of
the current block

Hashes 0000000000000000000301fcfeb141088a93b77dcOd52571a1185b42526ae2fb
Hash
Previous Block 0000000000000000004b1ef0105dc1275b3adfd067aed63a
43324929bed64td7
O000000000o00000000282ac9977c3d103a3c6bd873b17744e8d42b8329baa6
Next Block(s)
Marked Root a89769d0487a29c73057e
12d89afafaOc01e02782cba6c89b7019e5129d475cc
(IA3) Fig. 1.5.7

If any change is made in one of the transaction, then the Merkle root gets changed. If the Merkle root changes, then the

value gets changed. If the hash value of the current block changes, then the hash value of the next
correspondinghash
block changes.
have change the entire blockchain. In addition, the hash
Ultimately,everythinggets changed and so the attacker will
to

algorithmthat is used to compute the hash is double SHA256.

Transactions in a block
1. Transactions are organized as a Merkle tree. The Merkle root is used to construct the block hash.

2. If you change a transaction, then you need to change all the subsequentblock hash.
in blockchain.
3. Inference : The difficultyof the mining algorithmdetermines the toughnessof tamperingwith a block a

(MU-New Syllabus w.e.f academic year 22-23)(M7-85) Tech-Neo Publications..ASACHIN SHAH Venture
Blockchain(MU-Sem. 7-Comp.) (Introductionto Blockchiain)...Pageno... 1-22

Transactioninformatloninside
a block
Users with a unique ID
Transactions
2017-12-2020:02:40
317ebtaOd52571a1185b42526a3d787
NoInputs (Newly Generated Coins) 19.69384324 BTC
1H296kJKF2HLPGY15UWLB5M9qGNxvt8tHJ
Unable to decode output address
OBTC
19 69384324 BTC
Transactiont
Hash value of this
transaction

717e4ds9st4864b24ub5ldeca7965241 2017-12-20 20:00:14


3GsDfabubnrUSdm9orevWvz 1H744xinQXAXAg1VborLS 296441546 BTC
2.96441546BTC ransaction2
One usertransfercertainamountof bitcoinsto anotheruser

8ce2ddf623dm9orevvzd272c91295423ee 2017-12-20 19:59:57


160Qubdm9e HSX57SHLgvV 1Dv563i1 kq4QRSeKdoGytbd 0.02983573BTC
0.02983573 8TC Transaction3
(1434)Fig.1.5.8: Transactioninformationinsidea block
Al these hash values are added in a Merkle tree and a Merkle root is added as a part of a block header.
Summary
The block contains two
parts, i.e., the header and data (transactions).
The header of a block connects the
transactions,i.e., any change in any transaction will result in a change at the block
header. The headers of subsequentblocks are connected in a
chain, i.e., the entire blockchain needs to be updated if you
want to make any change
anywhere.
1.5.2 Double Spending

GQ Explain the conceptof doublespending with a


suitable example?
Whenever Person A is creating a transactionin a
digital currency, there
could be a problem of double spending. Double
spending means the same
cryptocurrency is used for more than one transaction.
For example, Person A has a total of S0 bitcoins, and the same amount of
bitcoin she has transferred to Person B and Person C. Such A8:50

type of
transactionsare called double spending, and both these transactionscannot
be valid simultaneously.
In a

of double
centralizedsystem like a banking agency, it is easy to validate such kind
spending. So, when a person submits a transaction to a bank, the
A:50
A-C:50
bank can validate whether that person is performing a double
spending and
take the necessary actions.
(1A89Fig. 1.5.9 : Double Spending
However, in decentralizednetwork, how the problem of double spending can
a
be avoided so that an
be able to make two transactionswith the same individual will not
cryptocurrency.
Handle doublespending using blockchain
In order to prevent double spending, we use blockchain so that
the details about
the transactions that are sent art
forwarded to all the users in a network or as many as other
computers in the network as
possible. We use blockchain
which is a constantly growing chain of blocks, to contain a
record of all such
maintainedby all the peers in a cryptocurrency(i.e., bitcoin) network. truncations, and this blockchain is
So, everyone has the
copy of the blockchain.
(MU-New Sylabus we.f academic year 22-23)M7-85)
Tech-NeoPublications..ASACHIN SHAH Venture
Blockchain(MU-Sem. 7-Comp.) (Introductionto Blockchain)...Pageno...(1-23)
To he accepted in a chain, transaction blocks must be validated and must include proof of work (PoW) - a
computationally difficult hash generated by the mining procedure. Blockehain ensures that if any of the block is
modified, then all following blocks will have to be recomputed. When multiple valid continuation to a chain of blocks
appear, only the longest branch is accepted and it is then extended further (ie., longest chain). Once a transaction is
committed in the blockchain, everyone in the network can validate all transactions by using a sender's public address.
This is how validation prevents double spending, especially in bitcoin.

1.6 THE TECHNOLOGY

1.6.1 BlockchainLayers

GQ. Write a short note on: Blockchainlayers.


- ---------
A simple structure of the blockchain ecosystem is shown below. (Refer Fig. 1.6.1)
Presentation layer: This layer provides access to the entire network and blockchain applications.User experience
(UX) and user interface (UT) of a biockchain application begins from the presentation layer. As we all know that in
today's world customer satisfaction mainly relies on ease of use and suppleness. Similarly, for the adoption of
blockchain, good UX and Ul designs are equally important. UX design not only enhances customer gratification and
trustworthiness but also improves product usability (i.e., faster speed) and interaction betvween a user and the rest of the
blockchain ecosystem. UI design offers blockchain visuals. It enhances the experience of a user in terms of aesthetics
leading to an instinctual interface.
Application layer: This layer combines business logic with user interactions.It consists of decentralized applications
running on a P2P network. Decentralized applications are the ones that set communication between the presentation and
blockchain layers. Decentralized applications are similar to a web application except that application programming
interfaces are used to connect a website to a database. Decentralized applications connect to a blockchain via smart
contracts.

Blockchain layer: This layer consists of consensus algorithms, the medium, and interface for a P2P network that
decides how data is placed in several packets and then transmitted between peers. It handles the mining layer, protocols
that decide consensus methods and participation, nodes that execute protocols, and the distributed ledger.
Internet layer: Blockchain works over the internet. This layer connects all networks together (i.e., smartphones, IOT
devices,etc.).

Presentation Layer

Desktops Laptops Smartphones Tablets

ApplicationLayer
Wallets DecentralizedApplications Smart Contracts Web Browsers

Blockchain Layer

Protocol Layer: Consensus Algorithms Network Layer: P2P Broadcast

Infra and Data Layer: Mining, Nodes, Tokens, Distributed Ledger


Internet Layer

TCPInfrastructure

(1A36Fig. 1.6.1 Blockehain layers

(MU-New Syllabus w.e.f academic year 22-23)(M7-85) Tech-Neo Publications...ASACHIN SHAH Venture
no..(1.
Blockchain (MU-Sem. 7-Comp.) (Introductionto Blockchain)..Fage 1-24
1.6.2 Advantagesof Blockchain
--

GQ Enlistvarious advantagesand disadvantagesof


blocKCnanl
all nodes that are non-hierarchical with
Cennology works on the principle of ledgerdata distributed to
n

single central control.Removesany single point of failure by replicatingthe ledger at every node n the network.

Better communicationbetween nodes promotes transparencyand faster consensus and data synchronization.A
Allows for
multiple entities who do not trust each other to transact directly with one another.
Ensures valid and accurate data.
Removal of middleman reduces overall transactioncost.
Lontains a verifiable record of all transactions made that are auditable.
o Risk of double
spending is mitigatedbecause of consensus algorithms.
a 1.6.3 Disadvantagesof Blockchain
In certain
cases, the
traditional database may be more suitable and perform a task faster and cheaper.If a fully
functional database and network are
already
in place, then the benefits of introducingblockchain may not produce the
required returns on investment.
Nodes with high
computingpower can take control of the network, thereby impactingdecentralization.Data integrityis
obtained at the expense of time.
Every node needs to run the blockchainto verify transactionsand maintain consensus.
Enormous computing power is needed miners
by leading to substantialenergy consumption and wastage. Nodes may
select transactionswith higher rewards.
Not every node has the
ability to maintain and run a complete copy of the blockchain,thereby
immutability.In smallerblockchains,there is a risk of 51% attack (i.e., if a affecting consensus and
group of malicious nodes can get 51% of the
mining hash rate, then the group can manipulatetransactions).

1.7 BLOCKCHAINTYPES AND CONSENsuS MECHANISM

a1.7.1 Introduction
Blockchainis a digital ledger that is distributed,upheld by
consensus, immutable, and auditable.

Genesis Block CO Block-2


Block-3

Data: "Good Day"


Data Thursday" Data:
Previous Hash: 000000000 "Fingerprint"
Previous Hash: 0234ABED4 Previous Hash: A4CE23847
Hash: 0234ABED4 Hash:
A4CE23847 ( Hash:
F23847DE6
(1A37) Fig. 1.7.1

Distributed : Every node that participatesin a network has


contributetowards the processingof blockchain.
a
digital copy of the blockchain database
where all can

Consensus: Consensus algorithmsare the govemance


mechanisms to guarantee that
tamper proof. the records are
legitimate and

(MU-New Syllabus w.e.f academic year 22-23)(M7-85)


Tech-NeoPublications.ASACHIN
SHAH Venture
Blockchain (MU-Sem.7-Comp.) (Introductionto Blockchain)..Pageno...(1-25)
Immutable : Once consensus is reached based on the validity of a transaction and recorded on a blockchain,

modification or deletion is impossible.Any changes are recorded in a new block.


Auditable : Immutable record tracking with timestamp permits provenance (ability to track a transaction)of an asset at

each and every step.


third-partiesis made redundant by the direct peer-to-peer handshake within
With blockchain, the dependencyof trust on

the network of nodes.


follows
Characteristics enabling the trustless nature of the blockchain are as

that it be shared network of


only digital but also decentralized, which means can across a
Decentralization : Data is not

computers without the need for a central authorityfor making decisions.


Transparency: Data is transparent and open to everyone (i.e., anybody can view the transactions).

Privacy: The identity of a user is kept private via cryptography.


Security: Transactions are cryptographicallysecure by means of hash algorithms.
1.7.2 Decentralization and Distribution
One of the main characteristics of blockchain is
decentralization (i.e., transactions are not under the control of

any single party).


A decentralized system does not rely on a single authority.
Blockchain technology uses a decentralized peer-to-peer Nodes in a
network architecture where anybody can bé a node. Each Peer-to-Peer
Network
and every node is equal in the hierarchy with equal access
to maintain the database. In a decentralized environment,
anyone can access or write into a ledger.
Decentralizationis in-built in distributed ledger technology
(DLT), which becomes the core of blockchaintechnology. (1A30Fig. 1.7.2: Decentralized System

Distributed Ledger Technology

GQ. What is a distributedledger? -------4

A distributed ledger is a decentralized ledger of all the information that is recorded on the blockchain by consensus. In
other words, a distributed ledger technology is defined as a decentralized database that can securely record and share
financial, physical, or electronic access across a geographical network through transparent updates of information.
A distributed ledger can be considered to be a database similar to an accounting ledger where financial transactions are

recorded, except that it is not recorded to financial data. Herein, transaction refers to any digital data such as text,

images, or audio files.

The database can be distributed to all locations and can be


accessed by every single member present in the blockchain

network, thereby ensuring incoruptibility as malicious Nodes Sharing


the Workload
changes cannot be made when each node has simultaneous
access to all records.
Note that a decentralized system does not be a completely
distributed one. The below figure represents a decentralized
network where processing work is shared with sub-nodes.
(1Aa9Fig. 1.73

(MU-New Syllabus w.e.f academic year 22-23)(M7-85) eTech-Neo Publications..A SACHIN SHAH Venture
(Introduction to Blockchain)...Page no... 1-2
Blockchain (MU-Sem.7-Comp.)
Such decentralization is different from the one that is
observed in blockchain. In DLT of blockchain, a
database copy is available on every user's computer.
This database is independent of a central authority and
any changes to the ledger have to be agreed upon by
all nodes.
Such a mechanism is called as the consensus
mechanism. Once consensus is attained, the database is
updated to all nodes in the network. At any given point
in time, information is synchronized across all nodes; so,
it is referred to (1IA40)Fig. 1.7.4: DistributedLedger Technology
as distributedconsensus.

Benefits of distributed ledger technology

GQ. State several benefits of distributed


ledgertechnology.
Transparent and secure: As data is shared and visibleto all nodes, it is not easy to make any unauthorized changes.
Every node that participatesin the network maintainsa copy of the ledger, thereby preventing a single point of failure,
Any entry has to be agreed upon by all parties making a distributedledger secure and tamper proof.
Decentralized: Unlike a centralizedsystem, every node has control over his/her data. Decentralization offersusers the
power to take appropriate decisions as to what will be in his/her data record. Consensus methods help in securely
adding appropriatedata in a distributedledger, thereby offeringinnate trust in a system.
Efficient: With trustless and distributed nature of blockchain's DLT, the effort of capturing, validating, and
synchronizingindividual sets of information by mediators can be eliminated, thereby reducing the chances of human
error and improvementof operationalefficiency.
Cost savings: Disintermediatedsystems can save on additional/bottom-linecosts while realizing near-time transactions
and efficiencies,

1.7.3 Types of Blockchain

GQ Explain differenttypesof blockchain.


GQ What is a publicblockchain?Enlist few examples of a public blockchainand state its advantagesand
disadvantages.
GQ. What is a privateblockchain?Enlistfew examples of a private blockchainand state its advantagesand
--
-- - ----- -- --. disadvantages.
Distributed Databases
Block Crypto-Hashing
Buyer (transaction)
Seller

-
Buyer creates a Transaction is distributed
transaction or and validatedvia
a block Gryptographichashing Seller receives
Transaction
blockchain is committed to
and miners are rewarded
the tansacton

(1A4)Fig. 1.7.5: Publicblockchain


MU-New Sylabus w.ef academicyear 22-23)(M7-85)
Tech-NeoPublications..ASACHIN SHAH Ventue
(Introductionto Blockchain)....= Pageno...(1-2)
Blockchain(MU-Sem.7-Comp.)
At a glance, there are three major types of blockchain technologies.
where any individual can join not only join
1. Public blockchain: It is a permission-less distributed ledger technology
It is non-restrictive version where each and every peer has a
the blockchain network but also perform transactions. a

such type of blockchain if he/she has an internet connection). One of the


copy of the ledger (i.e., anybody
can access

out transactions in a
bitcoin that permitted anybody connected to the intenet to carry
1 public blockchains was

decentralized manner. Transaction place through


verificationtakes (i.e.,
consensus proof-of-work(PoW) and proof-of
transactions to make
stake (PoS)). Note that the participatingnodes need to perform heavy lifting such as validating
and solve
public blockchain work. If a public blockchain does not have the required peers in order to participate

transactions, then the blockchain becomes non-functional.

Examples : Bitcoin and Ethereum

Advantages
1. Anybody can join public blockchain.

2. Everyone feels incentivized to work towards the betterment of a public network.


3. It brings transparency to the entire network as the available data is accessible for verification purposes.

4. It requires no intermediaries to work.

Disadvantages
1. Transaction speed of public blockchain is less (ie., a transaction could be completed within a few minutes or might
take several hours).
2. It suffers from scalability G.e., the more the number of nodes that join the network, the clumsier and slow it

becomes).
3. It uses the choice of consensus method (e.g, bitcoin uses PoW, which consumes a lot of energy).
2. Private blockchain : It is type of blockchain that works in a restrictive environment (i.e., in a closed network). It is
also a permissioned blockchain that is under the control of an entity. It is suitable for organizations who only want
selected participants to access a blockchain network.
Organizations can set different parameters, such as
accessibility and authorization, to the network. Private
blockchain is similar to a public blockchain, but the only
difference is that it allows selected participants to access
the network, thereby offering such participants
transparency, trust, and security. A private blockchain is
usually centralized (i.e., only one authority manages the
entire network). (IM2Fig.1.7.6:: Private blockchain
Examples: HyperledgerFabric, HyperledgerSawtooth,and Corda
Advantages
1. A privateblockchainis relativelyfast as comparedto a public blockchain.This is because there are a few participants in
the network, which means that it takes a shorter amount of time for the network to reach consensus resulting in faster
transactions.
2. They are much more scalable.This is possible because only a few nodes are authorizedto validate transactions.For a
private blockchain, the network size does not matter. Here, centralization aspect for making a decision is of utmost
importance.

(MU-New Syllabus w.e.f academicyear 22-23)(M7-85) E Tech-Neo Publications.ASACHIN SHAH Venture


Blockchain (MU-Sem. 7-Comp.) (Introductionto Blockchain)...Pageno...(1-281
Disadvantages
They are not decentralized in a true sense.
In a private blockchain, achieving trust is difficult because centralized nodes make the last call.

Security could be an issue in a private blockehain. This could happen when a certain number of nodes compromise the
consensus method that is utilized by the private network.

3. Consortium/Federated blockchain
-.
-- -
GQ What is a consortium/federated blockchain? Enlist few examples of a consortium/federated blockchain and state its
advantages and disadvantages.
------------- --
It is a type of blockchain that is preferred by organizations who require both public as well as private blockchain
In a consotium/federated blockchain, certain aspects of an organizations are made public, while others remain
private. Note that the consensus method in a consortium/federated blockchain is managed by preset nodes. Even
though such type of blockchain is not open to mass people, it still holds a decentralized nature.
A consortium/federatedblockchain is managed by more than one
organizations.As a result, there is no one
single
force of centralized outcome. In consortium/federated blockchain, there exists
a a validator node that not only
validates transactions but also initiates or receives transactions.
The member nodes on the other hand can only receive or initiate transactions. Overall, a consortium/federated
blockchain offers all the features of a private blockchain, including transparency, privacy., and efficiency,. without a
single party having the entire power.

Manufactures/Suppliers

Logistics

Distributors

Customers
Permissioned

Service Companies

(1A4Fig. 1.7.7: Consortium/Federated blockchain

Examples : Marco Polo and IBM Food Trust

Advantages
1. Better customizability and control over resources. 2. Better scalability and offers access controls.
3. More secure and efficient.

Disadvantages
1. Even though a consortium/federated blockchain is secure, the entire network can be compromised due to a member's
integrity.
2. Less transparency
3 Censorship and enforced regulations might adversely affect network functionality.
4 Less anonymous comparedto public and private blockchain.

(MU-New SMlabus wef academic year 22-23)(M7-85) el Tech-Neo Publications.ASACHIN SHAH ture
Ven
Blockchain(MU-Sem.7-Comp.) (lIntroductionto Blockchain)...Pageno... (1-29)
Comparison between different types of blockchain
------

GQ. Differentiate between different types of blockchain.


Consortium/Federated
Parameters Public Blockchain Private Bockchain Blockchain
No.
lt is open to everyone It is controlled by owners and It is a combination of public and
1. Definition
and anyone can access is limited to certain users. private blockchain, which means

participate. some processes are kept private


and others public.

2. Cost of Costly Not so costly Not so costly


transactions
KYC needed No Yes Yes

Incentive Public blockchain Private blockchain is limited; Consortium/Federated blockchain


incentivizes participants hence, it has no similar incentives can opt to incentivize users if
to grow the network. as that of a public blockchain. they wish.

Transparency depends on how


Transparency It is entirely transparent It is transparent to only those
users who are granted access owners set rules

6. Transactioon Slow Faster than public blockchain Fast


speed
1.7.4 ConsensusProtocol
GQ. What is a consensus protocol ?

1.7.4.1 Consensus
The concept of consensus is an interesting topic in a decentralized or a distributed network. Consensus means a
procedure to reach a common agreement in a distributed or decentralized multi-agent platform.
A typical example of a consensus mechanism is shown below.
In an army there are four generals, and they are taking Atac
some kind of important decisions, and when the
generals are taking decisions in a decentralized or a
distributed way (i.e., they have their own policies to
Lake the decision), they can either make an attack or
can either retreat from an attack.
Retreat
In a consensusalgorithm,all these generalsindividually Retreat
express their opinion, and from their individual opinion
by applying some kind of a choice function, which can
be the majority of the decision in this case, the
system/environment takes an appropriate decision.
In this case, there are three generals that are making a Attack
choice to perform an attack. So, with a majority
principle, the system can come to a consensus that they
should make an attack collectively.
Such type of consensus technique is important for
a a

message passing environment in a distributed system.


(14Fig. 1.7.8 : Consensus Mechanism

(MU-New Syllabus w.e.f academic year 22-23)(M7-85)


Tech-Neo Publications...ASACHIN SHAH Venture
Blockchain(MU Sem.7-Comp) (Introductionto Blockchain)..Pageno.. (1-3n
Why consensus ?
30
In a traditional or conventional distributed system, consensus is applied to ensure reliabilityand fault toleranc
means that in a decentralized environment when there are multiple individual parties and they can take
e.
their o
This
decision, then there is a possibility that some nodes, parities, or individuals are working maliciously or own
working a AS a
faulty individual.
in such cases, there is need to
a come to a common
decision/viewpoint.So, having a common view point in n
environment where people can behave maliciously people can crash or work as a faulty way, it is a difficult thing.
or
So. under suck type
of a distributed environment,the objective is to ensure reliability,i.e., to ensure correct
in the prescence of
faulty individuals operations
The examples for in
distributed system when we consider a distributed database are as follows:
consensus a
1. Commit a transaction in a database Transactions are
taking place from multiple points of sale, i.e., from
ATMs, multiple banking sectors, the transactions are multiple
coming in and during that time consensus is a
crucial aspect. For
instance, if an individual wants to
perform a transaction from one bank branch to another account in another
branch, then during that time, it is essential to have a bank
common consensus by all the bank branches to
is a valid transaction or
not and if the transaction is
decide whether it
valid, then only the transaction gets committed.
2 State machine
replication
: It is an
impotant aspect of any distributed protocol. For instance, if an individual
run some kind of a distributed protocol over a network, every individual node runs the current version of the
wants to
and they store the store the state
of the protocol in different state machines; so, the entire execution protocol
can be part of
representedas a state machine. Now, such a state machine needs
the protocol
to be
every individual node can come to a common
that replicated into multiple nodes so
3.
point or common output of that protocol.
Distributed Clock
synchronization:Assume that you have multiple clocks in your network and
tries to find out that which is individual node
themselves and come to a
the most
updated/currentclock and so these nodes need to makeevery
consensus amongst
single clock and by applying such type of a clock
network, the nodes can perform further
operations. synchronous architecture across the
Why consensus can be difficult in certain
scenarios?
Consider a message passing
We have
system, as mentioned earlier.
multiple generals, and they are utilizing a Attack
passing environment to message
Assume that every
general and then
communicatetheir viewpointto others.
general is making a telephone call to other
Retreat
Aftack
communicatingtheir viewpointto others.
General 1 passes the information to its
generals (i.e., General 2 and General 3) via neighboring
call and specify his view
a
telephone
point that they should now
attack. Similarly, General 4 makes a
General 2 and General 3 and telephonic call to
specifies his decision that
they should now perform an attack.

Attack Attack
Attack
However, General 2 is a malicious
malicious call to General 1 and asksgeneral
who makes a Attack
for retreat whereas
General 2 makes a call to General 4, General 2
perform an attack. In says to

decentralizedenvironment,the
a
complete distributed
a or
generals mist get confused.

(MU-New Syllabus w.e.f academic year (1A45) Fig. 1.7.9


22-23)(M7-85)
Tech-NeoPublications.ASACHIN
SHAH
SHAH Ventu
Venture
Blockchain(MU-Sem.7-Comp.) (Introductionto Blockchain)..Page no... (1-31)
For example. if General 2 is informing General I to retreat, General 1 will get confused as to what he should do, so, in a
complete distributed or a decentralizedenvironment, it would be difficult to achieve consensus over a message passing
system when there are malicious nodes or after certain time the nodes begin to behave maliciously, which are called as
byzantine nodes or such failures are called byzantine failures.
In the presence of such type of byzantine failures, the system can behave maliciously or it may be difficult to achieve
consensus in a distributed environment.

a1.7.4.2 DistributedConsensus
40
10 40
G What is distributed consensus ? 10

If there is no failure in the system, then it may be easy and 30 40


trivial to reach in a consensus. A generic algorithm could be like 20 10 30 40
20

the personal choice is broadcasted to all and then a choice function


is applied saying that only that value will be considered which is 0
20
the maximum of all the received values and in this way consensus 20
****

******* *************
30
30
can be achieved.
(1A46)Fig. 1.7.10: Distributed Consensus
There are four nodes. The individualnodes make a choice of 10, 20, 30, or 40, and they inform their individual choices
to all other nodes in the network and whenever every node receives all the choices from all the neighbors, they can
apply a choice function (ie., max. function) to determine what the maximum value is. So, from the figure, it is evident
that every node will reach to the value 40 if they apply the maximum function of all the received values.
Achieving consensus in such a type of architecture is easy and straightforward. It is possible only under certain
scenarios (ie., the system needs to be faulttess there should not be any failure in the system so that every individual
node can receive the message correctly and the system should behave in a synehronous manner - all messages will be

received within a predefined time interval).


So, in the above architecture, all the nodes are expected to receive all the messages from its peers in a non-failure
environmnent withi a pre-defined period of time, and every node can wait for a specific period of time, and in a
synchronous system, it is expected that every node will receive the message and once the node receives the message,
they can determine the maximum value from all the received values and select the maxinmum value for the consensus.
However, achieving consensus can be non-trivial in case of a distributed environment due to the presence of multiple
type of failures.

Typically, in a distributed system, the following types of failures are considered.

Crash fault: A node suddenly erashes or becomes


unavailable in the middle of a communication, and so, no

message will be received from that specific node. It could


be a type of a hardware or software fault due to which a ServerA
node or a process that is communicating with another node
or process fails.
CD ServerC
Network or partitionedfaults: A network fault occurs

(e-g, link failure) and the network gets partitioned. From Server B
the below figure, we can see that there are three servers A,
B, and C, which are interconnected to each other.
(I447Fig. 1.7.11

(MU-New Syllabus w.e.f academic year 22-23)(M7-85) Tech-Neo Publications..ASACHIN SHAH Venture
Blockchain(MU-Sem.7-Comp.) (Introduction to Blockchain)...Page
no... (1.a.
(1-32
when the link between Server A and Server C fails as well as the link between Server B and Server C fails, the network

partitoned into two halves, as shown in dotted circles, and there is no message passing /communication betwe
tween
the partitionednetworks as the connectinglink has failed.
ch kind of
partition can happen in the network, and so, it is called as a partition rau
This type of network failure can hamper reaching consensus. Because of partition fault, nodes in one partitio
iion become
De atalica.
cannot
nodes in another partition for communication, and so, general consensus
rEn and network or partitioned faults take place because of hardwareor software failure
Dyzantine faults : It is a kind of fault that is more difficult to handle in a distributed environment. iere, a node start

ng maliciously, and it is difficult to interpret the nature of the node. Sometimes the node could send a positive
c or sometimes it could send a negative vote. In case of the abovementioned two faults, we can identity the effects of

a network faut
pends on the malicious
or a crash fault. Nonetheles,the effect
nature of the node. Sometimes
of a byzantine fault is
difficultto guess becaluset omplerely
a node can give a vote against the consensus or sometimes, it

gve a vote in favor of the Therefore, handling byzantine nodes becomes difficult in a
typical
d consensus.

distributed system.
U
Properties of a distributed consensus protocol
------ -.
GQ State the properties of a distributed consensus protoco
-- ---
Termination : Every corect individual decides some value at the end of the consensus protocol. In other words
whosoever is the non-faulty node in the network, the non-faulty node must terminate the protocol and decide on one

value, which is the corect value.


Validity: If all the individuals in the node proposes the same value, then all correct individuals decide on that value.

Integrity: Every correct individual decides at most one value, and the decided value must be proposed by some
individual. This property ensures that the consensus value should not deviate from the values that are proposed by
individual nodes in the network.
Agreement : Every corect individual must agree on the same value. All the individual nodes in the network must agre
on the same value. Whene ver all nodes agree on the same value after termination, we declare that the system ha
reached consensus.

s Correctness ofa distributed consensus protocol


Safety Correct individuals must not agree on an incorrect value (i.e., nothing bad has happened in the system). This

property ensures that a node will never converge to an incorrect value or the correct individuals will never converge to
an incorrect value.
Liveness : Every correct value must be accepted eventually (i.e., something good will eventually happen). If some good
values are proposed, then those values will be committed eventually, although there could be some time lag or delayin
but after the consensus protocol terminates, a consensus value is expected to be achie ved out of
reaching the consensus,

it.
While dealing with consensus, we need to deal with the following types of message passing systems.
Synchronous message passing system : The message must be received within a predefined time interval. So, we have
a strong guarantee on the message passing delay and we know in advance what can be the maximum delay of messag
passing for a particular network. Such type of message passing system offers simplificationin designing the protoco
which means that waiting for a specific amount of delay will be worth because it is assured that within that time
message will be received. Designing a distributed system in a synchronous environment is much easy because of

enture
(MU-New Syllabus w.e.f
academic year 22-23)(M7-85) Tech-Neo Publications.A SACHIN SHAH Ven
Blockchain(MU-Sem.7-Comp.) (Introductionto Blockchain)...Pageno...(1-33)
strong assumption of the message passing delay, and that is why if we wait for a certain amount of delay, it is expected
that we will receive all the messages
Asynchronous message passing system: There is no upper bound on the message transmission delay or the message
time. Here, there no time constraint, i.e., a message can be delayed for an arbitrary period of time or the
reception
message delivery time be arbitrarilylong. So, in case of an asynchronousmessage passing system, we cannot wait
can
for a finite duration to recive messages with a guaranteed probability. Designing a distributed system in an
asynchronous environment is not that easy because we do not have sufficient amount of delay. Moreover, we also need
to deal with the type of fault that may arise because of the asynchronous nature of the system. Achieving consensus in
an asynchronousmessage passing system is not that easy when comparedwith a synchronousmessage passing system.
FLP8S (Impossibilityresult) : In a purely asynchronousdistributedsystem, the consensusproblemis impossible(with
a deterministic solution) to solve if in the presence of a single crash failure. However, randomized algorithms may exist.

Synchronous consensus
There exists various consensusalgorithmsthat have been exploredby the distributedsystem community.
Raft Byzantine fault tolerant (BFT)
Paxos

Consensus in an open system

Traditional distributed consensus protocols are based on

Message passing: When individuals are connected overthe internet


Shared memory: When a common memory place is available to read and write shared variables that everyone

can access.

Limitations
of others.
Message passing requires a closed environment,i.e., everyone needs to know the identity
for Internet grade computing, i.e., at which location
should the shared memory be
2 Shared memory is not suitable
placed ?

M 1.8 LIMITATIONSAND CHALLENGES


OF BLOCKCHAIN
industries such as finance, insurance,
While blockchain has the potential to transform internet networks and numerous
There are some limitations to
healthcare, retail, media, and so on. It also faces a slew of technical and business challenges.
adoption, on its mass interoperability,technical and professional
this technology that have had a significantnegative impact
in the sense that some of blockchain's
requirements. Some of these constraints are contradictory
support, and regulatory limitations to blockchain
before it can be used effectively. The anticipated
fundamental properties must be compromised

application are listed in the followingsections.

LIMITATIONS
1.9 BLOCKCHAIN IMPLEMENTATION
--.

of blockchain?
GQ. What are the potential solutions for the scalabilityproblem --

makes blockchain technologyaccessible to all sectors is a major impediment to


The lack of a standardised protocol that
into the following categories.
its use. The major limitations of blockchain
can be broadly classified

1.9.1 Limited Scalability the


executed in the system, scalability is a significant limitation in
Because each node must validate the transactions
limited.
result, the rate at which a transaction can be processedis
blockchain network. As a

Tech-Neo Publications..A SACHIN SHAH Venture


academic year 22-23)(M7-85)
(MU-New Syllabusw.e.f
Blodkchain(MU-Sem.7-Comp.) (IntroductiontoBlockchain)...Page no...(1-2a -34
Researchers are continuing to work on distributed ledger technology based oon blockchain-like hyperle rledger fabricto
address scalability issues.
n, secunty, and decentralisation are the three components of blockchain that must be addressed. You can onlv

determine two of the three attributes example


at any given time. For
Secunty and decentralisation can be implemented, but scalability must be compromised. The Bitcoin blockchain is
having issues in this area.
Scalability and security can coexist, but security decentralisation must be sacrificed. BigTable and Cassandra are
two
examplesof such decentralisation-compromising functionalities.
3) Although decentralisation and bear the brunt, which
scalability can be prioritised, blockchain security will is
undesirable for many industries. Such characteristics include private chains. Because blockchains use a consensus
algorithm that requires all transactions to be verified, there is a limit to the number of transactions
that can be
completed in a given amount of time. There are solutions available today, such as distributed ledger technology,
that allow for more transactions per second. On the other hand, it has a negative impact on the blockchain's
transaction rate or speed.
Scalability is one of the most significant drawbacks of blockchain. Most
public blockchain consensus systems that
operate in a decentralised manner must strike a balance between minimal network
centralization.
output and a high degree of
The following is a definition of the scalabilityproblem:
(1) Every node on the blockchain network
processes every transaction and maintains a
copy of the entire state.
(2) Because inter-node latency grows
logarithmicallywith each additional node, the blockchain network
becomes less
secure as more nodes are added to its system.
(3) As the size of the blockchain increases, more storage
capacity and computational
the network works at peak efficiency. power are
required to ensure that

(4) As the blockchain grows in size, only a few nodes will be able
to process a block at some
possibility of reverting to centralization. point, posing the
The challengeof scaling a blockchaincan be comes down to two main
factors
(1) The blockchain itself expands in size as more
peaople utilise it. Each node must keep
history. The bitcoin blockchainalone has a storage of 163
a more detailed storage-
amount of data, which means that anyone starting a
Gigabytes as of March 2018. Every node must store this
bitcoin node must have at least this much
figure is only going to rise. storage space. This
() There is no incentive to be
node that manages the
a
ledger. Miners, who receive a bitcoin block
block they create and add to the chain, are the
only people who have reward for each
incentiveto keep the
an
Maintaining a node becomes more difficult and expensive for a network running.
Single person as a result of
may run the network, but nodes are in charge of
keeping the ledger up to date. these two issues, Miners
This creates challenge for any blockchain; in order to scale, the
a
network must be
corporations,and research organisationsall have diferent centralised.Developers,blockchain
solutions to offer.
being used. Sharding is one solution that is currenty
Each node in the sharding process is not required to handle all of the
split into separate shards, removing the data. The entire
need for each node to end-to-endblockchainstate can
save a subset of the state with shards. keep all of the data.
Specific nodes would only have
(MU-New Syllabus w.e.f academic year 22-23)(M7-85)
Tech-NeoPublicationsASACHIN SHAH Ventur
(Introductionto Blockchain)...Page no... (1-35)
Blockchain(MU-Sem.7-Comp.)
initiated the blockchain, they are only directed to the shards that they impact..
As a result, when transactions are on

entire state, each shard will only process a subset of it. However, in order to automatically
Rather than processing the
establish reliable connectivity across the shards, a commanding mechanism is required.
off-the-shelf hardware,
exploring the possibility of nodes running independently regular
on
Some initiatives are also
issue.
delivering completedecentralisation while also addressing scalability
the
from fast
network using Shardus (a project). The blockchain will benefit
Experts are building an all-peer-to-peer
well as security assurance, as a result of sharding and auto-scaling.
throughput, low latency, and immediate finality, as
This is supportedby a proof-of-quorumalgorithmand the Shardus DistributedLedger
As the network grows in size, this one addresses the issues of linear scalability and state sharding.

Some other potential solutions for scalabilityproblem are


witness (Segwit) is a technique for isolating transaction
(1) Segwit (Bitcoin architecture-specifie) : Segregated
transaction data, thereby removing some unnecessary weight from
signatures(i.e., "witnesses") from the remaining
the blocks.

(2) Increasing the block size (Bitcoin architecture-specific): More transactions can be stored in each block if the
transactions per second.
block size is increased. This lets the network to handle more

channels include mechanisms that allow interactions to occur within the


(3) Off-chainstate channels: These state

blockchain rather than outside of it.

top of root blockchain (ie, the main


group of smart contracts that run on a
(4) Plasma : This solution employs a
Ethereum biockchain).

(5) Off-chain computations: TrueBit is an example of an off-chain calculating solution that enables scalability
transactions across Ethereum smart contracts. TrueBit, like state channels, relies on an external layer of the
blockchain to do the heavy lifting. Off-chain computation is a notion in which all difficult mathematical operations
are handled by a layer apart from the blockchain. This will not only relieve the Ethereum Blockchain of its strain,
This computing model is not used by all
but will also lower transaction verification and processing expenses.
blockchain nodes.
Instead, only a select few will perform difficult computations in conjunction with a deposit. If the participant's
solution is correct, the participant receives both the award and the deposit. Otherwise, the deposit is forfeited.
Verifiers are also used to perform verification in off-chain computation. By adding a separate layer to the
blockchain, this approach ensures that procedures with slow transaction speeds are executed independently.
Transactions can be executed in less than a second by moving them off-chain, while information from public
ledgers has a higher level of privacy.
0 Proof-of-stake (PoS) : Instead of computing power, stakeholders vote with money (or, in the case of Ethereum.
ether). Bitcoins and Ethereum work on the Pow case, which is a system in which difficult mathematical equations
must be solved in order for the verification mechanism and transaction processing to function. As a result, the
speed of transactions on Ethereum's blockchain slows. Because PoW has drawbacks, a new proof-of-stake
mechanism was developed to achieve faster transactional speeds and higher levels of security.
The other major distinction berween the proof-of-work and proof-of-stake models is that in POs, validators do not
ean ethers but instead receive a transaction fee for their efforts. Pos will have much faster transaction speeds.
) Transient blockchain : Saito has come up with a novel solution to both isues, To avoid the growing pains of
keeping large ledgers permanently, Saito devised a transitory blockchain that deletes itself at predetermined
intervals kaown as 'Genesis Periods. A user can keep any information on-chain by paying a small fee, which is
effectively the cost of the storage that it uses. The second option presented by Saito is to provide an incentive to

nodesthat providestoragecapacityto increasethe amountof datatheycan store.Nodeswith more storage


(MU-New Syllabus w.e.f academic year 22-23)(M7-85) e Tech-NeoPublications.A SACHIN SHAH Venture
Blockchain(MU-Sem. 7-Comp.) (Introductionto Blockchain)....Pageno... (1-36)
capacity effectively become miners themselves by having the ability to claim new Saito tokens as they are issued
he more storage capacity they provide, the better their chances of receiving a large sum of money. As a result

this is similar to the probabilistic mechanism used by Bitcoin miners to spend money in order to make money.

he difterenceis that Saito, by doing work for the network, assists it in scaling. Although these technologies have
brought limited improvements to date, the fundamental constraints are due to present systems' low storage and
computingcapabilities.
Hardware scalability : The cost of hardware is
rising as the popularity of blockchain grows. This raises the cost of
entrance into mining, causing it to become more centralised. Aside from that, there are energy and economic concerns.
1.9.2 Limited Privacy
Even though identities in a distributed
ledger are anonymous, by looking at the transaction address, it is feasible to
correlate the user identity with that address and
obtain information about the user. Because anyone can create a new
wallet anonymouslyand transact through that wallet, blockchain transactions are not tied to one's status.
Tdentity verification data, like as
security numbers, cannot be stored
that is not controlled in openly in public smart contracts. Another factor
an open, ultimatelyunsecured smart contract is credential management.

1.9.3 Lack of TechnicalKnowledge


Despite the fact that blockchain is
growing increasinglypopular, most investors
various technical concepts because there is
are having difficulty understandingthe
no sufficient documentationavailable to assist customers.
As a result, investors are unable
get their questions answered. Furthermore,
to
Coin many investors are unaware of the Initial
Offering (ICO), which is well-known for raising cash in the
non-equity market.
Developers will require time to understand, explore, and
pilot any specialist technology in
educationalestablishmentsrequire time to offer new projects. Furthermore,
a result of all of
technology courses, and faculty must be trained on the
this, there is a serious lack of skilled blockchain subject. As
This scarcity of
engineers.
experienced developers and workers has a negative influence on
created as a result of their blockchain innovation.
experiencein any technology. Experts are
Accordingto statistics,there is a huge demand for blockchain
of the few available in the market. professionals,which has increased the salary
expectations
1.9.4 Security Concernsand Flaws
Blockchain is a network of people. If more than half of the
truth will be considered as a lie, and this could be people inthis network are
corrupt and distort the data, the=
one of the
must closely monitor transactionsin order key causes of network failure.
to avoid data misuse As a result,
and ensure network users
As the blockchain security.
grows in terms of nodes or blocks,
mare than half of the nodes in a corruptionamong participantsjeopardises
blockchain network validate
half of the nodes in a network anything, it is considered true. Asblockchain security.
approve a fraudulent transaction
network.Thisis known as the (false), the myth is
a
result, if more than
51% attack, and accepted
it is
serious security a
weaknessin by whole blockchain the
The biggest security challenges of Blockchainare as
follows blockchainand its uses.
a1 Spoofing of payment information : When a
user is
address with another one. Not sending money, malware
everyone observant
is may replace the
crypto wa
jumble of alphanumericcharactersand enough to double-check an
symbols. address, which is typically

(MU-New Syllabus w.e.f academic year


22-23)(M7-85)
Tech-NeoPublications...A
SACHIN SHAH ve
Blockchain(MU-Sem.7-Comp.) (Introductionto Blockchain)..Pageno..(1-37)
(2) Phishing : Exchange users may be misdirected to a phishing website, where their crypto wallet credentials may be
stolen. For example, customers may receive a fake mail in their inbox informing them of a substantial upgrade to
their cryptocurrency wallet. The notification may state that the user must sync his or her wallet with a newly hard-
forked network; if this is not done, the user will be unable to send or receive cons.

(3) Crypto wallet theft: The vast majority of investors and users keep their bitcoin wallet files on their personal
computers, making them vulnerable to malware attacks.

1.10 BLoCKCHAIN IMPLEMENTATIONCHALLENGES

The main problem with blockchain is a lack of knowledge about the technology. Particularly in non-banking areas,
there is a general misunderstanding of how it works. In addition, the following factors must be taken into account.

1.10.1 TransactionProcessingSpeed
One of the other obstacles that blockchain faces is scalability in terms of transaction processing speed. Contrary to
popular belief, the most popular cryptocurency, Bitcom, can only process an average of 7 transactions per second.
At the same time, Visa can handle 24000 transactions per second and PayPal can handle approximately 200 transactions
per second. Bitcoin Cash has a transactionrate of 50 to 60 transactionsper second, which is still low when comparedto
Visa. Among all cryptocurrencies, Ethereum is the slowest, ith only about 20 transactions per second.
Transaction speed has been hampered by the EthereumBlockchain's growing size and complexity, and transactions can
now take hours or even days to validate.The DirectedAcyclic Graph (DAG) has a solutionfor slow transactionspeeds
DAG has solved the problem by confirmingtransactionson a per-transactionbasis rather than a block-by-blockbasis.
DAG allows users to handle each other's transactions on a microscale rather than waiting for miners to execute a large
block of transactions, lowering transaction fees and increasing speed.

1.10.2 Complexity
The underlying technology of blockchain is diffcult for beginners to understand because the code contains a large
number of mathematicalcomputations.Blockchaintechnologyis stillin its infancy in termsof maturity,with numerous
new processes, standards, and unique technical elements.

Another aspect of blockchain that adds to its complexity is that it is based on decentralisation and encryption as its basic
backbone.As a result, various difficulties arise in its functionalities, such as transaction speed, transaction verification,
and data limits that can be transferred or received.
The expansion of the blockchain network introduces a new layer of complexity to the system. Blockchain, like any
other decentralised system, is susceptible to fraudulent attacks that have the poteatial to corrupt the network. A robust
network algorithm connects a large number of users and nodes to form a stable blockchain network.

a 1.10.3 Implementation and Operation Cost

Even though blockchain provides users with reduced transaction costs, the underlying technology and implementation
costs are not insignificant.Four inputs have a significantimpact on the expenses of both public and private blockchain
solutions, and they are fully dependent on the use case and the goals that a company achieves.

There are other factors to consider, but the following are the most important
(1) Transaction volume (2) Transaction size

(3) Node hosting methods 4) Consensus protocol

(MU-New Syllabus w.ef academic year 22-23)(M7-85) Tech-Neo Publications.ASACHIN SHAH Venture
Blockchain(MU-Sem. 7-Comp.) (Introduction to
Blockchain)..Page
(1-38
no.., (1.

more nodes an
Tequires a significant amount of computing power, and the blockcnan B
other connections are added. All
of this adds to the operating expenses
Ihe development of blockchain soBlutions is typically an agile process, which raises costs due tO ne involvement at

numerous Business and IT stakeholder.

1.10.4 Storage Constralnts


Because the blockchain database is append-o and immutable, data is stored indefinitely by every full node
ode in the
WOTK. AS a result, storage remains a significantchallengefor practical blockchainapplicanons,
The fundamental problem in achieving high transaction speeds in blockchain is reducing data and node load. At the

moment, each node must store the complete data set.


So. if the blockchain includes a system that allows nodes to retain only the data that is most frequently utlised or localy
relevant for transaction procesing, we can process transactions more quickly. Such methods can improve the
effectiveness of blockchain, and more research into such systems is required to overcome such storage hmits.

a 1.10.5 Lack of Governance and Standards

GQ. How does lack of governanceand


standardsaffecttheblockchain?
-----------

Numerous blockchain networks have emerged on the market as a result of the emergence of over 2000 cryptocurrencies
and thousands of applications that use distributed ledger technology. Because there are no worldwide standards for

interoperabilityamong various blockchainnetworks, they operate in silos.


As aresult, there are numerous protocols, coding languages, and consensus processes to enable these
networks,
resulting in interoperability concerms amongst blockchain networks. Ark (which uses the Smartbridges architecture) and
Cosmos (which uses the Interblockchain Communication (IBC)
protocol) are two solutions proposed to
address
interoperabilitydifficulties.
Decentralized blockchain systems do not have centralised control, and it is a completely trustless, open, and
permissionlesssystem in which no one is held accountablefor creating and maintainingstandards.At the moment, there
are no global regulatorystandards for blockchainapplications.
The blockchain can achieve lower total costs, more efficient consensus methods, and
improved interoperabilityif
standards are established. This has implications for both the issue of onboarding new
developers and blockchain
security concerns.

Because blockchain technology is based on a distributed ledger, centralised databases


will always outperform
blockchain networks. When a new block is added to the network, it must execute all of the
processes, just like a
traditional database.

It must, however, take care of new processes to ensure that


pertormanceis not jeopardised.Some of the processes that
must be completed are as follows:

) Signatureverification:Every transactionon the blockchain


mustbe digitally signed, and it must be authenticateo
using a public or private key. The validationprocess as a whole is
time-consumingand complicated.
(2) Redundancy: In ablockchain network, each node must travel and
process each intermediatenode
order to reach the target node. Nodes in a centraliseddatabase separately1
system, the other hand, can be handled in
on
without relying on any other nodes. This redundancyhas a direct paralle
impact on the performanceof the blockchain.
(MU-New Syllabuswef academic year 22-23)(M7-85)
Tech-NeoPublications.ASACHIN SHAH
Ventu
Blockchain(MU-Sem.7-Comp.) (Introductionto Blockchain)...Pageno...(1-39)
3) Attaining consensus: With a blockchain,it is critical that a common consensus is obtainedfor each transaction
completed in the blockchain network. The back-and-forth interactions required to reach consensus can consume a
significant amount of time and resources, depending on the size of the network and the number of blocks or nodes
in a blockchain.

(4) Alternative consensus algorithms: Two alternative consensus procedures are delegated proof-of-stake(DPoS)
and practical byzantine fault tolerance (pBFT). These two alternative consensus mechanisms are more appropriate
for non-financial blockchains. As of now, these methods necessitate additional research and development for a
variety of application situations.
(5) Delegated proof-of-stake (DPoS) : A small number of delegates will maintain the ledger in this approach, and
users will vote for them using a real-time algorithm. The network's throughput is significantly higher due to the
fewer active nodes. Because each node is paid through inflation, it makes sense to keep a large data centre for
network support. The disadvantage of the DPOS is that it is centralised. This means greater network control and
less ability to be transparent and open. As a result, if a user can buy more votes, they can easily control and change
the network rules to their benefit.
Every node in the pBFT algorithm authenticatesthe block's state in turn. PBFT is capable of performing a variety of
functions very efficiently, resulting in higher throughput and lower resource utilisation costs.
The disadvantage of pBFT is that it is easily vulnerable to Sybil attacks due to the low cost of adding new network
nodes. Fraudsters may be able to establish more nodes and attack the entire chain if they reach 33% of the network.
In contrast to the Bitcoin network, which requires 50% of the network to gain control, pBFT requires only 33% of the
network to gain control, making the pBFT more vuinerable to takeover.

1.10.6 Lack of Formal Contract Verification


Formal verification of smart contracts is a huge unsolved topic because it necessitates a definition of "formal proof."
Formal verification is used to ensure that the programme operates as expected.

1.10.7 Energy and Resource Consumption


The blockchain's size and number of transactions grow as more nodes are added, necessitating the need for more
resources and infrastructure to operate. Miners must validate each block in a blockchain.
The time and effort required by miners to validate the network grows dramatically as the blockchain grows in size. To
validate transactions, miners must generate a large number of mathematical solutions, which requires a significant
amount of processing power.
The average cost of running the blockchainis also significantdue to the robusthard ware architecturerequired because
each node has extreme fault tolerance to provide zero downtime and high levels of network and data security. All of this
necessitates considerable energy consumption.

1.10.8 SimplifledMining
Mining fora common blockchain cryptocurrency, such as bitcoin, has created an oligopoly problem. The vast majority
of mining power is concentrated in a few mining pools that split revenue. This directly contradicts the fundamental
principle of bitcoin and cryptocurrency decentralisation.
Ethereum is based on the proof-of-work (PoW) algorithm. Only when the validation conditions are met are the blocks
created and connected to the Ethereum network. This method ensures that each transaction is legal. Despite the fact that
this PoW technique secures transactions and transfers, it has some limitations.

(MU-New Syllabus w.e.f academic year 22-23)(M7-85) e Tech-NeoPublications..ASACHIN SHAH Venture


Blockchain (MU-Sem. 7-Comp.) (Introductionto Blockchain)..Page no...(1-4o
activity or uransactions in tha
benefit and there is no way to detect fraudulent
using this method. DAG isminers,
provides no to
OOCKChan attemptine to address this issue by defining key responsibilities tor blockchain

blockchain in this manner.


there is still to go. Miners lack the authority to manage the
s, Dut a long way
1.10.9 Human Errors
VIanual data entry errors will result in out-of-date information or data inconsistency in the database. Inus, data must be

validated before entering the system and confirmed after entering the system.
of the blockchain. Another common cause of system
parase garbage in, garbage out" refers to data in the context
C
failure is human error.
Though we can think of the blockchain as a single database with each block serving as a storage stack, the date
appended to the database is entered by humans in the first mile.
If this data is to be emror-free, it must be correctly fed at the entry point. However, no method or system exists to
validate the data that is entered to be processed within the blockchain network. As a result, trust is an issue, because
incorrect data entered into a blockchain could contaminate the data of the entire system.

Chapter Ends...
O00
Module
Tools and Applicationsof
Blockchain

Syllabus
on any of the
Corda, Ripple, Quorum and other Emerging Blockchain Platforms, Blockchain in DeFi: Case Study
Blockchain Platforms.

.6-2
6.1 Overview of Ripple.

Ga. What is ripple? Explain its payment system. ****************************as*******a***0**n********"****° **************** .6-2

6.2 Overviewof Corda.. *******


********"***s"*******uset*"***********°*°*****************
******** 6-3

GO. How contract sharing takes place in Corda?. ************


*******°********°**********a******************
6-3

6.3 Quorum Architecture. ********* ..6-5

Ga. Explain Quorum. hitecture in detail.. . *anasensnaissesnsnan** *******************************o********* *s***

6.4 Blockchainfor DecentralizedFinance(DeFi). ****** ..6-15

GQ. Write a short note on DeFi..****************************"******************"******


*********************************a********************
6-155

ChapterEnds. ******
*******************
***e******e*es*t ...6-19
Blockchain(MU-Sem 7-COMP)
(Tools and Applicationsof Blockchain)....Pageno. (6-2)2
W 6.1 OVERVIEW OF RIPPLE

GQ What is ripple?Explainits paymentsystem


Ripple is a real-time
gross settlement system, currency exchange, and remittance network created by Ripple Labs and
released in 2012.
It is
a blockchain-baseddigital payment network for financial transactions id protocol with its own cryptocurrency,
i.e., XRP. Ripple is the name of the
company and the network, and XRP is the cryptocurrencytoken.
Ripple solves the issue of high cost and longer time to settle international transactionsof the
money transfers and used by banks and financial
existing system used for
institutions dealing with curencies across the world.
With the features of low
power and low cost compared to bitcoin and
provides an easy, efficient,and instant transfer of
quick completionof transactions in seconds, it
money at low cost across the world comparedto the existing system.
The technologyis
adopted by leading banks and financial institutions includingJP Morgan and Bank of America.
Ripple relies on a common shared ledger storing informationabout all
which is used by financial institutions Ripple accounts and provides a digital portal,
and banks to join the ripple network which is called as a
A Ripple network consists ripple-net.
of two groups of
users, namely ripple network users and network members. The
users of
ripple networks are coporate, banks, and institutions that primary
only make payments.
Another group of users called network
members include bank and payment
ripple network as they process payments and providers that are the foundation of thee
liquidity.
Anyone or any business can use the portal to register and
open a gateway, which authorizes the registrantto act as the
middleman for exchangingcurrencies,
maintainingliquidity,and transferringpaymentson the network.
Ripple uses these gateways as the link in the trust chain between two
acts as the credit parties wanting to make a transaction. Gateway
intermediarythat receives and sends currencies to public addresses over the
Ripple network also works as a money exchange for all Ripple network.
types of fiat currency with the help of XRP. XRP is the
cryptocurrencythat is built for providing sources of liquidity to
payment providers and banks, which makes it
any currency to be exchanged for another. Each easy for
currency on the network has its own gateway, CAD
BTCbitstamp,and USDsnapswap. e.g., Bluzelle,
If anyone wants bitcoins
payment for the services and payer can make payment in Canadian dollars
as
not mandatory for
the payer to have possessionof bitcoins. (CAD), then it is
Instead, the payer can send the payment to the
CAD, and the service providercan receive bitcoins from his/her gateway in
gateway.
Instead of a single gateway to initiate a
complete transaction, multiple gateways are used, forming a chain of
rippling across the users. trust

Anyone includinguniversities,exchanges,and even financial institutions can become a validator


that cryptographically
confirms success or failure of each
payment and coordinates movement of funds across ledgers of
Ripple uses a consensus mechanism to confirm transactions and also prevents transactingparties.
integrityof the system.
double-spending and improves the

Transferring money with a gateway expOses the user to


counterparty isk, which is also present in the
traditional
banking system. If the gateway is not trustworthy, then the user could lose the value of their money held at that
gateway. In such situations, users must transact with a trustworthy gateway to deal with the counterparty risk
This way the "I owe you" IOU will be safely transacted through the tnrusted gateway.
Ripple also records all 1OUs in a
given currency for users or gateway. 1OU credits and transactions occurring berween Ripple wallets are publiclv
available on the Ripple consensus ledger.

U-New Syllabusw.e. academicyear 22-23) (M7-85) aTech-NeoPublications...ASACHIN SHAH Venture


Blockchain).. Pageno. (6-31
(Toolsand Applicationsof
Blockchain(MU-Sem7-cOMP) blockchain, but these details are not made
available on a
t ecoras Tinancial transaction history publicly, and it is made blockchain makes the information
dealings on the
avalable to any individual or business. However, the record of all

susceptible to de-anonymization measures.


The Ripple system is revolutionary technology for Bank B
BankA
transferring large amounts of money across the world and
can handie large amounts of transactions (-1500/second).
It is useful to large corporations like Amazon or Apple
who spend millions around the world. XRP is created
Bidirectional Messaging
with a total of 100 billion, and 45 billion are in
supply
circulation and remaining are held by the Ripple labs. Messenger
Messenger
Most of the banks signed up to RippleNet were using
XCurrent to process the transaction and avoid
Ripple's
the XRP cryptocurrency due to its volatility problems.
xCurrent is a messaging technology that enables banks to
Real Time
with increased Real Time
and settle their transactions Settlement
message Settlement
speed, transparency., and efficiency with RippleNet Ripple Network
Validator
members. xCurrent is a messaging module that facilitates
bidirectional communication between banks connected
(106)Fig.6.1.1: Ripplepayment system
on RippleNet. and
risk and compliance, fees, FX rates, payment details,
Messenger is usedexchange information regarding
to neutral
built around LP, which is
an open,
the transaction processing. It is
expected time of funds delivery during networks. The solution provides a secure,
that allows interoperation between different ledgers and payment
protocol information redundancy.
endto-cnd payment flow with transaction immutability and

6.2 OVERVIEWOF CORDAA

How contract sharing takes place in Corda?


that facilitates businesses
R3.It is a permissioned-type blockchain platform
Corda is open source DLT developed by
an and
Corda is supported by world's largest technology
to transact value directly
under strict privacy with one another.
banks.
services (AWS), Intel, Microsoft, and world's largest
organizations like Amazon web
business with an aim of
financial institutions only, but later it opened for others
Corda was initially designed for
on a single global distributed ledger.
Corda is designed considering privacy as its prime
bringing al types of businesses
requirement.
details of
only parties involved in the transaction have access to the
such way that
privacy is implemented in
a
In Corda, share
two or more parties can perform transactions amongst themselves and
transactions. In other words, with Corda,
transaction instead of broadcastingto other members in the network.
to the parties involved in the
necessary details only
can be
These transactions are
recorded on a ledger legally binding all the parties involved in the contract, which
case of a dispute. Corda provides assured identity of participantson the network
with the
produced as an evidence in
and identity management features.
help of its KYC requirement
Corda partnered with Microsoft to provide its services with Azure, and it is also accessible from AWS to use
i

Messaging in Corda is similar to the email system, and its privacy can be understood with the example given
tracts
Fig. 6.2.1,which is representingdifferent users and the shared contract. There is no single central storage, and
are not shared with all the nodes in the system.

(MU-New Syllabus w.e.f academic year 22-23) (M7-85) Tech-Neo Publications...A SACHIN SHAH Venture
Blockchain(MU-Sem7-COMP)
(Tools and Applicationsof Blockchain)...Pageno. (6-4
Let consider the example of users B, C, and D who
us 2
common contract 3, which is unavailable
are
sharinga
to user A, and contract
5 is shared between users C and
D, and communication related
with contract 5 is not shared with
remaining users A and B. 2
Consider the application where
the seller of a
want to reveal the
product does not 5
identity of its consumers to its competitor. In
such scenarios, sellers can
perform transactions without sharing
details to other parties ,which are not involved in
the transaction.
Corda is scalable and
supports billions of transactionsdaily across
the
industry and allows interoperability Users: A, B, C, D Contract: 1,2, 3, 4,5
applicationscoexistingtogether on the network. amongst multiple
Corda is architected in such
(107)Fig. 6.2.1: Cordacontractsharing
way that different versions of corda can coexist on the same
a
will continue
running on the later versions. Corda contracts involve external facts network, and applications
like share price, interest and conditions governing contracts
rate, FX conversion,etc.
These details are
kept off-chain and provided by trusted oracles.
provides consistent, transparent, and resilient Consensus pool (notary node) in the Corda architecture
prevents the double-spending unique consensus services, and Corda's UTXO
state machine model
problem.
Corda allows
businessesand individuals to perform transactions
broadcastingover the network. The parties involved in the privately concerning only members involved withouut
highly scalable. Developerson Corda use transactionsare legally identifiableon the
network wide standardsto network, which is
Similar other blockchain
to develop interoperableapplications.
networks, Corda, transactionsare
in
global broadcast instead it prefers cryptographically
upon, but it does not permit chained to the transactionsit
depends
transaction to authorized parties whose peer-to-peermessage sending and avail informationof
assured identity is maintained. All
maintains a global ledger messages on Corda are encrypted, and it
includingall transactions.
Quorum is an Ethereum-baseddistributed
network with transaction ledger protocol that allows for the creation of
privacy support. J.P. Morgan Chase created the a
permissionedblockchain
use cases; it was
recently acquired by ConsenSys. open-source project with a focus on financial
Quorum introducedinto the larger
was
ecosystemof permissionedblockchainsto address the
Carry out private transactionsas well as smart contract following requirements:
operations.
Implementmultiple consensus mechanismsin a
plug-and-playmanner.
o
Manage network permissionsin a flexible and expressivemanner.
Quorum is modelled after the official Go
choice is that by minimizing implementationof the Ethereum protocol (geth).The
changes to Go-Ethereum,future versions of the public Ethereum reasoning behind this
maintained Each Quorum node providestwo code base can be
primary services. easily
Quorum Client: This is the extended geth client that is
protocol (by acceptingconnectionsonly from
in-charge of executing the Ethereum
permissionednetwork participants)and the consensus peer-to-peer (p2p)
2.
Privacy Manager : It is
software module that allows for private transactions and
a
algorithm.
is made private smart contract operations.It
up of two parts, i.e., the transactionmanager and the
crypto enclave. Because of its
auditable, and immutable characteristics,blockchain or distributed ledger cryptographicallysecure,
provides a secure, shared platform for
decentralizedapplications(Dapps) and data. However, for a blockchainto be suitable for
ariven enterprises,several enterprise-
requirements must be met. Privacy, performance, and permissioning are the most
requirements. important of these

MU-New Syllabus Tech-NeoPublications...ASACHIN SHAH Venture


w.e.f academicyear 22-23) (M7-85)
Blockchain).. Pageno.(6-5)
(Tools and Applicationsof
Blockchain(MU-Sem 7-COMP) health care, law, and
industries, including finance,
confidentiality: It is a requirement in many confidential and shared
Ensures transaction
transaction details
be kept
it is required that
government. In the financial industry, for example,
transaction.
only with the authorized parties involved in the that should only
be accessed by
information
records extremely sensitive use cases.
Similarly, in the medical field, patient
are
are adequate
for handling enterprise
that the network's speed and scalability
authorized personnel. It ensures

accessible to authorized entities.


only
Ensures that the blockchain network is
case.
All of the requirements listed above are critical in any enterprise use achieves them. First, we
take look at how Quorum
the basics of enterprise features, let
us a
Now that we have covered

will go over the Quorum architecture.

6.3 QuORUM ARCHITECTURE

GQ Explain Quorum Architecturein detail.


which are listed below.
to public Ethereum, offers several enterprise features,
Quorum, in comparison
Transactionprivacy
cases
mechanisms appropriate for enterprise use
A variety of pluggable consensus

for network nodes and participants


Enterprise-grade permissions management (access control)
Ethereum client that has been
enterprise features. In a permissioned
enhanced with
Quorum is essentially public a
Off-chain privacy is
privacy features, enterprise permissioning, and improved performance.
network, it provides communicates with the private transaction
transactions manager. Quorum
provided by a component called private relevant state trees.
on the blockchain with
over HTTPS and maintains a reference to private transactions
manager
The figure below depicts the high-levelarchitecture
Enterpriseintegration

Quorum node Privacy manager

JsON RPC
DAPPs Enhanced Pluggable HTTPS
Transaction
RPC API consensus Enclave
manager
Wallets Access control
(permissioning)

Public state Privatestate Local store


Enhanced P2P
P2P to other transaction
manager nodes
P2P to other
Quorum nodes

Fig.6.3.1:Quorum high-level architecture

Quorum node
of geth. Because it is a fork of geth, it continues to benefit from the ongoing research
The Quorum node is a small fork
and development within the ever-expanding Ethereum community as well as the incredible work of the geth development
tandem with Geth releases to reflect the most recent enhancements.
team. As a result, Quorum is regularlyupdated in

(MU-New Syllabus w.e.facademic year 22-23) (M7-85)


a Tech-Neo Publications..ASACHIN SHAH Venture
Blockchain(MU-Sem7-COMP)
The Quorum node differs from the public
(Toolsand Applicationsof Blockchain)..Pageno.(6-6)
geth client in the following ways:
Instead of using PoW, the consensus is achieved
algorithms.Because all of these differentprotocolsusing RAFT, proof-of-authority(PoA), or Istanbul BFT
are available, it is
consensus
business requirements. possible to select any of these algorithmsbased on
The p2p layer has been modified to allow connections
only to and from permissionednodes.
The block generation logic has been
changed to replace the'global state root check with
check. a
new'global public state root
The State Patricia trie has
been divided into two
The block
parts, i.e., public and private.
validationlogic has been
public state root."
changed to replace the phrase "global state root" in the block header with
"global
The block validation
logic has been changed to accommodatePrivate
Transactioncreation has been modified to
Transactions.'
allow transactiondata to be
necessary to preserve private data. replaced by hashes of encryptedpayloads where
The Gas
pricing has been removed, but the Gas itself remains.
Quorum is compatible with both
public and
public Ethereum, whereas private transactions private transactions. Public transactions operate normally, as they do in
are enabled
manager (privacy manager).Nowthat we have by a separate component known as the
introducedthe Quorum node, let's look at the private transaction
Privacy manager privacy manager.
On the Quorum
network, the privacy manager
transaction privacy. In other words, this component (private transaction manager) is in-charge of
component enables Quorum nodes to ensuring
authorized transactionparties. It is made securely share transaction
payload between
up of two parts, i.e., the transaction
manager and the enclave.
Transaction manager
It is arestful and stateless service that is
primarilyin-chargeof the following
Automaticallydiscovers other transactionmanager nodes on the networkoperations:
Exchangesencryptedpayloads with transaction managers on other nodes
Stores and allows access to
encrypted transactiondata
There currently two types of transaction managers available. i.e., ConstellationSMand
are
the original Haskell TesseraSM. Constellationis
privacy manager. It is no longer being developed in favor of Tessera, a more
developed project. As a result, this report focuses solely on Tessera. The transaction feature-richand actively
manager is a
mechanism for securely exchanging data. It is
analogous to a network of message transfer agents (MTAs) general-purpose
in which pretty
good privacy (PGP) provides message encryption.The private transaction
manager is a non-blockchain
used in any
applicationthat requires individuallysealed and secure message exchangeacross a network oftechnology.It can be
Tessera participants.
Tessera is a transaction manager for enterprise. It is a Java-based stateless software that allows
Quorum to encrvot.
decrypt, and distribute private transactions.
A Tessera node is responsible for the following tasks:

Generates and hosts a large number of public/privatekey pairs


Discovers all nodes on the network (i.e., their public keys) automatically by connecting to as few as one other
node.
Supports various trust models such as trust on first use (TOFU), P whitelists, and certificate authorities.
JDBC client.
t can connect to any SQL database that supports the
(MU-NewSyllabus wef ademicyear 22-23) (M7-85) Tech-NeoPublications..ASACHIN SHAH Venture
no.(6-7)
(Tools and Applications of Blockchain)..Page
nodes.
Biockchain(MU-Sem7-COMP) hosts with
other network
associated with recipient
Synchronizes a directory of public keys
nodes.
communication between Tessera peer
for
O
Provides a public API
with Quorum nodes identifier in return.
Provides a private API for communicating content-addressable
and receive a transparently
to one or more public keys is encrypted
you to
send a byte string nodes, this byte string
hash digest of the
Allows

over the wire to the correct recipient identifier is a


being transmitted The
Before those nodes). small blob
speeds) (and only node receives a

and efficiently (at symmetric encryption each recipient


recipient node. In addition,
encrypted payload received by each encrypted payload.
which contains the master key for the by a node can be
encrypted for their public key,
received
sent or
identifier. Payloads
based on an
Enables the reception
of a decrypted payload
retrieved in this manner. Directory/Maildir style
decrypted and SQLite, and
Level DB, Berkeley DB, for AWS S3.
backends, including for example,
Supports a variety of storage FUSE adapter,
in Userspace
file storage that can be used with any Filesystem (using modern cryptography),
PGP encryption
hybrid of a distributed key server,
Tessera can be thought of as a

and mail transfer agents (MTAs).


authentication, participant
Enclave for transaction
used in distributed ledger protocols linked data). To
achieve
techniques are commonly
Cryptographic chain of cryptographically
and historical data preservation
(i.e., through a such as symmetric key
authentication,
the majority of cryptographic operations,
of concerns," the Enclave handles is improved through
modularization,
result of this separation, security
"separation
encryption/decryption. As a
generation and data of certain cryptographic
op rations.
parallelization
and performance is improved through independently managing cryptography
with the transaction manager to improve privacy by An enclave
The Enclave collaborates
HSM" separate from the rest of the system.
and functions as a "Vitual
operations. It stores private keys information is handled by the enclave:
transaction manager. The following
communicates with its own
only
Public/Private key access

Extra recipients' public keys


Public/Private key access

that an enclave performs:


The following are the specific operations
node's default identity (default public key)
Obtaining the attached
for all transactions
Providing forwarding keys
the enclave
Returning all public keys managed by
attached node's default identity (default public key)
Obtaining the
for all transactions
O Providing forwarding keys
the enclave
Returning all public keys managed by
payload for a given sender and recipient(s)
Encrypting a

O Encrypting raw payloads for a given sender


Decrypting given recipient (or sender)
transactions for a

architecture of Quorum, let's look at how it achieves all of the enterprise features
Now that we've covered the high level
we discussed earlier.

Private transactions
We'll look at how Quorum supports key enterprise features like privacy, performance, and permissioning.

academic year 22-23) (M7-85) elTech-Neo Publications...A SACHIN SHAH Venture


(MU-New Syllabus w.e.f
Blockchain(MU-Sem7-cOMP) (Tools and Applicationsof Blockchain)..Pageno.(6-8))
As previously stated, private transactions in Quorum are supported by an off-chain mechanism known as the Privacy
transaction manager. We will now describe how the privacy transaction manager works to enable private transactions
with an end-to-end example. This example demonstrates how all components of Quorum collaborate to provide privacy
features.
Before we get into the example, keep in mind that Quorum not only supports private transactions but also standard
public transactions. Al transactions, as usual, must be signed by the sender. Quorum has two transaction signing
mechanisms. The Ethereum EIP-155 based transaction signing mechanism is used for public transactions, and the
Ethereum Homestead based transaction signing mechanism is used for private transactions. Furthermore, Quorum
supports raw private transactions, which means that transactions can be signed externally without the use of Quorum's
signing mechanism. This feature provides more flexibility and security.
Consider three parties, A, B, and C. A and B are aware of a transaction known as 'AB, but C is not. We now look at the

transaction flow from the view of each of these parties.


View of Parties A & B

PartyA

H Quorum node A Transaction


DAPP managerfornode Enclave for node A
4.5
Public Private
via HTTPS
Tessera REST
Ethereum P2P

Block Block Block Ethereum P2P-The hash


ACK/NACK
-Encryptedpayload
-Encrypted symmetric
key
Party B
Quorunm node B Transaction
DAPP managerfor node Enclave for node B
Public DE
Fig. 6.3.2 : Parties A &B

Lookingat the above figure, we can deseribe the process step by step as presentedbelow:
1. Party A sends a transaction to their Quorum node, indicating the transaction payload and specifying private for to be
Party B's public keys. It is optional for party A as well.
2. Party A's Quorum node sends the transaction to its paired transaction manager, requestingthat the transactionpayload
be stored.
3. The transaction manager of Party A contacts the associatedenclave to validatethe
sender and encrypt the payload.
Party A's enclave validates Party A's private key and, if valid, processes the transaction.
5. Party A's encryptedpayload'sSHA3-512 hash
transaction manager computes the and stores the encryptedpayload and
encryptedrandom master keys (RMKs) againstthe hash in the database.
6. The transaction manager of Party A then securelytransfers (via HTTPS):
The encrypted payload
RMK encrypted with the shared key generated by the enclave processing in Step 4.

The nonces to Party B's transaction manager.

(MU-T Syllabuswe.f academicyear 22-23) (M7-85) Tech-Neo Publications...ASACHIN SHAH Venture


Blockchain)..Page no. (6-9)
Blockchain(MU-Sem 7-COMP) (Tools and Applicationsof
(NACK) from Party B, then
lt should be noted that if Party A does not receive response/a negative acknowledgement
a
payload De stored by the
to the network. It is required that
the communicated
the transaction will not be propagated
recipients.
manager returns the
Party A's transaction
1. After successfully transmitting data to Party B's transaction manager, the VV
with that hash. It also changes
hash to the Quorum node, which replaces the transaction's original payload
hash represents a private
37 38. This value indicates to other nodes that this
value of the transaction to or
with nonsensical bytecoae.
transaction encrypted payload rather than a public transaction
with an
The transaction is then broadcast to the rest of the network via the Ethereum P2P protocol.

3. A block containing transaction AB' is created and distributed to all network parties.
View of party C

Block

Farty C Transaction
Quorum node C manager for node Enclave for node C
DAPP C
Public Kivate DE
C
Fig. 6.3.3:Party
which identifies
to process the transaction. A V value of 37 or 38,
When the block is processed, all parties will attempt
each Quorum node.
the transaction as a private transaction whose payload requires decryption, will be recognised by
transaction. The hash is
transaction to see if they are the owner of the
The node then queries their associated manager
used as the index for this lookup.

C will receive NotARecipient message and will skip the update its Private StateDB
Transaction. It will not
Party a

will look up the hash in their respective transaction managers


because it does not own the transaction. Party A and B
After that, each transaction manager will make a call to its paired
and discover that they do indeed own the transaction.
enclave, passing in the encrypted payload, encrypted symmetric key
(RMK), and signature.

View of Party B

Block

Quorum node B Transaction


manager for node Enclave for node B
DAPP
Public Private

Fig. 6.3.4:Party B

The enclave validates the signature,then decrypts the symmetric key with the party's private key stored in the enclave,
1.
now-revealed symmetric key, and returns the decrypted payload to the
deerypts the transaction payload with the
transaction manager.
The decrypted payload is then sent to the EVM by the transaction managers for parties A and B for contract code
2.
execution. This execution will only update the Quorum node's Private StateDB.

(MU-New Syllabus w.e.f academic year 22-23) (M7-85)


al Tech-Neo Publications.ASACHIN SHAH Venture
Blockchain (MU-Sem7-cOMP)
What happens inside the enclave? (Tools and Applicationsof Blockchain)...Page
no. (6-10
Now we expand on Step 4 from above, which
involves enclave processing.
Node A
Transaction Sends payload
manager
Encryption,decryption request
Enclave
(Virtual HSM)
The Encryptedtransactionpayload
Encrypted SHA3-512 hash the
transactions Encryptedsymmetricofkeys encrypted
for each payload
recipient Encrypts
payload
Naci

Node A
Usingxsalsa20poly1305 Using curve25519xsalsa20poly1305
Transaction to produce
Payload oontainer to produce
manager Enclave |Recipient box boxed packets(orypto_box)
Payload
SHA3 Hash encryptedwithl Random Master key
for payload
symmetric key nonce
containeer

Fig.6.3.5:Enclave processing
"Party A's Enclave validates Party A's
This
private key and, if validated,processes the transaction. "

procedureconsists of several steps:


1. Create a random master key
2.
(symmetrickey) and nonce.
Use the
symmetric key generated in step 1 to
using the authenticatedencryption encrypt the transaction payload. The payload container is
created
algorithm xsalsa20poly1305.It is based on the Salsa20
poly1305 universal hash function. The 'crypto box' is stream cypher and the
created with a public-key
that combines three
constructs: Curve25519,
XSalsa20, and Poly1305.3.1. authenticated-encryptionscheme
3. Compute the hash (SHA3 512 bit) of
4.
the previouslyencryptedpayload.
Using the recipient'spublic key to
encrypt the
recipientone at a time. In our example, it only symmetric key from Step 1. This
procedure is repeated for each
5.
applies to Parties A and B.
Enclave returns three objects to the
transactionmanager.
Encryptedtransactionpayload from Step 2
Hash from Step 3

Encryptedsymmetric keys for each recipientsfrom Step 4


OtherElliptic curves are also supportedby Tessera for the creation of
and decryption. Tessera also works with public/privatekey pairs as well as data encryption
external hardware security modules
management. Tessera's support for external key vault integrationwith (HSMs) and cloud-hosted key
third-party key vaults such as Azure,
and AWS is a notable feature. This feature enables fully
decoupled and dependablekey management. Hashicorp,
Enterprise-gradeperformance
Quorum includes several appropriateconsensus mechanisms for enterprisenetworks. When
mechanism on public blockchains like Bitcoin and Ethereum, these consensus compared to a typical Pow
and higher transaction
algorithms provide immediate finality
throughput.
An
independent performanceevaluation study reported a transaction per second (TPS) speed of
TPS. approximately2500
Inanother study, the transaction throughput of private contract deployments was measured to
be approximately700
TPS, and the performance of normal transactions was measured to be approximately 2000 TPS.

10-New Syllabus w.e.f academic year 22-23) (M7-85) Tech-NeoPublications...ASACHIN SHAH Venture
Blockchain)..Page no.(6-11
Blockchain (MU-Sem7-COMP) (ToolsandApplicationsof

Quorum is a good choice for enterprise use cases because of its improvedperformance
Enterprise permissioning mechanism
grade scheme used for
mechanism is common and standard enterprise
The role based access control (RBAC) a

level control.
providingorganisational access
to enterprise systems. It
control mechanism
is a de facto mechanism for providing a common enterprise grade access
t
such as Windows and RedHat,
in operating systems
1S used in a lot of business systems. RBAC is also implemented
demonstrating its industry-wide acceptance and usability.
as standard RBAC. It
on the same principles
Quorum implements a modified subset of the RBAC standard. It operates
over who can join the
ensuring the necessary control
well as rule-based permissioning,
provides role-based access as

network and how it can be operated.


must first define some terminology.
To better understand Quorum's permissioning features, we

that represent an enterprise blockchain.


Network: A collection of interconnectednodes control permissions.
and nodes with network
access

Organization : A collection of roles, Ethereum accounts,

A sub-organization is a group within a larger organisation.


Account: An Ethereumexternally owned account (EOA)

Voter: An account with voting privileges.


within organisation.
Role: A specificjob function an

organisation or a sub-organization.
and belongs to an
Node: A geth node that is a member of the network
actions that an account is permitted to carry out. (for example, value
Permission: A description of the types of
smart contract deployment, or smart contract execution)
transfer,

Roles Nodes
Nodes
Accounts
SubOrg1
Accounts
Organization
Network
Roles Roles Nodes
SubOrg2
Accounts
Voters

Organization 2 Organization 3

Fig. 6.3.6:Quorum permissioningmechanism

using smart contracts and some client software changes. As a


The quorum permissioningmechanism implemented
is
two parts, the first of which deals with the access control decision output, which
result, this model is divided into
a decision about
whether or not an account is permitted to perform a function.
represents
charge
it is implemented in the Quorum client software. The other component is in
This is the 'enforcement logic, and this
associated with the permissioning logic. Based on the roles assigned to an entity,
of managing the underlyingrules
an access control decision.
"rule engine" generates
22-23) (M7-85) aTech-Neo Publications..A SACHIN SHAH Ventu
(MU-New Syllabus w.e.f academic year
Blockchain(MU-Sem 7-cOMP)
It defines what
(Tools and Applicationsof Blockchain)...Pageno. (6-12
anobject can and cannot do on a blockchain
network. This is referred to 'policymanagement. a
as
component is fully implementedusing solidity
language smart contracts. Both of these
form the Quorum permissioning mechanism. components work together to
The quoum permissioning mechanism is
currently used in conjunction with the RAFT, IstanbulBFT, and POA
consensus mechanisms. The network in the Quorum permissions model is made up of various organisations, as
illustratedin Fig. 6.3.7. The network administrator
account(s)defined at the network level have the authorityto propose
and approVve new organisations requesting to join the network. They can also grant administrative privileges to an
account to the
administrationaccount for an organisation.
serve as

The organisationadministrator account can


perform the functions. following
Create new roles
Create sub organisations
Assign roles to its domain accounts
Add new nodes to the organisation.
A Sub-organization can also have its own set of roles, accounts, and sub-organizations. The organisation administration
account manages and controls all organisational activities.
To allow a different account to administer the sub organisation, the organisation administrator can create an
administrator role and assign it to that account.
The role assigned to an account determines its access rights. An administrator role, for example, can execute a smart
contract, whereas a trainee role can only read. An account that exists at the organisational level can transact through any
node that exists in the sub-organizations beneath or at the top-level organisations.

Network
Node(s)
STATUSES
Organization(s)
User Account s)
External off-chain 1:M, M:1,1:1 ROLES
entity STATUSES

Fig. 6.3.7 : Relationship between different entities in Quorum permissioning model

This architecture is depicted in Figure 7, where the network is the top level entity, containing an organisation or several
organisations, each of which contains accounts and nodes as well as relevant access and status types.

Also, keep in mind that the user is an external entity that exists outside of the network. It could be a company or a single
user. The key concept here is that in the permissioning mechanism, a user is mapped to Ethereum accounts, It can he
one-io-many, many-to-one, or one-to-one relationship. A single organisation, for example, represented by a username,
the blockchain.
can be linked to multiple accounts on

Similarly, multiple external entities can be represented on the chain by the same account. A single user can be assigned
to a single account. The benefit of this approach is that there is no need to keep on-chain records of users, which not

costs but is also inappropriate for privacy reasons.


only incurs high storage

MU-New Syllabus w.e.f academic year 22-23) (M7-85) Tech-Neo Publications...ASACHIN SHAH Venture
Blockchain)...Page no.(6-13)
Blockchain(MU-Sem 7-COMP) (Tools and Applicationsof
level, whereas nodes are assigned
their business function and
access
ACcounts are assigned roles and statuses based on

statuses that represent their network access level.


entire organisation needs to be
useful when an
Statuses can also be assigned to organisations. This feature is especially

assigneda network status, such as when an organisationleaves the network.


to al_entities wthin that
The administrator can simply assign suspended status to the organisation,which will apply
organisation, including accounts and sub organisations.

Consensus

There is no need for an expensivePoW consensus mechanism because consortium chains are permissioneca.

mechanisms are unsuitable for consortium


Furthermore, due to performanceconstraints, slower public chain consensus

chains. As a result, Quorum provides various consensus mechanisms that are better suited for private blockchains.

These mechanisms are detailed further below.

o RAFT-based Consensus: A crash fault tolerant (CFT) consensus model for faster
block generation,transaction
finality, and on-demand block generation.
Istanbul BFT Convergence: It is a BFT algorithm that is based on the Practical Byzantine Fault Tolerant (PBFT)
o

consensus algorithm. It allows for immediate transaction completion. It guarantees liveness and safety under
and 3f + 1 in 3f + 1
standard Byzantinefault threshold assumptionsof in a partiallysynchronousnetwork a

network configuration.
o
Clique Consensus: Clique is a POA consensus algorithm included with the public Go Ethereum client (geth).

Use cases of Quorum

Quorum is used in a variety of applications, including logistics, healthcare, identity, property. payments, capital
markets, and post-trade.

Some of the projects are listed below, along with a brief description:

1. Tokenised cash: Developed by IHS Mark it, this is a distributed ledger that records all cash transactions.

2. JPM Coin: Created by J. P. Morgan, it is intended to allow for the immediate settlement of transactions between
clients of the bank's wholesale payments business.

3. Loan Marketplace: It is a decentralised loan marketplace. Stream Source technologies created it.

4. Proxy voting increases transparency in AGM voting between issues and investors.

5. Post-trade processing platform: An oil trading post-trade processing platform.


6. Interbank Information Network IN): IN enables network members to exchange information in real time to

verify payments.
7. Supply chain tracking: A cryptographic provenance platform that allows the authenticity of high-priced goods to

be proven.

8. Physicaltrackingof gold bars and title deed registrationMed ledger: Counterfeitmedicinedetection.

(MU-New Syllabusw.ef academic year 22-23) (M7-85) Tech-Neo Publications..ASACHIN SHAH Venture
Blockchain (MU-Sem 7-COMP)
(Tools and Applicationsof Blockchain)...Pageno...
(6-14)

(MU-New Syllabus w.e.f academic year 22-23) (M7-85) Tech-NeoPublications...ASACHIN SHAH Venture
Blockchain (MU-Sem7-COMP) (Tools&Applicatlonsof Blockchain)..Pageno. (6-15)

M 6.4 BLOCKCHAIN FOR DECENTRALIZEDFINANCE (DEFI)


------- -------- ---.

GQ. Write a short note on DeFil

What is DecentralizedFinance (DeFi)?


Decentralized finance, also known as DeFi, refers to the transition away from traditional, centralized financial systems
and toward peer-to-peer finance enabled by decentralized technologies built on the Ethereum blockchain. The DeFi
ecosystem has launched a vast network of integrated protocols and financial instruments, ranging from lending and
borrowing platforms to stablecoins and tokenized BTC.
DeFi has emerged as the most active sector in the blockchain space with over $13 billion in value locked in Ethereum
smart contracts and a wide range of use cases for individuals, developers, and institutions.
Whereas our traditional financial system is based on centralized infrastructure that is managed by central authorities,
institutions, and intermediaries, decentralized finance is powered by code that runs on the Ethereum blockchain's
decentralized infrastructure. DeFi developers can launch financial protocols and platforms that run exactly as
programmed and are accessible to anyone with an Internet connection by deploying immutable smart contracts on
Ethereun.
DeFi's breakthrough is that crypto assets can now be used in ways that fiat or "real world" assets cannot. Decentralized
exchanges, synthetic assets, and flash loans are entirely new applications that can exist only on blockchains. This
paradigm shift in financial infrastructure offers several advantages in terms of risk, trust, and opportunity.

a 6.4.1 Features of DeFi


DeFi can be viewed as the most realistic use of blockchain because it incorporates its features, such as:
1. Eliminate third parties: DeFt entirelyeliminatesthird parties,eliminatingthe need for a bank, financialinstitution,or
other middleman like traditional finance, allowing customers to keep ownership of their money. Any disagreements will
be settled in a predetermined way.
2. Smart contract: Indisputable logic code on the blockchain network, as opposed to human intervention, is used in a
general way of eliminating third parties. Smart contracts frequently help DeF.
3. Automation: Utilize smart contracts to streamline the procedure while maintaining each contract's responsiveness and
accuracy.
4. Cost savings: Cutting costs in the role of lawyers, personnel to perform contracts.
5. Autonomy: Once involved, stakeholders are only bound by the terms they have accepted in the smart contract and not
to any other exiternal authority. Additionally, because of this feature, neither side may modify them. guaranteeing the
safety and security of contractual agreements.

What are the benefits of Decentralized Finance?


DeFi uses key Ethereum blockchain principles to improve financial security and transparency, open up ligquidity and
erowth opportunities, and support an integrated and standardised economic system.
Programmability: Smart contracts with high programmabilityautomate execution and enable the creationof new
financial instruments and digital assets.
Immutability: Tamper-proofdata coordination across the decentralizedarchitectureof a blockchainincreasessecurity
and auditability.

(MU-New Syllabus w.e.f academic year 22-23) (M7-85) Tech-Neo Publications..A SACHIN SHAH Venture
Blockchain(MU-Sem7-COMP)
Interoperability:The modular software stack of (Tools &Applcationsof Blockchain)..Pageno.(6-16)
integrate and complementone another. Ethereum ensures that DeFi protocols and
applicationsare designed
interfaces, and
Developers and product teams can build on
top of existing protocols,customise
integrate third-party applications with DeFi. As a
"money legos." result, DeFi protocols are frequently referred to as

Transparency : Every transaction on the


public Ethereum blockchain is broadcast to and verified by other netwOTK
users (note: Ethereum addresses are
encrypted keys that are pseudo-anonymous).This level of transparency in
transaction data not only enables rich data
analysis, but also ensures that network activity is accessible to all useis:
Ethereum and the DeFi protocols that run on
it are also built with open source code that
extend. anyone can view, audit, and

Permissionless: Unlike traditional finance, DeFi is distinguishedby its open,


erypto wallet and an Internet connection,
permissionless
access:
anyOnc
regardless of location and frequently without a minimum amount olwlus
required, can access DeFi applications built on Ethereum.
er-ustody : DeFi market participants maintain custody of their assets and control of their personal data by
nieracting with permissionless financial applications and protocols via Web3 wallets such as MetaMask.

What are the use cases for DeFi?


Decentralized finance protocols, ranging from DAOs to synthetic assets, have opened up a world of new economic
activity and opportunity for users all over the world. The extensive list of use cases provided below demonstrates that
DeFi is much more than an emerging ecosystem of projects. Rather, it is a comprehensive and integrated effort to build
a parallel financial system on Ethereum that rivals centralized services in terms of accessibility, resilience, and
transparency.

Asset management
You are the custodian of your own crypto funds with DeFi protocols. Crypto wallets such as MetaMask, Gnosis Safe,
and Argent enable you to interact with decentralized applications to do everythingfrom buying, selling, and transferring
crypto to earning interest on your digital assets in a simple and secure manner. You own your data in the DeFi space
MetaMask, for example, stores your seed phrase, passwords, and private keys locally on your device in an encrypted
format so that only you have access to your accounts and data.
The rules of the game have changed for organisations that have increased institutional-grade requirements for allocating
capital to DeFi. Wallets like MetaMask Institutional make cryptoeconomic research, pre- and post-trade compliance,
best trade execution, reporting, and, of course, crypto custody easier for these organisations.

Compliance and Know-Your-Transaction (KYT)


In traditional finance, anti-money laundering (AML) and counter-financing-of-terrorism (CFT) compliance are based on
know-your-customer (KYC) guidelines.
In the DeFi space, Ethereum's decentralized infrastructure allows for next-generation compliance analysis based on
participant behaviour rather than participant identity.
These KYT services, such as those provided by MetaMask Institutional, assist in real-time risk assessment and protect

against fraud and financial crimes.

DAOs
A DAO is a decentralized autonomous organisation that cooperates in accordance with transparent rules encoded on the
Ethereum blockchain, obviating the need for a centralized, administrative entity.

eTech-Neo Publications..ASACHIN SHAH Venture


(MU-New Syllabus w.e.f academic year 22-23) (M7-85)
Blockchain (MU-Sem7-cOMP) (Tools&Applicationsof Blockchain)...Pageno.(6-17)
Several popular DeFi protocols, including Maker and Compound, have established DAOs to raise funds, manage
financial operations,and decentralise governance to the community.
Data and analytics
DeFi protocols provide unique advantages for data discovery, analysis, and decision-making around financial
opportunities and risk management due to their unprecedented transparency around transaction data and network
activity.
The rapid development of new DeFi applications has resulted in the creation of a plethora of tools and dashboards, such
as DeFi Pulse, that assist users in
tracking the value locked in DeFi protocols, assessing platform risk, and comparing
yield and liquidity.

uDerivatives
Ethereum-based smart contracts allow for the creation of tokenized derivatives, the value of which is determined by the
performance of an underlying asset and in which counterparty agreements are hardcoded in code.
DeFi derivatives can represent both real-world assets and cryptocurrencies, such as fiat currencies, bonds, and
commodities.

Developer and Infrastructure Tooling

Composability is one of the core design principles of DeFi protocols, which means that different components of a
system can easily connect and interoperate. As evidenced by the wide range of integrated DeFi applications,
composable code has created a powerful network effect in which the community builds on the work of others.
Many people compare DeFi development to building with legos, hence the increasingly popular moniker "money
legos." Ethereum developers and product teams can now build and launch DeFi protocols with the full-stack tooling and
security integrationsthey require, thanks to Truffe's smart contractlibraries,Infura's API suite, and Diligence'ssecurity
tools.

DEXs
DEXs are cryptocurrency exchanges that operate without a central authority, allowing users to transact
peer-to-peer
while maintaining control over their funds. Because crypto assets are never in the custody of the exchange, DEXs
reduce the risk of price manipulation, as well as hacking and theft.
DEXs also provide token projects with liquidity that often rivals that of centralized exchanges, with no listing fees.
Until recently, projects would pay millions of dollars to have their token listed on a centralized exchange
Some exchanges use varying degrees of decentralization, with centralized servers hosting order books and other features
but not storing users' private keys. AirSwap, Liquality, Mesa, Oasis, and Uniswap are some of the most popular DeFi
DEXs right now. MetaMask Swaps, a DeFi liquidity data aggregator,optimises trading experiences by providingDeFi
users with unparalleled insight, allowing them to identify the best price quote, optimal gas prices for the given quote,
and the lowest failure rates.

Gaming
DeFi's modularity has opened up opportunities for product developers to integrate DeFi protocols directly into platforms
across a wide range of industries. Because of their built-in economies and innovative incentive models, Ethereum-based
games have become a popularuse case for decentralized finance
PoofTogether, for example, is a no-loss audited savings lottery that allows users to buy digital tickets by depositing DAI
stablecoins, which are then pooled and lent to the Compound money market protocol to earn interest.

(MU-New Syllabus w.e.f academic year 22-23) (M7-85) Tech-Neo Publications...ASACHIN SHAH Venture
Blockchain(MU-Sem7-COMP) (Tools &Applicationsof Blockchain)...Pageno.(6-18)
Identity

Decentralized finance protocols combined with blockchain-based identity systems have the potential to enable
previously excluded users to gain access to a truly global economic system. DeFi solutions, rather than traditional data
points such as home ownership and income, can reduce collateralization requirements for people who do not have extra
funds and help assess users' creditworthiness through attributes such as reputation and financial activity.
The DeFi space values data privacy and open access to personally identifiable information. Anyone with an Internet
connection can use DeFi applications while keeping control over their data and assets.

Insurance

DeFi is still a developing space, with risks associated with smart contract bugs and breaches. A number of innovative
insurance alternatives have entered the market to assist users in purchasing coverage and protecting their holdings.
Nexus Mutual. for example, offers Smart Contract Cover, which protects against unintended uses of smart contract
code.

Lending and Borrowing


Some of the most popular applications in the DeFi ccosystem are peer-to-peer lending and borrowing protocols.
Compound, for example, is an algorithmic, self-governing interest rate protocol that integrates with and underpins a
slew of DeFi platforms, including PoolTogether,
Argent, and Dharma. Compound allows users to eam interest on erypto that they have supplied to the lending pool by
providing interest rate markets on Ethereum.
The Compound smart contract matches borrowers and lenders automatically and calculates interest rates based on the
borrowed-to-supplied asset ratio. Compound is a compelling example of the DeFi space's exponential opportunity: as
more products integratethe Compoundprotocol,an increasingnumber of crypto assets will be able to earn interest even
when idle.

Margin Trading
Unlike traditional finance, where margin traders can
leveragetheir trades by borrowingfunds froma broker (which then
serves as collateral for a loan), DeFi
margin trading is powered by decentralized, non-custodial lending protocols like
Compound and dYdX.
Because smart contracts automate traditional brokerage activity, some in the DeFi ecosystem have begun to refer to the
rise of "autonomous money markets."

Payments
Peer-to-peer payment is arguably the cornerstone of the DeFi space and the blockchain ecosystem as a whole.
Blockchain technology is designed to allow users to exchange cryptocurrencysecurely and directly with one another,
eliminating the need for middlemen.
DeFi payment solutions are helping large financial institutions streamline market
infrastructure and better serve
wholesale and retail customers while also creating a more open economic
system for underbanked and unbanked
populations.
Prediction markets
Blockchain-based prediction markets capitalise on the collective wisdom of the crowd by allowing users to vote and
trade value on the outcome of events.
Market prices then become crowdsourcedindicators of an event's likelihood.
Augur, a popular DeFi betting platform,
includes predictionmarkets for election results, sports games, economic events, and other
topics.
(MU-New Syllabus w.e.f academic year 22-23) (M7-85) Tech-Neo Publications...ASACHIN SHAH Venture
(6-19)
Blockchain (MU-Sem7-cOMP) (Tools&Applicationsof Blockchain)..Page no.
Savings more than traditional savings accounts by
accounts that can earn exponentially
Many DeFi apps offer interest-bearing interest rate tied to supply and demand.
pool protocols like Compound, based on a dynamic
plugging into lending
no-loss savings game in which participants win or
Dharma, and PoolTogether, a
Popular savings apps include Argent,
lose all of their money.
savings innovative mechanisms. Yield
has exploded in response to these
"Yield farming" is one DeFi activity that in order to maximise returns.
idle crypto assets around in different liquidityprotocols
farming is the practise of moving
The frenzy of interest in DeFi yield farming
has resulted in an abundance of memes.

Stable coins
stable asset basket of assets, such as fiat, gold, or other cryptocurrencies, is
Any cryptocurrency that is pegged to a or

referred to as a stablecoin.
make blockchains a viable
Stablecoins were created in order to reduce the volatility of cryptocurrency prices and
institutional
and borrowing platforms, and even
payment solution. They are now used for remittance payments, lending
use cases such as central bank digital currency(CBDC)
staking
Ethereum
Users will be able to stake their ETH and earn rewards as validators
or through staking providers as the
network transitions to a Proof of Stake consensus algorithm with Ethereum 2.0.
interest (rewards) for
Staking on Eth2 is similar to investing in an interest-bearing savings account: stakers earn

validating blocks on the Ethereum protocol.

Synthetic Assets
assets that provide exposure to other assets such as gold, fiat currencies,
Synthetic assets, like stablecoins, are crypto
and cryptocurrencies.
contracts with built-in agreements and incentive mechanisms serve as
Tokens locked into Ethereum-based smart
collateralization ratio of 750 percent to help the network absorb
collateral. The Synthetix protocol, for example, uses a

price shocks.

Tokenization
Tokenization is a pillar of decentralized finance and a built-in feature of the Ethereum blockchain. Tokens not only

power the network but also open up


new economic opportunities.
To put it simply, a token is a digital asset created, issued, and managed on a blockchain. Tokens are secure and instantly
functions.
transferable, and they can be programmed with a variety of built-in
From fractionalized real estate security tokens to platform-specific tokens that incentivize the use of a specific

application, Ethereum-based tokens have emerged as a secure and digital alternative for users all over the world to
access, trade, and store value.

Trading
and token swaps,
Trading in the DeFi space includes a variety of activities, such as derivatives trading, margin trading,
and takes place across an ever-growing and integrated network of exchanges, liquidity pools, and marketplaces.
Decentralized exchanges provide cryptocurrency traders with lower exchange fees, faster transaction settlement, and

full custody of their assets.


Chapter Ends..
O00

You might also like