0% found this document useful (0 votes)
16 views32 pages

Chapter 2

Uploaded by

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

Chapter 2

Uploaded by

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

INTRODUCTION

to BLOCKCHAIN
CHAPTER2: TECHNICAL
ARCHITECTURE AND BASIC
COMPONENTS
Dr. Noureddine Lasla

Sep – Dec 2024


Chapter Overview

Objective:
Understanding the building blocks of blockchain systems.
Key Areas of Focus:
 Introduction to Blockchain Architecture
 Blockchain Architecture (Nodes, Ledgers, P2P Net.)
 Block Structure (Merkle Trees and Hash Functions)
 Public and Private Key Cryptography
 Data Integrity, Security Mechanisms, and Attacks
Introduction to
Blockchain
Architecture
What is Blockchain Architecture?

 Blockchain architecture refers to the structural framework


and design principles that underpin a decentralized and
distributed digital ledger system.

 It enables trustless interactions between participants without


the need for intermediaries.

 This architecture is built upon key components such as


nodes, cryptographic hashing, consensus mechanisms, and
a peer-to-peer network,
Key Components of Blockchain
Architecture
1. Blockchain Nodes:
 Independent devices (computers) that maintain
the blockchain's ledger.
 Store and validate data in a decentralized
manner.
 Types:
 Full nodes: maintain a complete copy of the
blockchain and participate in validating
transactions),
 Light nodes only store the most recent
headers
Key Components of Blockchain
Architecture
Blockchain Nodes Functionalities:
 Maintenance and synchronization of
ledger copies
 If few individual nodes are affected, the
data remains safe and accessible for the
network as a whole
 Transaction validation and consensus
mechanism
 User interaction and network connectivity
 Block explorers.
Key Components of Blockchain
Architecture
2. Ledger
 Set of blocks chained together
 Each block is a units of data containing transactions.
 A distributed record of all transactions within the network
 Shared and synchronized among all nodes in the blockchain system.

101010 10011 11101 10001

101010 10011 11101 10001 00000


Key Components of Blockchain
Architecture
3. Peer-to-Peer Network
 Allows blockchain nodes to directly interact with each other
 Nodes use the P2P network to exchange information, such as:
transactions, block proposals, and consensus messages.
 Ensures that updates (e.g., new transactions or blocks) are
distributed across all nodes efficiently and securely.
 Enhances fault tolerance since the system remains operational
even if some nodes go offline.
Key Components of Blockchain
Architecture
4. Consensus Mechanisms
 Algorithms that ensure agreement across
nodes (e.g., Proof of Work, Proof of Stake).
 Prevents double-spending and ensures
consistency.
Blockchain Transaction Lifecycle

A transaction is A new block is The new block is Nodes in the net.


sent by user to the created to include broadcasted to Validate the block
net. that transaction the entire net. and transaction

The blockchain The new block is Nodes received


The transaction is
update is distributed added to the reward for their
complete
across the net. blockchain ledger participation (PoW)
Block Structure
Inside the Block Header
Fields in the Header:
 Hash of the Previous Block:
 Links the current block to the previous one.
 Ensures immutability.
 Merkle Root:
 Root hash of the Merkle tree (represents transactions).
 Efficient verification of data integrity.
 Timestamp
 Nonce
 Difficulty Target:
 Defines the mining challenge level.
Hash Function
A function that converts input data into a fixed-size alphanumeric
string. Example: SHA-256 (Secure Hash Algorithm).
 Key Properties:
1. Deterministic: Same input always produces the same output.
2. Collision-Resistant: Two different inputs cannot produce the same output.
3. Fast Computation: Hashes are computed efficiently.
4. Pre-image Resistance: Cannot reverse-engineer the input from the hash.
 Role in Blockchain
 Secures transaction data.
 Links blocks using hash pointers.
 Ensures tamper-proof records.
Hash Function

Example:

SHA-256("Blockchain") =

4a8a08f09d37b73795649038408b5f33fba404ba622bfbb23b6ad13c6b5b1e1c
Hash Function in Practice

 SHA-256 (Secure Hash Algorithm 256-bit):


 Widely used in Bitcoin for Proof of Work (PoW).
 Strong cryptographic security.
 Keccak-256 (SHA-3):
 Used in Ethereum.
 Resistant to length-extension attacks.

Hash Function Key Application Strengths Use in Blockchain


