0% found this document useful (0 votes)
2 views26 pages

Module 1

The document provides an overview of blockchain technologies, focusing on the formation of the longest chain, definitions of Bitcoin and blockchain, and the characteristics of permissioned blockchains. It outlines the advantages and applications of permissioned blockchains in various sectors such as supply chain management, banking, and healthcare. Additionally, it discusses public ledgers, consensus mechanisms, block structure, and the importance of distributed consensus in maintaining data integrity across the network.

Uploaded by

Prrishitha
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views26 pages

Module 1

The document provides an overview of blockchain technologies, focusing on the formation of the longest chain, definitions of Bitcoin and blockchain, and the characteristics of permissioned blockchains. It outlines the advantages and applications of permissioned blockchains in various sectors such as supply chain management, banking, and healthcare. Additionally, it discusses public ledgers, consensus mechanisms, block structure, and the importance of distributed consensus in maintaining data integrity across the network.

Uploaded by

Prrishitha
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Module 1 – INTRODUCTION BLOCKCHAIN TECHNOLOGIES

Q1. How is the longest chain formed in a blockchain?


The longest chain is the chain with the most blocks. It is one with the most history of the
network. This phenomenon exists in a blockchain system.
A blockchain is made of records bundled up into blocks. These blocks are appended to each
other using consensus mechanisms. A new block is typically attached to the last block.
Attaching one to another creates a ‘chain’. However, this can be broken when a consensus
failure occurs. In fact, disagreements about consensus cause the chain to split. Two identical
chains emerge from this process.
The continuation of this chain makes it longer than the other copy. Automatically, this
becomes the longest chain.

Q2. Define bitcoin and blockchain.


Bitcoin is digital cash/ digital currency and online payment system in which encryption
techniques are used to regulate the generation of units of currency and verify the transfer of
funds, operating independently of a central bank.
The blockchain is the public ledger of all Bitcoin transactions that have ever been executed.
Blockchain is a shared, immutable digital ledger, enabling the recording of transactions and
the tracking of assets within a business network and providing a single source of truth.
It is constantly growing as miners add new blocks to it (every 10 minutes) to record the most
recent transactions. The blocks are added to the blockchain in a linear, chronological order.

Q3. What is permissioned blockchain?


A permissioned blockchain is a type of distributed ledger that requires ‘permission’ to access
and is not open to the public.
Such a blockchain maintains records of everyone involved in the transactions that occur on it.

Q4. Explain the key features of permissioned blockchain.


1. No defined decentralisation
2. Has a centralised authority
3. Invitation to join necessary
4. Lack of anonymity
5. Scalability is manageable

A permissioned blockchain is a type of blockchain network where participation is restricted


to authorized users only. Unlike public blockchains, it is managed by a central organization
or a group of trusted entities. This type of blockchain is commonly used by businesses and
organizations that require privacy, security, and controlled access.
Module 1 – INTRODUCTION BLOCKCHAIN TECHNOLOGIES

Key Features of Permissioned Blockchain

1. No Defined Decentralisation

Permissioned blockchains are not fully decentralized. Instead of allowing anyone to


participate in validating transactions, only selected and authorized participants can perform
these functions. This provides greater control over the network while maintaining the benefits
of blockchain technology.

2. Has a Centralised Authority

A permissioned blockchain is governed by a centralized authority or a consortium of trusted


organizations. This authority is responsible for granting access, managing permissions,
approving participants, and maintaining the rules of the network. As a result, governance
becomes simpler and disputes can be resolved more efficiently.

3. Invitation to Join Necessary

Unlike public blockchains where anyone can join freely, participation in a permissioned
blockchain is by invitation or approval only. Users must be verified before they are allowed
to access the network. This ensures that only trusted individuals or organizations can read,
write, or validate transactions.

4. Lack of Anonymity

Participants in a permissioned blockchain are usually known and identifiable. Since every
user undergoes an identity verification process before joining, transactions can be traced back
to authorized members. This increases accountability, reduces fraudulent activities, and helps
organizations comply with legal and regulatory requirements.

5. Scalability is Manageable

Permissioned blockchains offer better scalability and higher transaction speed than public
blockchains. Because only a limited number of trusted nodes participate in transaction
validation, consensus is reached more quickly. This enables the network to process a larger
number of transactions efficiently, making it suitable for enterprise applications.

Conclusion

Permissioned blockchains combine the transparency and security of blockchain technology


with controlled access and efficient governance. Their features, such as centralized
management, restricted participation, identifiable users, and improved scalability, make them
ideal for organizations that require secure and private blockchain solutions.

Q5. Write the advantage of using permissioned blockchain. Discuss the applications of
permissioned blockchain.
Module 1 – INTRODUCTION BLOCKCHAIN TECHNOLOGIES

A permissioned blockchain provides a secure and controlled environment where only


