Blockchain Architecture Design (KIT-062)
Unit - 1 (Introduction to Blockchain)
by
Mohit Kumar Saxena
Contents
1 Introduction to Blockchain 3
1.1 Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.1 Centralized Network Systems . . . . . . . . . . . . . . 3
1.1.2 Decentralized Network System . . . . . . . . . . . . . . 4
1.1.3 Distributed Network Systems . . . . . . . . . . . . . . 4
1.2 Introduction to Blockchain . . . . . . . . . . . . . . . . . . . . 5
1.3 Digital Money . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3.1 Types of Digital Money . . . . . . . . . . . . . . . . . 6
1.3.2 Advantages of Digital Money . . . . . . . . . . . . . . 6
1.4 Distributed Ledgers . . . . . . . . . . . . . . . . . . . . . . . . 6
1.4.1 Types of Distributed Ledger Technology . . . . . . . . 7
1.5 Design Primitives of a Blockchain . . . . . . . . . . . . . . . . 7
1.5.1 Design Primitives of Blockchain (Protocols) . . . . . . 8
1.5.1.1 Hyperledger . . . . . . . . . . . . . . . . . . . 8
1.5.1.2 Multichain . . . . . . . . . . . . . . . . . . . 9
1.5.1.3 Enterprise Ethereum . . . . . . . . . . . . . . 10
1.5.1.4 Corda . . . . . . . . . . . . . . . . . . . . . . 11
1.5.1.5 Quorum . . . . . . . . . . . . . . . . . . . . . 11
1.5.2 Design Primitives of Blockchain (Security ) . . . . . . . 11
1.5.3 Design Primitives of Blockchain (Consensus) . . . . . . 12
1.5.4 Design Primitives of Blockchain (Permissions) . . . . . 14
1.5.5 Design Primitives of Blockchain (Privacy) . . . . . . . 14
1.6 Blockchain Architecture and Design . . . . . . . . . . . . . . . 14
1.6.1 Types of Blockchain Architectures . . . . . . . . . . . . 14
1.6.1.1 Public blockchain networks . . . . . . . . . . 15
1.6.1.2 Private blockchain networks . . . . . . . . . . 16
1.6.1.3 Hybrid blockchain networks . . . . . . . . . . 17
1.6.1.4 Consortium blockchain networks . . . . . . . 18
1.6.2 How Does Blockchain Work . . . . . . . . . . . . . . . 19
1.6.2.1 Authentication . . . . . . . . . . . . . . . . . 20
1
1.6.2.2 Authorisation . . . . . . . . . . . . . . . . . . 20
1.6.3 Terms Related to Blockchain . . . . . . . . . . . . . . . 21
1.6.4 Key Characteristics of Blockchain . . . . . . . . . . . . 21
1.7 Basic Crypto Primitives . . . . . . . . . . . . . . . . . . . . . 22
1.7.1 One-Way Hash Function . . . . . . . . . . . . . . . . . 23
1.7.1.1 Properties of Cryptographic Hash Functions . 23
1.7.1.2 Types of Cryptographic Hash Functions . . . 24
1.7.1.3 Uses of Hash Functions in Blockchain . . . . . 25
1.7.2 Digital signatures . . . . . . . . . . . . . . . . . . . . . 26
1.7.2.1 The Role of Digital Signatures in Blockchain . 26
1.7.2.2 How Digital Signatures Work . . . . . . . . . 26
1.7.2.3 Electronic Signatures Vs. Digital Signatures: . 28
1.7.2.4 Use Cases . . . . . . . . . . . . . . . . . . . . 28
1.8 Hashchain to Blockchain . . . . . . . . . . . . . . . . . . . . . 29
1.9 Basic Consensus Mechanisms . . . . . . . . . . . . . . . . . . 30
1.9.1 How Does Consensus Work? . . . . . . . . . . . . . . . 30
2
Chapter 1
Introduction to Blockchain
1.1 Network
A network can be described as a group of two or more computer systems that
are connected and communicate through sharing files or other resources.
1.1.1 Centralized Network Systems
A centralized network is a network where the nodes don’t directly communi-
cate with each other. A single server handles the major part of the network’s
processing system in this system. The central server owns all the resources.
Figure 1.1: Centralized Network Systems
If any nodes want to gain access to any other resources, they get it via the
central system.
3
Figure 1.2: Decentralized Network System
1.1.2 Decentralized Network System
A decentralized network distributes workload among several servers without
having a single central server to manage network activity. Each of these
servers can act as an independent central server.
Centralization and decentralization refer to levels of control.
1.1.3 Distributed Network Systems
Distribution refers to differences in location. In a distributed network system,
the processing power is spread evenly across the network. This system can
often seem similar to a decentralized system. In a distributed system, all
parts of the system are located in different physical locations. The processing
is spread across multiple nodes, but decision-making can be centralised or
decentralised.
Figure 1.3: Network Systems
4
1.2 Introduction to Blockchain
Blockchain technology is an advanced database mechanism that allows trans-
parent information sharing. A blockchain is a distributed database that
maintains a continuously growing list of ordered records called blocks. These
blocks are linked using cryptography. Each block contains a cryptographic
hash of the previous block, a timestamp, and transaction data. Blockchain is
a distributed digital ledger of immutable records. The meaning of immutable
is that the data cannot be altered once it is recorded. Blockchain is com-
posed of cryptographically linked blocks like a linked list of a data structure
and hash as a pointer. That is, there is a chain of blocks in blockchain in
chronological order. The term blockchain was first described back in 1991. A
group of researchers wanted to create a tool to timestamp digital documents
so that they could not be backdated or changed. Further, the technique was
adapted and reinvented by Satoshi Nakamoto. In 2008, Nakamoto created
the first cryptocurrency, the blockchain-based project called Bitcoin.Satoshi
Nakamoto or a group of people with alias who developed bitcoin. He/they
authored a bitcoin white paper titled ‘Bitcoin: A Peer-to-Peer Electronic
Cash System’.
Figure 1.4: Blockchain technology
1.3 Digital Money
Digital money, or digital currency, is any form of money or payment that
exists only in electronic form. Digital money is not physically tangible like a
dollar bill or a coin. It is accounted for and transferred using online systems.
One well-known form of digital money is the crypto currency. Digital money
is exchanged using technologies such as smartphones, credit cards, and online
cryptocurrency exchanges. In some cases, it can be converted into physical
cash through the use of an ATM. A variant of digital money is already present
in society today in the form of cash held in online bank accounts. This cash
can be sent to others or received from them. It can also be used for online
5
transactions. A blockchain allows a person to safely send money to another
person without going through a bank or financial services provider.
1.3.1 Types of Digital Money
• Central bank digital currencies (CBDCs) are currencies issued by the
central bank of a country.
• Cryptocurrencies are digital currencies designed using cryptography.
The most popular cryptocurrencies are Bitcoin and Ethereum.
• Stablecoins are a variation of cryptocurrencies and were developed to
counter the price volatility of regular cryptocurrencies. Stablecoins can
be likened to a form of private money.
1.3.2 Advantages of Digital Money
Digital money eliminates the need for physical storage and safekeeping. Dig-
ital money simplifies accounting and record-keeping for transactions through
technology. It has already shortened the amount of time and the cost required
to transfer money across borders.
1.4 Distributed Ledgers
A distributed ledger is a database that is consensually shared and synchro-
nized across multiple sites, institutions, or geographies, accessible by multiple
people. It allows transactions to have public "witnesses." The participant at
each node of the network can access the recordings shared across that net-
work and can own an identical copy of it. Any changes or additions made to
the ledger are reflected and copied to all participants in a matter of seconds
or minutes. A distributed ledger stands in contrast to a centralized ledger,
which is the type of ledger that most companies use. A centralized ledger
is more prone to cyber attacks and fraud, as it has a single point of failure.
DLT uses cryptography to securely store data, cryptographic signatures and
keys to allow access only to authorized users. Blockchain is a type of DLT in
which transactions are recorded with an immutable cryptographic signature
called a hash.
6
1.4.1 Types of Distributed Ledger Technology
• Permissioned DLT: Nodes have to take permission from a central
authority to access or make any changes in the network. Mostly these
types of permissions include identity verification.
• Permissionless DLT: There is no central authority to validate trans-
actions, rather existing nodes are collectively responsible for validating
the transactions. Various consensus mechanisms are used to validate
transactions based on predefined algorithms. In the case of bitcoin
proof of work consensus mechanism is used.
• Hybrid DLT: It is combined with both permissionless and permis-
sioned DLTs and can benefit from both of them.
Figure 1.5: Distributed Ledger Technology
1.5 Design Primitives of a Blockchain
Design primitives of a blockchain refer to the fundamental building blocks
or basic components that are used to construct the underlying structure of a
blockchain system. These primitives typically include the following elements:
• protocols,
• security,
7
• consensus,
• permissions,
• privacy.
1.5.1 Design Primitives of Blockchain (Protocols)
In computer science, a protocol is a set of rules or procedures that govern
the transfer of data establishing how, in order for computers to exchange
information, the information must be structured and how each party will
send and receive it. A blockchain is a network of multiple devices (nodes) all
equally important connected to each other through the internet. Essentially,
a blockchain is a ledger which stores the record of what has come in and gone
out in a distributed p2p manner after the transaction has been verified by all
participating nodes. This distributed ledger works on pre-defined rules which
are agreed upon by all the participating nodes (the peers) in the network.
Protocols define the way that data must be structured to be accepted into a
Figure 1.6: Protocols
system, and they establish safeguards to prevent malicious users from causing
damage. Five major protocols are most significant:
1.5.1.1 Hyperledger
Hyperledger is an open-source collaborative effort created to advance cross-
industry blockchain technologies. It is not a single protocol, but rather a
collection of blockchain protocols and tools developed by the Linux Foun-
dation. The goal of Hyperledger is to create modular, flexible, and scalable
8
blockchain technologies that can be used for a wide range of applications
across various industries. Hyperledger protocols are designed to be highly
configurable and customizable to meet the needs of different use cases. They
also prioritize security, privacy, and interoperability, making them suitable
for enterprise applications. Some of the most well-known Hyperledger pro-
tocols include:
• Hyperledger Fabric: A permissioned blockchain framework that al-
lows multiple parties to transact on a shared ledger without the need
for a central authority.
• Hyperledger Sawtooth: A modular blockchain platform that sup-
ports various consensus mechanisms and allows for the creation of cus-
tom transaction families.
• Hyperledger Besu: An Ethereum-compatible client for building enterprise-
grade blockchain applications.
• Hyperledger Indy: A decentralized identity management system
that allows individuals to control their own digital identities.
• Hyperledger Burrow: A smart contract engine that supports the
Ethereum Virtual Machine (EVM) and allows for the execution of
Ethereum-based smart contracts on a permissioned blockchain network.
Hyperledger protocols and tools are used by businesses and organizations
around the world to build blockchain solutions for a wide range of use cases,
including supply chain management, identity verification, and financial trans-
actions.
1.5.1.2 Multichain
MultiChain is an open-source blockchain platform that enables the creation
and deployment of private, permissioned blockchain networks. It was first
released in 2015 by Coin Sciences Ltd. Unlike public blockchains like Bitcoin
and Ethereum, which are open to anyone, permissioned blockchains require
permission to access and participate. This makes them more suitable for use
cases where privacy, scalability, and governance are important, such as supply
chain management, asset tracking, and financial transactions. MultiChain is
designed to be easy to use and customize, with a simple command-line inter-
face and a flexible API. It also supports a wide range of features, including:
• Custom assets: MultiChain allows users to create and manage their
own digital assets, such as tokens, stocks, and bonds, on the blockchain.
9
• Permissions: MultiChain enables users to control who can access and
participate in the blockchain network, allowing for greater privacy and
security.
• Data streams: MultiChain supports the creation and management of
real-time data streams, which can be used to track events and transac-
tions on the blockchain.
• Smart contracts: MultiChain includes a simple programming lan-
guage that allows users to create and execute smart contracts on the
blockchain.
• Mining: MultiChain does not require mining, which means that it is
more energy-efficient and scalable than proof-of-work blockchains like
Bitcoin.
Overall, MultiChain is a versatile and user-friendly blockchain platform that
is well-suited for businesses and organizations that want to build private,
permissioned blockchain networks.
1.5.1.3 Enterprise Ethereum
Enterprise Ethereum is a blockchain protocol based on the Ethereum blockchain
that is specifically designed for enterprise use cases. It is an open-source,
public blockchain that allows for the creation of decentralized applications
(dApps) that can be used for a wide range of applications, including supply
chain management, identity verification, and financial transactions. Enter-
prise Ethereum is designed to be scalable, secure, and flexible, with features
that are tailored to meet the needs of businesses and organizations. Some of
the key features of Enterprise Ethereum include:
• Private transactions: Enterprise Ethereum allows for the creation
of private transactions that are only visible to authorized parties, pro-
viding greater privacy and security.
• Permissioned networks: Enterprise Ethereum can be used to create
private, permissioned networks that allow organizations to control who
can access and participate in the blockchain network.
• Smart contracts: Enterprise Ethereum supports the creation and
execution of smart contracts, which are self-executing agreements that
can automate processes and enforce rules on the blockchain.
10
• Consensus mechanisms: Enterprise Ethereum supports a range of
consensus mechanisms, including proof-of-work (PoW), proof-of-stake
(PoS), and Byzantine fault tolerance (BFT).
• Interoperability: Enterprise Ethereum is designed to be interopera-
ble with other blockchain platforms, allowing for seamless integration
with existing systems and networks.
Overall, Enterprise Ethereum is a powerful blockchain protocol that is well-
suited for enterprise use cases. It combines the flexibility and security of the
Ethereum blockchain with features that are tailored to meet the needs of
businesses and organizations.
1.5.1.4 Corda
Corda is a competitor of Multichain that offers a protocol designed for enter-
prises. Most applications that have been developed with Corda have been in
the finance and banking field. However, a wide range of custom Blockchain
solutions can make use of Corda’s technology. Corda is accredited by the R3
banking consortium.
1.5.1.5 Quorum
As with many of the leading protocols, Quorum aims to help businesses in the
finance sector. Quorum is significant because it has strong backing from the
financial community. For instance, J.P. Morgan Chase is a primary financial
backer of the protocol, and it has received additional resources from other
leading banks. However, Quorum has managed to remain as an open-source
project that can be utilized by anyone. Quorum is also strongly associated
with Ethereum since the project started by modifying the Ethereum code.
1.5.2 Design Primitives of Blockchain (Security )
Blockchains are secured through a variety of mechanisms that include ad-
vanced cryptographic techniques and mathematical models of behaviour and
decision-making. The blockchain is constructed to ensure a number of inher-
ent security attributes, such as consistency, tamper-resistant, resistance to a
Distributed Denial-of-Service (DDoS) attack, pseudonymity, and resistance
to double-spending attack.
Consistency: The concept of consistency in the context of blockchain as a
distributed global ledger refers to the property that all nodes have the same
ledger at the same time. Within a blockchain network system, the strong
11
consistency model means that all nodes have the same ledger at the same
time.
Tamper-Resistance: Tamper-resistance of blockchain means that any trans-
action information stored in the blockchain cannot be tampered with during
and after the process of block generation.
1.5.3 Design Primitives of Blockchain (Consensus)
Consensus mechanism is a fundamental concept in blockchain technology.
It refers to the process by which transactions are validated and added to
the blockchain ledger in a decentralized network. Consensus mechanisms are
necessary to ensure that all nodes in the network agree on the state of the
blockchain and prevent fraudulent transactions. In a blockchain network,
consensus is achieved through a process called mining or validation. Min-
ers (or validators) use computational power to solve complex mathematical
problems, which helps to verify transactions and create new blocks in the
blockchain. The first miner to solve the problem is rewarded with newly
created cryptocurrency tokens as an incentive for participating in the net-
work. There are several types of consensus mechanisms used in blockchain
technology, each with its own advantages and disadvantages. Some of the
most well-known consensus mechanisms include:
• Proof of Work (PoW): In a PoW consensus mechanism, miners use
computational power to solve complex mathematical problems, and
the first miner to solve the problem is rewarded with newly created
cryptocurrency tokens. This mechanism is used in Bitcoin and other
cryptocurrencies.
Figure 1.7: Proof of Work (PoW)
12
• Proof of Stake (PoS): In a PoS consensus mechanism, validators
are selected based on the number of tokens they hold, and they are
responsible for validating transactions and creating new blocks in the
blockchain. This mechanism is used in Ethereum and other cryptocur-
rencies.
Figure 1.8: Proof of Stake (PoS)
• Delegated Proof of Stake (DPoS): In a DPoS consensus mecha-
nism, token holders vote for delegates who are responsible for validating
transactions and creating new blocks in the blockchain. This mecha-
nism is used in EOS and other cryptocurrencies.
• Byzantine Fault Tolerance (BFT): In a BFT consensus mechanism,
validators are chosen based on their reputation and are responsible for
reaching a consensus on the state of the blockchain. This mechanism is
used in Hyperledger Fabric and other enterprise blockchain platforms.
• Proof of Elapsed Time (PoET): is a consensus mechanism used
in some blockchain networks, including Hyperledger Sawtooth. PoET
is a variation of the Proof of Work (PoW) consensus mechanism, but
instead of relying on computational power to validate transactions, it
uses a random lottery system that is based on time. PoET is designed
to be more energy-efficient than PoW because it doesn’t require miners
to use large amounts of computational power to solve complex mathe-
matical problems. Instead, it relies on a random lottery system that is
based on time, which can be executed on a low-power device such as a
smartphone or embedded system.
Overall, consensus mechanisms are an essential component of blockchain
technology, ensuring the security and integrity of the blockchain network.
The choice of consensus mechanism depends on the specific use case and the
needs of the blockchain network.
13
1.5.4 Design Primitives of Blockchain (Permissions)
The blockchain needs permission to participate in network and interact with
it. In public blockchain anyone can participate as open source clients and at-
tach to the network. Once the necessary synchronization done with rest of the
network then it gives the copy of ledgers. The permissioned blockchain works
differently where participant needs permission to join the network. This per-
mission is granted by the rest of the participants of network where they com-
pare the signer’s identity against permissioning policy. This permissioning
policy applies on both peer to peer networking. It is used to propagate trans-
actions as well as blocks with other functional messages. The permissioning
policy can be locally maintained by each of the operator or administrator.
The administrator will decide who will interact with the network.
1.5.5 Design Primitives of Blockchain (Privacy)
The network’s participants benefit from the privacy provided by the blockchain.
Confidentiality and anonymity are also part of this concept of privacy.
1.6 Blockchain Architecture and Design
A blockchain is designed as a decentralized network of millions of computers,
commonly referred to as nodes. It’s a distributed database architecture in
which each node plays the role of a network administrator who voluntarily
joins the network. Since there’s no centralized information in a blockchain
architecture, a blockchain is literally impossible to hack. Blockchain is a
decentralized, distributed ledger that comprises blocks. The Blocks are con-
nected to form a long chain. Each block comprises an address to the previous
block and some information. The address part is done with the help of hash-
ing. The information comprises data such as transactions and is encrypted.
Blockchain was first implemented in the year 2008 by a group of people
named Satoshi Nakamoto. Blockchain uses strong cryptographic methods to
manage the whole network.
1.6.1 Types of Blockchain Architectures
There are four main types of decentralized or distributed networks in the
blockchain
14
1.6.1.1 Public blockchain networks
These blockchains are completely open to following the idea of decentral-
ization. They don’t have any restrictions, anyone having a computer and
internet can participate in the network. Examples of public blockchain are
Bitcoin, Ethereum.
• As the name is public this blockchain is open to the public, which
means it is not owned by anyone.
• Anyone having internet and a computer with good hardware can par-
ticipate in this public blockchain.
• All the computers in the network hold the copy of other nodes or block
present in the network
• In this public blockchain, we can also perform verification of transac-
tions or records
Advantages:
• Trustable: There are algorithms to detect no fraud. Participants need
not worry about the other nodes in the network
• Secure: This blockchain is large in size as it is open to the public. In
a large size, there is greater distribution of records
• Anonymous Nature: It is a secure platform to make your transaction
properly at the same time, you are not required to reveal your name
and identity in order to participate.
• Decentralized: There is no single platform that maintains the net-
work, instead every user has a copy of the ledger.
Disdvantages:
• Processing: The rate of the transaction process is very slow, due to its
large size. Verification of each node is a very time-consuming process.
• Energy Consumption: Proof of work is high energy-consuming. It
requires good computer hardware to participate in the network
• Acceptance: No central authority is there so governments are facing
the issue to implement the technology faster.
15
1.6.1.2 Private blockchain networks
A single organization controls private blockchains, also called managed blockchains.
The authority determines who can be a member and what rights they have
in the network. Private blockchains are only partially decentralized because
they have access restrictions. Therefore companies use them for internal au-
diting, voting, and asset management. An example of private blockchains is
Hyperledger, Corda. Ripple, a digital currency exchange network for busi-
nesses, is an example of a private blockchain.
Figure 1.9: Types of Blockchain
Advantages:
• Speed: The rate of the transaction is high, due to its small size. Ver-
ification of each node is less time-consuming.
• Scalability: We can modify the scalability. The size of the network
can be decided manually.
• Privacy: It has increased the level of privacy for confidentiality reasons
as the businesses required.
16
• Balanced: It is more balanced as only some user has the access to the
transaction which improves the performance of the network.
Disdvantages:
• Security- The number of nodes in this type is limited so chances of
manipulation are there. These blockchains are more vulnerable.
• Centralized- Trust building is one of the main disadvantages due to
its central nature. Organizations can use this for malpractices.
• Count- Since there are few nodes if nodes go offline the entire system
of blockchain can be endangered.
1.6.1.3 Hybrid blockchain networks
Hybrid blockchains combine elements from both private and public networks.
Companies can set up private, permission-based systems alongside a pub-
lic system. In this way, they control access to specific data stored in the
blockchain while keeping the rest of the data public. They use smart con-
tracts to allow public members to check if private transactions have been
completed. For example, hybrid blockchains can grant public access to digi-
tal currency while keeping bank-owned currency private. Examples of Hybrid
Blockchain are Ripple network and XRP token.
Advantages:
• Ecosystem: Most advantageous thing about this blockchain is its hy-
brid nature. It cannot be hacked as 51
• Cost: Transactions are cheap as only a few nodes verify the transac-
tion. All the nodes don’t carry the verification hence less computational
cost. Architecture: It is highly customizable and still maintains in-
tegrity,
• security, and transparency.
• Operations: It can choose the participants in the blockchain and
decide which transaction can be made public.
Disdvantages:
• Efficiency: Not everyone is in the position to implement a hybrid
Blockchain. The organization also faces some difficulty in terms of
efficiency in maintenance.
17
• Transparency: There is a possibility that someone can hide informa-
tion from the user. If someone wants to get access through a hybrid
blockchain it depends on the organization whether they will give or
not.
• Ecosystem: Due to its closed ecosystem this blockchain lacks the
incentives for network participation.
1.6.1.4 Consortium blockchain networks
A group of organizations governs consortium blockchain networks. Prese-
lected organizations share the responsibility of maintaining the blockchain
and determining data access rights. Industries in which many organizations
have common goals and benefit from shared responsibility often prefer con-
sortium blockchain networks. For example, the Global Shipping Business
Network Consortium is a not-for-profit blockchain consortium that aims to
digitize the shipping industry and increase collaboration between maritime
industry operators.
Advantages:
• Speed: A limited number of users make verification fast. The high
speed makes this more usable for organizations.
• Authority: Multiple organizations can take part and make it decentral-
ized at every level. Decentralized authority, makes it more secure.
• Privacy: The information of the checked blocks is unknown to the
public view. but any member belonging to the blockchain can access
it.
• Flexible: There is much divergence in the flexibility of the blockchain.
Since it is not a very large decision can be taken faster.
Disdvantages:
• Approval: All the members approve the protocol making it less flex-
ible. Since one or more organizations are involved there can be differ-
ences in the vision of interest.
• Transparency: It can be hacked if the organization becomes corrupt.
Organizations may hide information from the users.
• Vulnerability: If few nodes are getting compromised there is a greater
chance of vulnerability in this blockchain
18
Figure 1.10: Comparisons between Private, Public and Consortium
Blockchain
1.6.2 How Does Blockchain Work
Before a transaction is added to the blockchain it must be authenticated and
authorised. There are several key steps a transaction must go through before
it is added to the blockchain. The working is a multistep process, but it
involves four phases: the creation of the block, verification of the block, the
addition of the block and updation of the database. The steps are as follows:
• An authentic user requests a transaction.
• A block is created in which the transaction or any other data is speci-
fied.
• The block is circulated all over the network. Blockchain protocols do
this.
• Miners verify the block. Upon successful verification, the miners get
incentives.
• After the successful transaction, the database is added.
19
Figure 1.11: How Does Blockchain Work
1.6.2.1 Authentication
The original blockchain was designed to operate without a central authority
(i.e. with no bank or regulator controlling who transacts), but transactions
still have to be authenticated. This is done using cryptographic keys, a
string of data (like a password) that identifies a user and gives access to their
“account” or “wallet” of value on the system. Each user has their own private
key and a public key that everyone can see. Using them both creates a secure
digital identity to authenticate the user via digital signatures and to ‘unlock’
the transaction they want to perform.
1.6.2.2 Authorisation
Once the transaction is agreed upon between the users, it needs to be ap-
proved or authorised before it is added to a block in the chain. For a public
blockchain, the decision to add a transaction to the chain is made by consen-
sus. This means that the majority of “nodes” (or computers in the network)
must agree that the transaction is valid. The people who own the computers
in the network are incentivised to verify transactions through rewards. This
process is known as ‘proof of work’.
Whereas public blockchains tend to be decentralized, private blockchains
are typically controlled by one entity, like an enterprise. Decentralized blockchains
using a mining consensus system like proof of work may lose their decentral-
20
ization if one miner (or group of miners) becomes more powerful than all the
others, leading to the threat of a 51% attack.
1.6.3 Terms Related to Blockchain
• Block: A block is the unit of blockchain that contains information in
encrypted form. The blocks are connected. It is also called an im-
mutable record as it cannot be reverted once created. There are three
types of Blocks: Genesis Block, Valid Block and Orphan Blocks. Gene-
sis Block is the first block that is created at the start of the blockchain.
Valid Blocks are the blocks validated by miners and added to the
blockchain. Orphan Blocks, as the name suggests, they are not added
to any blockchain.
• Miner: Blockchain Mining comprises of verification of transactions.
Since blockchain is highly decentralized, no authority can verify and
secure the transactions. Miners are the users of the technology who
verify the transactions. After successful verification, they get incen-
tives.
• Node: Nodes are devices in which blocks are stored. The nodes also
have a database that stores the history of transactions and is connected.
• Block Reward: A block reward is an incentive that is given to miners
when they participate in the validation of the blocking process. It has
two parts: block subsidy and transaction fees.
• Cryptography: It is a practice used in this technology to encode and
decode data. The aim is to protect data with the help of codes. The
techniques used are a part of security protocols to prevent unauthorized
access from third parties. The word is made up of two terms ‘Krypto’
means ‘hidden’ and ‘Graphy’ means ‘written’.
1.6.4 Key Characteristics of Blockchain
Blockchain architecture possesses a lot of benefits for businesses. Here are
several embedded characteristics:
• Cryptography - blockchain transactions are validated and trustwor-
thy due to the complex computations and cryptographic proof among
involved parties
21
Figure 1.12: Terms Related to Blockchain
• Immutability - any records made in a blockchain cannot be changed
or deleted
• Provenance - refers to the fact that it is possible to track the origin
of every transaction inside the blockchain ledger
• Decentralization - each member of the blockchain structure has ac-
cess to the whole distributed database. As opposed to the central-based
system, consensus algorithm allows for control of the network
• Anonymity- each blockchain network participant has a generated ad-
dress, not user identity. This keeps users’ anonymity, especially in a
public blockchain structure
• Transparency - the blockchain system cannot be corrupted. This
is very unlikely to happen, as it requires huge computing power to
overwrite the blockchain network completely
1.7 Basic Crypto Primitives
Cryptographic Primitives are the tools used to build security protocols, which
comprise low-level algorithms. Security protocols are nothing but algorithms
that are developed by Cryptographic designers using Cryptographic Primi-
tives as tools, and these protocols are executed when certain conditions are
22
met. Since Blockchain is highly decentralized in nature, the security of data
is of utmost importance. For example: Suppose two users want to exchange
information on a public Blockchain. In Public Blockchain, everybody can
see the transaction process. To secure the data, encryption algorithms are
used. For decrypting, the data decryption algorithms are used. These cryp-
tographic primitives are used to develop these high-level secured algorithms.
There are many cryptographic primitives, but we will discuss the most com-
monly used ones which are Hash and Signature.
1.7.1 One-Way Hash Function
It is a mathematical function which converts an input of any length to a
binary sequence of fixed length. Hashing is the process of converting an orig-
inal piece of data into a digest or hash. The process uses cryptographic hash
functions for the irreversible conversion of the message. It cannot be reverted,
which means the original string cannot be retrieved back from the hash. It
is to be noted that even a small change in the input can change the meaning
of the whole output. For example, SHA256 is a hash function. It generates
32-byte strings for any input. The hash function applies to the message in
Figure 1.13: One-Way Hash Function
order to generate a message digest which is a fixed-size hexadecimal output
• It takes an arbitrary size input as a message. INPUT M: The Message
• Uses a Cryptographic hash function H to encrypt the message M.
• Generates the output called Digest. H(M) = Digest
1.7.1.1 Properties of Cryptographic Hash Functions
The process of hashing not only secures the message but also makes the com-
putation easy. It compresses the message into hash/digest which is efficient
for computation as well as communication.
23
• Deterministic: Cryptographic hash functions are deterministic. It
always generates the same hash for the same input data.
• Avalanche Effect: This means for a small change in the input, the
output will change significantly.
• Puzzle Friendliness: This means even if one gets to know the first
200 bytes, one cannot guess or determine the next 56 bytes.
• Preimage resistance: Given a hash value h, it is difficult to find a
message.
• Second preimage resistance: Given a message m1, it is difficult to
find another message m2 such that hash(k, m1) = hash(k, m2)
1.7.1.2 Types of Cryptographic Hash Functions
There are several different classes of hash functions. Some of the popular
classes are:
• RACE Integrity Primitives Evaluation Message Digest (RIPEMD):
This set includes RIPEMD, RIPEMD-128, RIPEMD-160, RIPEMD-
256, RIPEMD-320. Out of these RIPEMD-160 is the most common.
The original RIPEMD-128 is based on the design principles used in
MD4. The RIPEMD-256 and 320 have fewer chances of accidental col-
lision but do not have higher levels of security as compared to RIPEMD-
128 and RIPEMD-160.
• Message-Digest Algorithm: This family comprises hash functions
MD2, MD4, MD5, and MD6. MD5 is the most widely used crypto-
graphic hash function. It is used to generate a 128-bit digest from a
512-bit string broken down into 16 words composed of 32 bits each.
Ronald Rivest designed this algorithm in 1991 to use for digital sig-
nature verification. These are no longer considered cryptographically
secure methods and should not be used for cryptographic authentica-
tion.
• BLAKE2: It was announced on December 21, 2012.BLAKE2 is a cryp-
tographic hash function based on BLAKE, designed with the aim to
replace MD5 and SHA-1 algorithms in applications requiring high per-
formance in software. It provides better security than SHA-2 and is
similar to that of SHS-3. It provides the following features:
• It provides immunity to length extensions.
24
• It removes the addition of constants to message words.
• It simplifies padding and reduces the number of rounds from 16 to
12.
• BLAKE3: It was announced on January 9, 2020. BLAKE3 is a cryp-
tographic function based on Bao and BLAKE2. It is a few times faster
than BLAKE2. This algorithm provides many features like parallelism,
XOF, KDF, etc.
• Whirlpool: It is a cryptographic hash function, first described in
2000. It is a modified version of the Advanced Encryption Standard
(AES). Whirlpool produces a hash of 512 bits.
• Secure Hashing Algorithm: The family of SHA comprises four SHA
algorithms: SHA-0, SHA-1, SHA-2, and SHA-3. SHA-0 is a 160-bit
hash function that was published by the National Institute of Standards
and Technology in 1993. SHA-1 was designed in 1995 to correct the
weaknesses of SHA-0. In 2005, a method was found to uncover collisions
in the SHA-1 algorithm due to which long-term employability became
doubtful. SHA-2 has the following SHA variants, SHA-224, SHA-256,
SHA-384, SHA-512, SHA-512/224, and SHA-512/256. It is a stronger
hash function and it still follows the design of SHA-1. In 2012, the
Keccak algorithm was chosen as the new SHA-3 standard. SHA-256 is
the most famous of all cryptographic hash functions because it’s used
extensively in blockchain technology. The SHA-256 Hashing algorithm
was developed by the National Security Agency (NSA) in 2001.
1.7.1.3 Uses of Hash Functions in Blockchain
The blockchain has a number of different uses for hash functions. Some of
the most common uses of the hash function in blockchain are:
• Merkle Tree: This uses hash functions to make sure that it is infea-
sible to find two Merkle trees with the same root hash. This helps to
protect the integrity of the block header by storing the root hash within
the block header and thus protecting the integrity of the transactions.
• Proof of Work Consensus: This algorithm defines a valid block as
the one whose block header has a hash value less than the threshold
value.
• Digital signatures: Hash functions are the vital part of digital sig-
natures that ensures data integrity and are used for authentication for
blockchain transactions.
25
• The chain of blocks: Each block header in a block in the blockchain
contains the hash of the previous block header. This ensures that it is
not possible to change even a single block in a blockchain without being
detected. As modifying one block requires generating new versions of
every following block, thus increasing the difficulty.
1.7.2 Digital signatures
Digital Signing in Blockchain is a process to verify the user’s impressions of
the transaction. It uses the private key to sign the digital transaction, and
its corresponding public key will help to authorize the sender.
1.7.2.1 The Role of Digital Signatures in Blockchain
Digital signatures are a fundamental building block in blockchains, used
mainly to authenticate transactions. When users submit transactions, they
must prove to every node in the system that they are authorized to spend
those funds, while preventing other users from spending them. Every node in
the network will verify the submitted transaction and check all other nodes’
work to agree on a correct state. Digital signatures also provide assurance
to recipients about the fact that messages have not been through any modi-
fications in transit. In simple terms, we may describe a digital signature as a
code that is attached to a message or document. After generated, the code
acts as proof that the message hasn’t been tampered with along its way from
sender to receiver.
1.7.2.2 How Digital Signatures Work
A transaction is just a message that contains information about the sender
and recipient and the amount of BTC to be transferred (including a trans-
action fee). When you want to send some bitcoins, your wallet creates a
“transaction” and sends it to a node on the Bitcoin network which then
broadcasts it to other nodes. When you initiate a Bitcoin transaction, you
must prove to every node in the Bitcoin network that you are authorized to
spend those funds.
Before sending out the message (the “transaction”), you’re required to
“sign” it. All transactions need to be “signed” before they are submitted to
the network. To do so, your wallet software does some fancy math magic
(hashing) to the transaction message and then after that, does some more
fancy math magic (encryption) with something known as a “private key”.
The result of all this math magic is a special piece of information called the
26
“digital signature”. It is this “digital signature” that proves to the Bitcoin
network that you are the true owner of the bitcoins that you wish to send.
In the context of cryptocurrencies, a digital signature system
often consists of three basic steps: hashing, signing, and verifying.
Hashing The Data: The first step is to hash the message or digital data.
This is done by submitting the data through a hashing algorithm so that a
hash value is generated (i.e., the message digest). As mentioned, the messages
can vary significantly in size, but when they are hashed, all their hash values
have the same length. This is the most basic property of a hash function.
However, hashing the data is not a must for producing a digital signature
because one can use a private key to sign a message that wasn’t hashed at
all. But for cryptocurrencies, the data is always hashed because dealing with
fixed-length digests facilitates the whole process.
Signing: After the information is hashed, the sender of the message needs
to sign it. This is the moment where public-key cryptography comes into play.
Essentially, the hashed message will be signed with a private key, and the
receiver of the message can then check its validity by using the corresponding
public key (provided by the signer). If the private key is not included when
the signature is generated, the receiver of the message won’t be able to use the
corresponding public key to verify its validity. Both public and private keys
are generated by the sender of the message, but only the public key is shared
with the receiver. It’s worth noting that digital signatures are directly related
to the content of each message. So unlike handwritten signatures, which tend
to be the same regardless of the message, each digitally signed message will
have a different digital signature.
Verifying: When Alice sends a document to Bob, she will follow certain
steps to digitally sign the document, these steps are as follows:
• Calculate the message digest of the document Alice wants to send to
Bob with a cryptographic hash function, usually MD5 or any SHA
algorithm.
• Encrypt the message digest with Alice’s private key, append the en-
crypted message digest to the original document, and send the com-
bined message out.
• Once Bob receives the combined message from Alice, he will separate
the encrypted message digest from the document itself. Bob will use
Alice’s public key to decrypt the encrypted message digest.
• At the same time, Bob will calculate the message digest of the received
document and compare the resulting message digest with the decrypted
27
Figure 1.14: Digital Signatures
message digest to see whether there is a match. If yes, Bob is assured
that the document originated from Alice without any tampering.
Bitcoin uses public-key cryptography to create digital signatures. Public-
key cryptography, or PKC, refers to a cryptographic system that makes use
of a pair of keys: one public key and one private key. The two keys are
mathematically related and can be used for both data encryption and digital
signatures.
1.7.2.3 Electronic Signatures Vs. Digital Signatures:
Simply, digital signatures relate to one particular kind of electronic signa-
tures - which refer to any electronic method of signing documents and mes-
sages. Thus, all digital signatures are electronic signatures, but the opposite
isn’t always true. The main difference between them is the authentication
method. Digital signatures deploy cryptographic systems, such as hash func-
tions, public-key cryptography, and encryption techniques.
1.7.2.4 Use Cases
Digital signatures can be applied to various kinds of digital documents and
certificates. As such, they have several applications. Some of the most
common use cases include:
28
Figure 1.15: Electronic Signatures Vs. Digital Signatures
• Information Technology. To enhance the security of Internet commu-
nication systems.
• Finance. Digital signatures can be implemented to audits, expense
reports, loan agreements, and much more.
• Legal. Digital signing of all sorts of business contracts and legal agree-
ments, including governmental papers.
• Healthcare. Digital signatures can prevent fraud of prescriptions and
medical records.
• Blockchain. Digital signature schemes ensure that only the rightful
owners of the cryptocurrencies are able to sign a transaction to move
the funds (as long as their private keys aren’t compromised).
Hash functions and public-key cryptography are at the core of digital signa-
ture systems, which are now applied to a wide range of use cases. If properly
implemented, digital signatures can increase security, ensure integrity, and
facilitate the authentication of all kinds of digital data. In the blockchain
realm, digital signatures are used to sign and authorize cryptocurrency trans-
actions. They are particularly important for Bitcoin because the signatures
ensure that coins can only be spent by the individuals that possess the cor-
responding private keys.
1.8 Hashchain to Blockchain
A hash chain is the successive application of a cryptographic hash function
to a piece of data. In computer security, a hash chain is a method to produce
29
many one-time keys from a single key or password. For non-repudiation a
hash function can be applied successively to additional pieces of data in order
to record the chronology of data’s existence. A hash chain is a successive
application of a cryptographic hash function to a string x.
For example, h(h(h(h(x)))), gives a hash chain of length 4, often denoted
h (x). A hash chain is a sequence of hashes of blocks. Each block consists
4
of the hash of the previous block, and (optionally) some data. These can be
seen a special case of a Merkle Tree, that is one with only a single branch. A
blockchain is a Merkle Tree with a consensus algorithm to determine which
branch is the "correct" one. Typically other branches get discarded, but not
always.
1.9 Basic Consensus Mechanisms
A consensus mechanism is a program used in blockchain systems to achieve
distributed agreement about the ledger’s state. Generally, it is implemented
in a network with many processes and users. Cryptocurrencies, blockchains,
and distributed ledgers benefit from their use because the consensus mecha-
nism replaces much slower human verifiers and auditing.
Consensus means achieving a state of a decision on which all network
participants agree. For example, a group of friends decides on a trip to Goa
without conflicts. Here, reaching a decision to visit Goa together is a state
of consensus or mutual agreement.
"The purpose of the Consensus mechanism in a decentralized
network is to allow a group of independent nodes to distribute
the right to update as well as validate the change in the network
equally. Therefore, decide on the next update of a decentralized
network." In a blockchain, each participant shares the exact same copy of
the network transactions, which helps them stay synchronized and connected.
1.9.1 How Does Consensus Work?
There is a number of consensus mechanisms to operate on a decentralized
network. Each algorithm has its own way of reaching a global agreement on
a network update.
Generally, consensus protocols form at least 51% of participants in the
network to agree on the upcoming change. If they agree, the network system
gets updated with the new change. Else, it rejects the change by mutual
agreement.
30