SHA-256 Mining, PoW Secure, fast Bitcoin
Resistant to
Keccak-256 Smart Contracts Ethereum
attacks
Merkle Tree

A binary tree where leaf nodes represent hashes of transactions, and


parent nodes represent combined hashes of their children.
Structure
1. Each transaction is hashed individually
2. Hash pairs are combined iteratively to create the Merkle root
 Benefits
 Efficient transaction verification
 Reduced storage requirements.
 Ensures integrity without downloading the entire blockchain.
Merkle Tree

Ralph Merkle patented the hash tree


in 1979
Is an American computer scientist and
mathematician. He is one of the inventors
of public-key cryptography and the
inventor of cryptographic hashing,
Merkle Trees
Merkle Trees

Hash(Node) = Hash(Left Child || Right Child)


Merkle Trees
The root hash summarizes all data contained in related individual transactions
Merkle Trees
Merkle tree example :

Want to Proof that 41b6 is actually included in the Merkle tree


Merkle Trees
only need to have the hashes in color: [41b6, a8c0, 1013, b5fb, f94a]

With 41b6, we need a8c0 to reconstruct 8fca.


With 8fca, we need 1013 to reconstruct 87fd.
With 87fd, we need b5fb to reconstruct 7460. we can determine that we only
With 7460 we need f94a to reconstruct da07, the Merkle root.
need about log(n) number of
hashes to be able to check if a
If after applying our hash (41b6) to the Merkle proof we get the
hash belongs to a certain Merkle
expected da07 Merkle root, then we know that our hash is part
root, which is efficient
of the Merkle root.
Benefits of Merkle Trees in Blockchain
 Scalability:
• Enables light clients (e.g., SPV - Simplified Payment Verification) to
verify transactions without downloading the entire blockchain.
 Verification Efficiency:
• Verifying a transaction only requires a few hashes along the Merkle
path (logarithmic time complexity).
 Tamper Detection:
• If any transaction or data changes, the Merkle root changes,
enabling quick detection of tampering.
 Storage Optimization:
• Transactions are summarized into a single hash, reducing the space
required in the block header.
Introduction to
Cryptography in
Blockchain
Introduction to Cryptography

Cryptography secures communication and ensures data integrity and


authenticity.

Types of Cryptography in Blockchain:


 Symmetric Cryptography: Single key for encryption and decryption
(not commonly used in blockchain).
 Asymmetric Cryptography: Public and private key pair for secure
communication (widely used).
Introduction to Cryptography

 Importance in Blockchain:
 Secures transactions.
 Provides user identity through digital signatures.
 Protects the integrity of the blockchain.
Public and Private Keys in Blockchain

 Key Components:
 Public Key: Shared openly, used for encryption.
 Private Key: Kept secret, used for decryption and digital signatures.

 How It Works:
 Sender encrypts data with the recipient's public key.
 Recipient decrypts the data using their private key.

 Use in Blockchain:
 Public keys are used as wallet addresses.
 Private keys sign transactions to prove authenticity.
Digital Signatures in Blockchain
Is a cryptographic technique that ensures:
 Authenticity: Verifies the sender.
 Integrity: Confirms the data has not been altered.
 How It Works:
 Sender signs the data using their private key.
 Receiver verifies the signature using the sender’s
public key.
 Use in Blockchain:
 Validates transactions.
 Prevents unauthorized access.
Digital Signatures in Blockchain
Security Mechanisms in Blockchain
Ensuring Security in Blockchain
 Consensus Mechanisms:
 Proof of Work (PoW).
 Proof of Stake (PoS).
 Byzantine Fault Tolerance (BFT).
 Encryption:
 Public and Private Key Cryptography.
 Secures transaction data.
 Smart Contract Audits:
 Prevents vulnerabilities in automated code execution
Common Security Threats to Blockchain

 51% Attack:
 Malicious actors gain majority control of network.
 Sybil Attack:
 Attackers create multiple fake identities to disrupt consensus.
 Double Spending Attack:
 Exploiting system to spend the same asset multiple times.
 Eclipse Attack:
 Isolating nodes to manipulate their view of the blockchain.
Preventing Blockchain Attacks

 Distributed Consensus Protocols:


 Mitigates 51% attacks.
 Node Verification:
 Prevents Sybil attacks by authenticating identities.
 Encryption Standards:
 Secures data transfer and storage.
 Regular Network Audits:
 Identifies vulnerabilities proactively.

You might also like