authorized users can participate. It is widely used by businesses because it offers improved
performance, privacy, and trust while maintaining the benefits of blockchain technology.
Advantages of Permissioned Blockchain
1. Improved Security
Only verified and authorized users can access the network, reducing the chances of
unauthorized access, fraud, and malicious attacks.
2. Better Privacy
Sensitive business information is shared only with approved participants, ensuring
confidentiality while maintaining transparency among trusted members.
3. Faster Transactions
Since fewer trusted nodes participate in validating transactions, consensus is achieved
quickly. This results in faster transaction processing compared to public blockchains.
4. Better Scalability
Permissioned blockchains can handle a larger number of transactions efficiently because the
number of participants is controlled. This makes them suitable for enterprise-level
applications.
5. Greater Control and Accountability
The central authority manages network permissions and identifies all participants. This
increases accountability, simplifies governance, and helps organizations meet regulatory
requirements.
Applications of Permissioned Blockchain
Provenance Tracking in Supply Chains
One of the most important applications of permissioned blockchain is provenance tracking,
which involves tracking the origin and movement of high-value products throughout the
supply chain.
Module 1 – INTRODUCTION BLOCKCHAIN TECHNOLOGIES

Examples include:
 Luxury goods
 Pharmaceuticals
 Cosmetics
 Electronics
When a high-value item is manufactured, a corresponding digital token is created and
issued by a trusted authority. This digital token acts as proof of the product's origin and
authenticity.
Whenever the physical product changes ownership, the digital token is transferred
simultaneously on the blockchain. As a result, the real-world movement of the product is
accurately mirrored by the blockchain transaction history.
The digital token acts as a virtual certificate of authenticity, which is much more secure
and difficult to steal, alter, or forge than traditional paper certificates. This helps prevent
counterfeit products, improves transparency, and allows businesses and customers to verify
the complete history of an item.
(After explaining provenance tracking in detail, write any few of them from below)
2. Banking and Financial Services
Banks and financial institutions use permissioned blockchain to process payments, cross-
border transfers, and settlements securely.
Since only authorized banks participate in the network, transactions are completed faster
while maintaining privacy, regulatory compliance, and protection against fraud.
3. Healthcare
Hospitals, clinics, and insurance providers can securely share electronic health records using
a permissioned blockchain.
Only authorized medical professionals can access patient information, ensuring data privacy,
improving coordination between healthcare providers, and preventing unauthorized
modifications.
4. Trade Finance
Businesses involved in international trade use permissioned blockchain to manage documents
such as invoices, purchase orders, and letters of credit.
All approved parties—including buyers, sellers, banks, and shipping companies—can access
the same trusted information, reducing paperwork, delays, and fraud.
5. Government and Public Services
Government agencies use permissioned blockchain for managing land records, digital
identities, tax records, and public documents.
Module 1 – INTRODUCTION BLOCKCHAIN TECHNOLOGIES

Because access is restricted to authorized officials, records remain secure, transparent, and
resistant to tampering.
6. Insurance
Insurance companies use permissioned blockchain to securely share policy information and
process claims.
Authorized insurers can verify customer details quickly, detect fraudulent claims, and
automate claim settlements, improving efficiency.
7. Enterprise Data Sharing
Large organizations with multiple departments or business partners use permissioned
blockchain to share business data securely.
Only authorized participants can view or update information, ensuring confidentiality while
maintaining a single, accurate source of data.
8. Manufacturing and Logistics
Manufacturers and logistics companies use permissioned blockchain to monitor inventory,
shipments, and warehouse operations.
Real-time updates improve coordination between suppliers, manufacturers, distributors, and
retailers while reducing errors and improving traceability.
Conclusion
Permissioned blockchains provide several advantages, including enhanced security, privacy,
faster transaction processing, scalability, and better governance. Permissioned blockchain is
best suited for industries where privacy, security, and controlled access are essential. Its
major applications include supply chain management, banking, healthcare, trade finance,
government services, insurance, enterprise collaboration, and manufacturing, making it a
preferred blockchain solution for enterprise environments.

Q6. Define public ledger. Mention the core characteristics of public ledger.
A public ledger is an open, decentralized record-keeping system where transactions are
securely stored and accessible to anyone on the network.
Core characteristics of Public Ledgers:
• Decentralization: Rather than being stored in one central database, copies of the
ledger are distributed across a global network of computers (nodes).
• Transparency: Anyone can see the entire history of transactions on the network.
• Immutability: Once data or a transaction is recorded, it is permanently locked using
cryptography and cannot be altered or deleted.
• Pseudo-Anonymity: While every transaction is transparent, participants interact
using public wallet addresses rather than their real-world identities.
Module 1 – INTRODUCTION BLOCKCHAIN TECHNOLOGIES

Q7. Discuss the working of public ledger.


When a new transaction is made, it is grouped with other transactions into a "block".
The network of nodes uses specific rules, known as consensus mechanisms (like Proof-of-
Work  solve a complex mathematical puzzle or Proof-of-Stake The validators lock up
some of their Ether as a stake in the ecosystem.), to verify the transaction.
Once verified, the block is permanently added to the chain of previous blocks, creating a
secure, unchangeable record.

Q8. Differentiate between Raft, Paxos and Byzantine Fault Tolerance consensus
mechanisms.
Raft Consensus[agree upon same data and stay synchronized even if some node fails]-> there
will be a strong leader where all the updates go through him.
Paxos Consensus [multiple nodes agree on one value even if some node fails]->No strong
leader to take care of transactions.
Byzantine Fault Tolerance (BFT) algorithms -> both raft and paxos fail to handle malicious
nodes whereas BFT handles them too.

Q9. Discuss the structure of a block along with its components.


A block is a fundamental digital container that permanently stores batches of validated
transactions or data on a decentralized network.
Two components of a Block:
1. Block Header
2. List of Transactions
Module 1 – INTRODUCTION BLOCKCHAIN TECHNOLOGIES

Block Header:
Metadata about a block – (1) Previous block hash, (2) Mining statistics used to
construct the block, (3) Merkle tree root
Previous block hash: Every block inherits from the previous block – we use previous
block’s hash to create the new block’s hash – make the blockchain tamper proof.
Mining – the mechanism to generate the hash
The mechanism needs to be complicated enough,
to make the blockchain tamper proof
Bitcoin Mining: Hk = Hash(Hk-1 || T || Nonce)
Find the nonce[[Link] only once randomly] such
that Hk has certain predefined complexity (number
of zeros at the prefix)
The header contains mining statistics –
timestamp[T], nonce and difficulty.
Module 1 – INTRODUCTION BLOCKCHAIN TECHNOLOGIES

Hashes in block
header.
Block identifier – the hash of the current block header (Hash algorithm: Double
SHA256)
Previous block hash is used to compute the current block hash.
Transactions in a Block
Transactions are organized as a Merkle Tree.
The Merkle Root is used to construct the block hash.
If you change a trSansaction, you need to change all the subsequent block hash.
The difficulty of the mining algorithm determines the toughness of tampering with a
block in a blockchain.
Module 1 – INTRODUCTION BLOCKCHAIN TECHNOLOGIES

The Block contains two parts – the header and the data (the transactions)
The header of a block connects the transactions – any change in any transaction will
result in a change at the block header.
The headers of subsequent blocks are connected in a chain – the entire blockchain
needs to be updated if you want to make any change anywhere.

Q10. What are transactions in a block? How do you represent?


Refer to Q9. [for transaction representations]
A block is the fundamental unit of a blockchain that permanently stores a batch of validated
transactions or data. Each block consists of two main components:
1. Block Header
2. List of Transactions
The transactions stored in a block are securely linked to the block header, ensuring that the
data cannot be altered without affecting the entire blockchain.
Transactions in a Block
A transaction is a record of an activity or exchange that has been verified and added to the
blockchain. Multiple validated transactions are grouped together and stored inside a block.
These transactions form the data section of the block.
The transactions are not stored randomly. Instead, they are organized using a Merkle Tree,
which provides an efficient and secure way of verifying transaction integrity.
Representation of Transactions – Merkle Tree
Transactions inside a block are represented using a Merkle Tree (Hash Tree).
 Each transaction is individually hashed.
Module 1 – INTRODUCTION BLOCKCHAIN TECHNOLOGIES

 Pairs of transaction hashes are combined and hashed again.


 This process continues until a single hash value is obtained.
 The final hash is called the Merkle Root.
The Merkle Root is stored in the block header and is used when constructing the block
hash.
Representation:
Merkle Root

┌──────┴──────┐
Hash AB Hash CD
┌───┴───┐ ┌───┴───┐
Hash A Hash B Hash C Hash D
│ │ │ │
Tx1 Tx2 Tx3 Tx4
Connection with the Block Header
The block header contains important metadata, including:
 Previous block hash
 Merkle Root
 Timestamp
 Nonce
 Difficulty
The previous block hash links each block to the previous one, while the Merkle Root
represents all the transactions within the current block. The block identifier (block hash) is
generated from the block header using the Double SHA-256 hashing algorithm.
Importance of Transaction Representation
 If any transaction is modified, its hash changes.
 This changes the Merkle Root, which changes the block header.
 Since the block hash also changes, the next block's previous hash no longer
matches.
 As a result, all subsequent block hashes would have to be recalculated.
Module 1 – INTRODUCTION BLOCKCHAIN TECHNOLOGIES

 Because mining requires finding a valid nonce that satisfies the network's difficulty
level, modifying a transaction becomes computationally expensive, making the
blockchain tamper-proof.
Conclusion
Transactions in a block are securely stored and represented using a Merkle Tree, with the
Merkle Root included in the block header. This structure allows efficient verification of
transactions while ensuring that any modification to a transaction changes the block hash and
invalidates the subsequent blockchain, thereby maintaining the integrity and security of the
blockchain.

Q11. Discuss the notion of distributed consensus.


PPT Version:
✑ Ensure that different nodes in the network see the same data at nearly the same point of
time.
✑ All nodes in the network need to agree or consent on a regular basis, that the data stored by
them is the same.
✑ No single point of failure – the data is decentralized
✑ The system can provide service even in the presence of failures
✑ Starting from early 90’s a large number of works have been devoted on the development of
consensus algorithms over a network
✑ The basic philosophy is based on message passing – inform your current state to others so
that everyone can match their current state with others in the network
✑ However, this philosophy requires that the participants in the consensus algorithm knows
each other.
✑ Can we achieve consensus even when the network is arbitrarily large, and no participant in
the network really knew all other participants?
✑ An open network scenario – the permission-less protocol – you do not record your identity
while participating in the consensus system
✑ A challenge-response based system – the network would pose a challenge, and each node
in the network would attempt to solve the challenge
[ChatGPT Version:
Distributed consensus is the process by which all nodes in a distributed blockchain network
agree on a single, consistent version of the data. It ensures that every participant maintains
the same copy of the blockchain and that only valid transactions are added to the ledger.
Notion of Distributed Consensus
1. Agreement Among All Nodes
Module 1 – INTRODUCTION BLOCKCHAIN TECHNOLOGIES

The primary objective of distributed consensus is to ensure that different nodes in the
network see the same data at nearly the same point in time. Every node must maintain an
identical copy of the blockchain to preserve consistency.
2. Regular Consensus on Data
All nodes in the network must agree (or reach consensus) regularly that the data stored by
them is the same. Before new transactions or blocks are added, participants verify and accept
them according to the network's consensus rules.
3. No Single Point of Failure
Distributed consensus eliminates the need for a central authority. Since the blockchain is
decentralized, data is stored across multiple nodes. Even if one or more nodes fail, the
remaining nodes continue to maintain the blockchain, ensuring uninterrupted service.
4. Fault Tolerance
The consensus mechanism allows the system to continue operating even in the presence of
failures or malicious nodes. As long as the required majority of honest participants agree,
the blockchain remains secure and functional.
5. Message-Passing Philosophy
From the early 1990s, significant research has focused on developing distributed consensus
algorithms. The basic philosophy is based on message passing, where each node
communicates its current state to other nodes. By exchanging information, nodes compare
their states and eventually agree on a common version of the data.
6. Limitation of Traditional Consensus
Traditional distributed consensus assumes that participants know each other and can
directly exchange messages. This assumption works well in closed or permissioned systems
but is not suitable for large public networks.
7. Consensus in Open (Permissionless) Networks
Blockchain introduces a new challenge: Can consensus be achieved when the network is
extremely large and participants do not know each other?
In a permissionless blockchain, users can participate without registering their identities.
Since participants are anonymous, traditional consensus techniques cannot be directly
applied.
8. Challenge–Response Based Consensus
To achieve consensus in permissionless networks, blockchain uses a challenge–response
mechanism.
 The network presents a computational challenge.
 Every node attempts to solve the challenge.
 The first node to produce the correct solution earns the right to add the next block.
Module 1 – INTRODUCTION BLOCKCHAIN TECHNOLOGIES

 Other nodes verify the solution and accept the block if it is valid.
This approach enables consensus among anonymous participants without requiring mutual
trust or prior knowledge of one another.
Conclusion
Distributed consensus is the foundation of blockchain technology. It ensures that all nodes
maintain the same data, eliminates single points of failure, provides fault tolerance, and
enables secure operation in decentralized networks. In permissionless blockchains, consensus
is achieved through challenge–response mechanisms, allowing thousands of anonymous
participants to agree on the state of the blockchain without relying on a central authority.
]
Q12. What are the challenges to permissionless consensus.
✑ The challenge-response protocol: The nodes in the network tries to solve the challenge
posed by the network
✑ The nodes or the participants do not need to reveal their identity
✑ The node that is able to solve the challenge first, would get to dictate what the next set of
data or state elements to be added should be
✑ This will continue iteratively at different rounds
✑ Design of a good challenge – ensures that different nodes will win the challenge at
different runs.
✑ This ensures that no node would be able to control the network
✑ The Bitcoin Proof of Work (PoW) algorithm – ensures consensus over a permission-less
setting based on challenge-response
[ChatGPT version:
A permissionless blockchain is an open network where anyone can participate without
obtaining prior approval or revealing their identity. Since there is no central authority and
participants are anonymous, achieving consensus becomes a major challenge. To address this,
permissionless blockchains use challenge–response protocols, such as the Proof of Work
(PoW) algorithm.
Challenges to Permissionless Consensus
1. Anonymous Participants
In a permissionless network, participants do not need to reveal their identity before
joining the blockchain. Since nodes cannot be identified or trusted beforehand, it becomes
difficult to determine who should validate transactions and add new blocks.
2. Challenge–Response Protocol
To achieve consensus, the network uses a challenge–response protocol.
Module 1 – INTRODUCTION BLOCKCHAIN TECHNOLOGIES

 The blockchain network generates a computational challenge.


 Every participating node attempts to solve the challenge independently.
 This process replaces the need for trust between participants and allows consensus to
be reached in an open network.
3. Competition to Solve the Challenge
All nodes compete to solve the challenge. The first node that successfully solves the
challenge earns the right to create the next block and decide the next set of valid transactions
or state updates to be added to the blockchain.
4. Iterative Consensus Process
The consensus process is repeated continuously in multiple rounds. After one block is
added, a new challenge is generated for the next block, allowing the blockchain to grow
securely while maintaining agreement among all participating nodes.
5. Designing a Good Challenge
One of the biggest challenges is designing a computational puzzle that is:
 Difficult enough to prevent manipulation.
 Easy for other nodes to verify once solved.
 Fair so that different nodes have opportunities to win over time.
A well-designed challenge prevents any single participant from gaining an unfair advantage.
6. Preventing Network Control
The challenge must ensure that different nodes win the competition in different rounds. If
the same participant consistently solved every challenge, it could gain control over the
blockchain and compromise decentralization. Therefore, the consensus mechanism should
distribute block creation opportunities fairly across the network.
7. Maintaining Decentralization and Security
Since anyone can join the network, the consensus mechanism must protect the blockchain
from malicious participants while allowing honest nodes to continue maintaining the ledger
securely without a central authority.
8. Bitcoin's Proof of Work (PoW)
The Bitcoin Proof of Work (PoW) algorithm is one of the most widely used solutions for
permissionless consensus.
 It uses a computational challenge that miners compete to solve.
 The first miner to find the correct solution earns the right to add the next block.
 Other nodes verify the solution before accepting the block.
 This challenge–response mechanism enables secure consensus in a permissionless
environment and prevents any single node from easily controlling the network.
Module 1 – INTRODUCTION BLOCKCHAIN TECHNOLOGIES

Conclusion
Permissionless consensus is challenging because participants are anonymous and no central
authority exists to coordinate the network. These challenges are overcome through
challenge–response protocols, where nodes compete to solve computational puzzles.
Bitcoin's Proof of Work (PoW) is a successful example of this approach, ensuring fairness,
decentralization, and secure consensus in an open blockchain network.
]
Q13. Write about the economics behind blockchain consensus.
✑ The challenge-response requires that every node spend large amount of computational
power to solve a mathematical challenge in each iteration of consensus.
✑ What is the incentive for nodes? Only one (or sometime a very few of them) will win in
each round
✑ The Digital Money
• Ensures operational efficiency
• More levels of controlling monetary policy
✑ 1998: Wei Dai published ‘b-money’ – an anonymous distributed cash system
✑ Cryptocurrency – a currency beyond the control of banks and governments
✑ The mining ensures that no node has the power to sabotage the network and gain control
✑ No one can hold the control of the cryptocurrency
✑ The computational effort expended by the nodes in achieving consensus would be paid for
by cryptocurrency generated and managed by the network
✑ Blockchain ensures that the currency is secure and tamper-proof.

Q14. Define cryptographic hash function. Explain its properties.


Takes any string as an input, input M: The message
Fixed size output (We use 256 bits in Blockchain), output H(M): We call this as the message
digest
Efficiently computable
✑ Collision-Free
✑ If two messages are different, then there digest also differs
✑ Hiding
✑ Hide the original message; remember about the avalanche effect
✑ Puzzle-friendly
Module 1 – INTRODUCTION BLOCKCHAIN TECHNOLOGIES

✑ Given X and Y, find out k such that Y =H ¿ - used to solve the mining puzzle in Bitcoin
PoW
Collision Free:
✑ Hash functions are one-way, given a x , it is easy to find H (x ), however, given a H (x ), no
deterministic algorithm can find x
✑ It is difficult to find x and y , such that x ≠ y ; however H ( x )=H ( y )
✑ Note the phase difficult to find, collision is not impossible
✑ Try with randomly chosen inputs to find out a collision – but it takes too long
✑ It may be easy to find out collision for some hash functions
✑ Birthday Paradox: Find the probability that in a set of n randomly chosen people, some of
them will have the same birthday
✑ By Pigeonhole Principle, the probability reaches 1 when number of people reaches 366
(not a leap year) or 367 (a leap year)
✑ 0.999 probability is reached with just ~70 people, and 0.5 probability is reached with only
~23 people

Q15. Explain the use of message digest.


✑ If we observe H ( x )=H ( y ), it is safe to assume x= y
✑ We need to remember just the hash value rather than the entire message
– we call this as the message digest
✑ To check if two messages x and y are same, x= y , then check whether H ( x )=H ( y )
✑ This is efficient because the size of the digest is significantly less than the size of the
original messages
✑ Given a H (x ), it is “computationally difficult” to find x
✑ The difficulty depends on the size of the message digests
✑ Hiding helps to commit a value and then check it later
✑ Compute the message digest and store it in a digest store – commit
✑ To check whether a message has been committed, match the message digest at the digest
store.

Q16. Apply SHA-256 in Bitcoin mining to construct a blockchain.


Module 1 – INTRODUCTION BLOCKCHAIN TECHNOLOGIES

✑ SHA256 is used in Bitcoin mining – to construct the Bitcoin blockchain


✑ Secure Hash Algorithm (SHA) that generates 256 bit message digest
✑ A part of SHA-2, a set of cryptographic hash functions designed by United States National
Security Agency (NSA)
✑ Pad the message such that the message size is multiple of 512
✑ Suppose that the length of the message M is l ; and l mod 512≠ 0
Append the bit “1” at the end of the message
Append k zero bits, where k is the smallest non-negative solution to the equation
l+1+k ≡ 448 mod 512
Append the 64-bit block which is equal to the number l written in binary
The total length gets divisible by 512
✑ Parse the message into N 512-bit blocks M (1), M (2) ,…, M (N)

✑ Every 512 bit block is further divided into 32 bit sub-blocks M (i) (i) (i)
0 , M 1 ,…, M 15

✑ The message blocks are processed one at a time


✑ Start with a fix initial hash value H (0 )
(i ) (i−1) ( i −1 )
✑ Sequentially compute H =H +C M (H ); C is the SHA-256 compression function
( i)

and + means mod 232 addition. H (N ) is the hash of M .

[Q16. Apply SHA-256 in Bitcoin mining to construct a blockchain. (8 Marks)


Introduction
SHA-256 (Secure Hash Algorithm-256) is the cryptographic hash function used in Bitcoin
mining to construct and secure the Bitcoin blockchain. It belongs to the SHA-2 family of
hash functions designed by the National Security Agency (NSA) and produces a 256-bit
(32-byte) message digest. In Bitcoin, SHA-256 is used to generate the block hash, ensuring
data integrity and making the blockchain tamper-proof.
Module 1 – INTRODUCTION BLOCKCHAIN TECHNOLOGIES

Steps of SHA-256 in Bitcoin Mining


1. SHA-256 Hash Function
SHA-256 takes an input message of any length and generates a fixed 256-bit hash value.
Even a small change in the input produces a completely different hash, making it suitable for
blockchain security.
2. Message Padding
Before hashing, the input message must be padded so that its length becomes a multiple of
512 bits.
If the length of the message is l bits and l mod 512 ≠ 0, the following steps are performed:
 Append a single bit '1' to the end of the message.
 Append k zero bits, where k is the smallest non-negative integer satisfying:
 l+1+k≡448(mod512)

 Finally, append a 64-bit binary representation of the original message length l.


After padding, the total message length becomes exactly divisible by 512 bits.
3. Divide the Message into Blocks
The padded message is divided into N blocks, each of 512 bits.
M(1),M(2),…,M(N)

4. Divide Each Block into Sub-blocks


Each 512-bit block is further divided into 16 sub-blocks, each of 32 bits.
M0(i),M1(i),…,M15(i)

These sub-blocks are processed by the SHA-256 compression function.


5. Initialize the Hash Value
SHA-256 starts with a fixed initial hash value, denoted by:
H(0)
This predefined value acts as the starting point for the hashing process.
6. Process Each Message Block
The message blocks are processed one at a time using the SHA-256 compression function.
For each block:
H(i)=H(i−1)+C M(i)(H(i−1))

where:
 C = SHA-256 compression function
Module 1 – INTRODUCTION BLOCKCHAIN TECHNOLOGIES

 + = Addition modulo (2^{32})


The output hash from one block becomes the input for the next block.
7. Generate the Final Hash
After processing all N message blocks, the final hash is obtained as:
HN
This 256-bit hash represents the message digest and is used as the block hash in Bitcoin.
8. Role of SHA-256 in Bitcoin Mining
In Bitcoin mining:
 SHA-256 is used to hash the block header.
 Miners repeatedly change the nonce and compute the hash.
 The objective is to find a hash that satisfies the required difficulty level (for example,
a hash with a specified number of leading zeros).
 Once a valid hash is found, the block is added to the blockchain.
 Since each block contains the hash of the previous block, changing any block would
require recalculating the hashes of all subsequent blocks, making the blockchain
highly secure and tamper-resistant.
Conclusion
SHA-256 is the core cryptographic algorithm used in Bitcoin mining. It converts data into a
unique 256-bit hash, processes data in 512-bit blocks, and generates secure block hashes. By
linking each block through cryptographic hashes and requiring miners to solve computational
puzzles, SHA-256 ensures the integrity, immutability, and security of the Bitcoin blockchain.
]

Q17. Define hash pointer and explain how it helps in detecting tampered data.
✑ A Cryptographic Hash Pointer is a pointer to a location where
✑ some information is stored
✑ Hash of the information is stored
✑ With the hash pointer, we can
✑ Retrieve the information
✑ Check that the information has not been modified (by computing the message digest and
then matching the digest with the stored hash value)
Module 1 – INTRODUCTION BLOCKCHAIN TECHNOLOGIES

Q18. Write about Merkle tree.

Q19. Define digital signature and specify the purpose of it.


Module 1 – INTRODUCTION BLOCKCHAIN TECHNOLOGIES

✑ A digital code, which can be included with an electronically transmitted document to


verify
✑ The content of the document is authenticated
✑ The identity of the sender
✑ Prevent non-repudiation – sender will not be able to deny about the origin of the
document
✑ Only the signing authority can sign a document, but everyone can verify the signature
✑ Signature is associated with the particular document
– Signature of one document cannot be transferred to another document
[ChatGPT Version:
A digital signature is a digital code that is attached to an electronically
transmitted document or message to verify its authenticity and integrity.
It is created using cryptographic techniques and ensures that the
document has been sent by the legitimate sender and has not been
altered during transmission.
Definition of Digital Signature
A digital signature is a cryptographic mechanism used to authenticate
an electronic document. It provides proof of the sender's identity and
confirms that the contents of the document remain unchanged after it has
been signed.
Purpose of Digital Signature
1. Authentication of Document Content
A digital signature verifies that the content of the document is
authentic and has not been modified after it was signed. If even a single
bit of the document changes, the signature becomes invalid.
2. Verification of Sender's Identity
A digital signature confirms the identity of the sender. The recipient
can verify that the document was signed by the claimed sender and not
by an unauthorized person.
3. Ensures Non-Repudiation
Digital signatures provide non-repudiation, meaning the sender cannot
deny having signed or sent the document. Since the signature is
generated using the sender's private key, it serves as proof of origin.
4. Only the Signing Authority Can Sign
Module 1 – INTRODUCTION BLOCKCHAIN TECHNOLOGIES

A digital signature is created using the private key of the signing


authority. Since the private key is known only to the owner, only the
authorized person can generate the signature.
5. Anyone Can Verify the Signature
Although only the owner can create the signature, anyone can verify it
using the corresponding public key. This allows recipients to confirm the
authenticity of the document without requiring access to the private key.
6. Signature is Bound to the Document
A digital signature is associated with a particular document. It is
generated from the document's contents, so the signature is unique to
that specific document.
7. Cannot Be Transferred to Another Document
A signature created for one document cannot be copied or transferred
to another document. If someone attempts to attach the same signature
to a different document, the verification process will fail because the
document contents have changed.
Advantages of Digital Signature
 Verifies the authenticity of the document.
 Confirms the identity of the sender.
 Ensures data integrity by detecting modifications.
 Provides non-repudiation.
 Enables secure electronic communication and transactions.
Conclusion
A digital signature is an essential cryptographic tool used to secure
electronic documents and communications. It authenticates the
document, verifies the sender's identity, ensures data integrity, and
prevents repudiation. Since only the signing authority can create the
signature while anyone can verify it, digital signatures provide trust and
security in digital transactions.
]

Q20. Explain RSA for key generation and distribution.


✑ Named over (Ron) Rivest – (Adi) Shamir – (Leonard) Adleman – inventors of the public
key cryptosystem
✑ The encryption key is public and decryption key is kept secret (private key)
Module 1 – INTRODUCTION BLOCKCHAIN TECHNOLOGIES

✑ Anyone can encrypt the data


✑ Only the intended receiver can decrypt the data

✑ Four phases
✑ Key generation
✑ Key distribution
✑ Encryption
✑ Decryption

large positive integers 𝑒, 𝑑 and 𝑛; such that modular exponentiation for integers 𝑚
✑ It is feasible to find three very

(0≤𝑚<𝑛):
✑ Even if you know 𝑒𝑒, 𝑛𝑛 and 𝑚𝑚; it is extremely difficult to find 𝑑
Note that
✑ (𝑒,𝑛) is used as the public key and (𝑑,𝑛) is used as the private key. 𝑚 is the
message that needs to be encrypted.
RSA Key Generation and Distribution.
✑ Chose two distinct prime integer numbers 𝑝 and 𝑞
𝑝 and 𝑞 should be chosen at random to ensure tight security
✑ Compute 𝑛=𝑝q; 𝑛 is used as the modulus, the length of 𝑛 is called the key length
✑ Compute 𝜙𝑛= (𝑝−1)(𝑞−1) – Euler totient function
Choose an integer 𝑒 such that 1<𝑒<𝜙(𝑛) and gcd𝑒,𝜙𝑛=1; 𝑒 and 𝜙(𝑛) are co-prime
✑ Determine 𝑑=𝑒−1(mod(𝜙𝑛)) : 𝑑 is the modular multiplicative inverse of
𝑒(mod(𝜙𝑛)) [Note 𝑑.𝑒=1(mod(𝜙𝑛))]
[ChatGPT version:
RSA (Rivest–Shamir–Adleman) is one of the most widely used
public-key cryptographic algorithms. It is named after its
inventors Ron Rivest, Adi Shamir, and Leonard Adleman. RSA
uses two different keys:
 Public Key – used for encryption and can be shared openly.
 Private Key – used for decryption and kept secret by the receiver.
This allows anyone to encrypt data, but only the intended
receiver can decrypt it.
Module 1 – INTRODUCTION BLOCKCHAIN TECHNOLOGIES

Phases of RSA
RSA consists of four phases:
1. Key Generation
2. Key Distribution
3. Encryption
4. Decryption
1. Key Generation
The following steps are used to generate the RSA public and private
keys.
Step 1: Choose Two Prime Numbers
Select two large, distinct prime numbers: p and q
The values of (p) and (q) should be chosen randomly to ensure
strong security.
Step 2: Compute the Modulus
Calculate: n = p x q
The value n is called the modulus, and its size determines the key
length.
Step 3: Compute Euler's Totient Function
Calculate: 𝜙𝑛= (𝑝−1)(𝑞−1)
This value is required for generating the encryption and decryption
keys.
Step 4: Choose the Public Exponent
Choose an integer e such that: 1<𝑒<𝜙(𝑛)
And gcd𝑒,𝜙𝑛=1
This means e and 𝜙𝑛 must be co-prime.
Step 5: Compute the Private Exponent
Calculate d, the modular multiplicative inverse of e:
d=e−1(modϕ(n))

which satisfies: d×e≡1(modϕ(n))


2. Key Distribution
After key generation:
Module 1 – INTRODUCTION BLOCKCHAIN TECHNOLOGIES

 The public key is: (e, n)


It is distributed openly and can be used by anyone to encrypt
messages.
 The private key is: (d, n)
It is kept secret by the receiver and is used only for decrypting
messages.
3. Encryption
Suppose m is the message to be encrypted, where: 0≤m<n
The sender encrypts the message using the public key:
C=me(mod n)

where:
 m = original message
 C = ciphertext
Since the public key is publicly available, anyone can perform
encryption.
4. Decryption
The receiver decrypts the ciphertext using the private key:
m = Cd (mod n)
Only the receiver knows the private key d, making it
computationally infeasible for others to recover the original
message.
Security of RSA
RSA security is based on the difficulty of determining the private key
d even if e, n, and the encrypted message are known.
Although the public key ((e,n)) is available to everyone, it is
extremely difficult to compute the private key because it requires
factoring the large number (n) into its prime factors (p) and (q),
which is computationally infeasible for sufficiently large keys.
Conclusion
RSA is a secure public-key cryptosystem used for key generation,
key distribution, encryption, and decryption. It uses a public key
((e,n)) for encryption and a private key ((d,n)) for decryption.
The security of RSA depends on the difficulty of factoring large
prime numbers, making it one of the most widely used algorithms
for secure communication and digital security.
Module 1 – INTRODUCTION BLOCKCHAIN TECHNOLOGIES

]
Q21. Apply public key cryptography to generate a digital signature.
✑ Properties of a cryptographic key (you need to prevent it from being guessed)
✑ Generate the key truly randomly so that the attacker can not guess it
✑ The key should be of sufficient length – increasing the length makes the key difficult to
guess
✑ The key should contain sufficient entropy, all the bits in the key should be equally random
✑ Two keys are used
✑ Private key: Only Alice has her private key
✑ Public key: “Public” to everyone – everyone knows Alice’s public key

Q22. How is cyptocurrency transmitted using hash chain and digital signature.
A Cryptocurrency using Hashchain and Digital Signatures

A:10, Sig(A)

Alice generate 10 coins


Sign the transaction A:10 using Alice’s private key and put that in the blockchain.

Alice transfers 5 coins to Bob


Sign the transaction A-B:5 using Alice’s private key and put that in the blockchain

You might also like