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

Mod 1 2 Block

The document provides an overview of blockchain technology, explaining its structure, components, and benefits, such as security, transparency, and decentralization. It also discusses distributed ledger technology, digital signatures, and various cryptographic concepts, including hash functions and zero-knowledge proofs. Additionally, it highlights the applications of blockchain in fields like healthcare, finance, and voting, as well as the importance of fault tolerance and efficient data management in distributed systems.

Uploaded by

devaanirudh323
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 views26 pages

Mod 1 2 Block

The document provides an overview of blockchain technology, explaining its structure, components, and benefits, such as security, transparency, and decentralization. It also discusses distributed ledger technology, digital signatures, and various cryptographic concepts, including hash functions and zero-knowledge proofs. Additionally, it highlights the applications of blockchain in fields like healthcare, finance, and voting, as well as the importance of fault tolerance and efficient data management in distributed systems.

Uploaded by

devaanirudh323
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/ 26

Block Chain

What is a Block in Blockchain

• A block in block chain is a place where our data stores


○ In crypto , transactions are stored in block
• Each block is linked to the previous one using a hash.
• Since all the blocks are connected with chain the name is block chain
• Blocks store the transactions in a merkle tree
• First block in any block chain are called Genesis Block

• Example:
○ A transaction is done
 Then a new block will be created for that transaction
 Then this block is added to the block chain

Main Parts of Block


• Data Section:
○ This part holds the important details of the transaction, like who is
sending money to whom and how much.
• Hash:
○ This is a unique code that is created to secure the information in the
block.
 It ensures that no one can tamper with the data in the block.
• Header:
○ This part has extra info:
 A timestamp, which shows when the block was created.
 The previous block’s hash, which connects this block to the one
before it, forming a chain.

What is Blockchain?
• Blockchain is a special kind of digital record-keeping system.
• It’s like a notebook that’s copied and stored on many computers all over
the world.
○ Copies of the data is stored around the world
• Why it’s safe:
○ Everyone can see the same data, so no one can hide or change
anything without others noticing.
• Bitcoin is the first major example that uses blockchain.

What is Blockchain Technology? (Also known as Distributed Ledger


Technology or DLT)
• With the help of Blockchain people can make transactions without using a
middleman, like a bank.
• The data is saved on many computers, not just one server.
• Since everyone sees the same information, it’s very hard to cheat.
• It’s secure, transparent, and decentralized, which means no single person
or company controls it.

Why Use Blockchain?


1. Fast & Accurate – Transactions happen quickly and can’t be changed.
2. Trust & Transparency – Everyone sees the same data, so there’s less
chance of fraud.
3. Tamper-Proof – Good for things like legal documents because you can’t
change them easily.
4. Safe Transactions – Protects against hacking and identity theft.
5. No Middleman – No need for banks or central authorities, making
transactions simpler.

How Blockchain Works?


1. Every transaction is written in a digital ledger (like an online notebook).
2. Each transaction gets a unique hash.
3. For each transaction done a new block will be created
○ This block will contain its data and hash
 And also the hash of previous block
4. This blokcs are added in the order the transactions had happen
5. Each new block is linked to the one before it, using the previous blocks
hash.

6. If even a small detail changes, the hash changes, making it easy to spot
fraud.
○ If the hash changes then the link will be broken
 By this every one can understands that the data is corrupted
7. Computers (called nodes) check and verify the transactions.
8. If most computers agree, the transaction is added to the blockchain.
9. In this way the blocks will be keep on adding
Where is Blockchain Used?
Blockchain is useful in many areas:
• Healthcare: Keeping medical records safe.
• Legal Documents: Protecting important legal papers (like wills).
• Voting: Making digital elections secure.
• Real Estate: Making property buying and selling more transparent.
• Data Sharing: Sharing information securely and efficiently.
Distributed Ledger Technology

Normal Ledger Technology (Centralized Ledger)


• Transactions are stored in one place (a single ledger), like a bank's
database.
• If someone wants to modify data, they only need to change it in one
place, making it easy for fraud.
Distributed Ledger Technology (DLT)
• Transactions are stored across multiple computers (nodes) instead of a
single location.
• If someone tries to change the data, they must modify it on the majority
of computers, which is extremely difficult.
• If a hacker still tries to modify a transaction, the other nodes will detect
the mismatch and reject the change.
• This makes DLT transparent, secure, and hard to tamper with.

Key Features of DLT


1. Decentralized – Doesnot have a centralized thing,every computer/node
has a copy of the data.
2. Immutable – Once written, data cannot be changed or deleted.
3. Append-Only – You can only add new data, not modify old records.
4. Distributed – The data is spread across multiple computers, so no one
controls everything.
5. Shared – Some computers store full copies, while others store only what
they need.
6. Fault-Tolerant – If some computers fail, the data still exists on others.
7. Transparent – Everyone can see transactions, which builds trust.
8. Efficient – Faster transactions than traditional banks.
9. Secure – Uses cryptography (advanced math codes) to stop fraud.
Distributed Database System

A Distributed Database is a database where data is spread across multiple


computers instead of being stored on one system. Even though the data is
stored in different locations, it looks like a single database to users.

Types of Distributed Databases


1. Homogeneous Database (Same Everywhere)
 All computers use the same software, database system, and
structure.
 Easy to manage because everything is uniform.
2. Heterogeneous Database (Different Systems)
 Different computers use different database systems, software,
and data formats.
 Needs translation to allow communication between different
systems.

How Data is Stored?


1. Replication (Copying Data)
 Same data is copied to multiple locations.
 Faster access & more availability (even if one copy fails, others
exist).
 Hard to update because all copies must be changed at once.
2. Fragmentation (Dividing Data)
 Data is split into parts and stored where needed (no
duplication).
 Horizontal Fragmentation → Divides data by rows (e.g., Indian
customer data in India, U.S. data in the U.S.).
 Vertical Fragmentation → Divides data by columns, keeping a
common key to combine later.

Architectures of Distributed Database Systems


1. Client-Server Architecture
○ One central server stores and manages the database.
○ Clients (users) connect to access data.
2. Peer-to-Peer Architecture
○ No central server—each computer manages its own data.
○ All computers are equal and share data with each other.
3. Federated Architecture
○ Each site has its own database, but they are connected through
middleware (a bridge).
○ Allows easy access while keeping databases separate.
Where Are Distributed Databases Used?
• E-commerce – Stores data for online shopping (products, orders,
payments).
• Banking & Finance – Manages banking transactions, stock market records.
• Telecommunications – Stores customer details, call logs, and network
records.
Problems

Two Generals' Problem

• By this we can understand that if there is an unreliable communication


then certainity is not always guaranteed

Byzantine Generals' Problem


• Its is an advanced version of 2 generals problems
• Here we will be having many generals and some of them are traitors
○ These traitors try to send false messages to confuse others
• Honest generals need a way to detect and ignore false messages.
• Key Issue:
○ A system must be able to function correctly even when some
participants act maliciously.

Byzantine Fault Tolerance (BFT) – The Solution


• BFT is the solution for BGP
• BFT helps a system work correctly even when some nodes (computers)
fail or act maliciously.
How does BFT work?
i. Nodes (computers) talk to each other and compare messages.
ii. A majority agreement is needed before any decision is accepted.
iii. Even if some computers fail or lie, the correct decision is made
by the honest majority.
Hadoop Distributed File System (HDFS)

HDFS is the storage system used by Hadoop to manage huge amounts of data
across many computers.

Key Features of HDFS


1. Distributed Storage: Data is spread across multiple machines instead of
one.
2. Fault Tolerance: Even if some machines fail, data is still available.
3. High Throughput: Fast data processing to handle big data.
4. Scalability: Can easily handle more data as it grows.

HDFS Components
1. NameNode (Master Node)
○ Manages metadata
 Meta data means data about data (info about files like name,
location, permissions).
○ NameNode manages the DataNodes.
2. DataNodes (Worker Nodes)
○ Stores actual data in blocks (small pieces).
○ Reports to the NameNode about its status.

HDFS Architecture
1. Client: Reads and writes data from HDFS.
2. NameNode: Manages metadata and assigns DataNodes for storage.
3. DataNodes: Store actual data in blocks (default size = 128 MB).
4. Replication: Data is copied to multiple DataNodes to prevent loss
(default: 3 copies).
5. Racks: Groups of machines organized to improve performance and fault
tolerance.

How HDFS Works


1. Write Operation
○ The client wants to write data.
○ The NameNode decides where to store the data and assigns
DataNodes.
○ The data is written to multiple DataNodes for safety (replication).
2. Read Operation
○ The client wants to read data.
○ The NameNode tells the client where the data is stored (which
DataNodes).
○ The client then reads the data directly from the DataNodes.
Why Use Hadoop?
• Handles massive data efficiently.
• Fault-tolerant (even if some machines fail).
• Scalable (grows easily as more data is added).
• Optimized for parallel processing (faster data handling).
• Ensures data security and reliability.
1. Hash Pointer
○ A hash pointer is like a regular pointer, but it not only points to data
but also stores a hash of that data.
 Regular Pointer: Points only to data.
 Hash Pointer: Points to data and also has the data's hash.
Why is it useful?
 It helps check if data has been tampered with. If the data
changes, the hash will change too, so it's easy to detect.
Where is it used?
 Blockchain: Blocks are linked using hash pointers.
 Tamper-proof logs: To keep data secure and prevent
unauthorized changes.
 Merkle Trees: For efficient data verification.

2. Blockchain and Hash Pointers


○ In Blockchain, each block has a hash pointer that links to the
previous block, creating a chain.
 Genesis Block: The first block in the chain.
Why is Blockchain secure?
 If someone tries to change a block, the hash pointers in all
following blocks will become wrong, so tampering is easy to
spot.

3. Merkle Tree
○ A Merkle Tree is a tree where each node contains the hash of its
child nodes.
 Leaf Nodes: Contain data.
 Parent Nodes: Contain the hashes of child nodes.
 This continues until there's only one root node at the top.
Why use a Merkle Tree?
 Efficient Verification: You only need a small part of the tree to
verify data.
 Used in Blockchain (like Bitcoin) to check data quickly and
securely.

4. Cryptographic Hash Functions


○ A hash function takes any input (like a word or number) and turns it
into a fixed-length hash value (a random string of characters).
 Example: "Hello" → "a9f0d3c..." (hash value)
Why are hash functions important?
 They secure data.
 They stop unauthorized changes.
 Used in password storage, blockchain, and digital signatures.

5. Properties of Hash Functions


1. Determinism: Same input gives the same hash every time.
2. Collision Resistance: It’s hard for two different inputs to give the
same hash.
3. Preimage Resistance: You can’t reverse a hash to find the original
input.
4. Avalanche Effect: A small change in input makes the hash completely
different.
5. Non-Reversibility: You can't go back from the hash to the original
data.
6. Efficiency: Hashing is quick.
7. Puzzle-Friendly: Used in Bitcoin mining to solve difficult problems for
verification.

Where Are Hash Functions Used?


• Cryptography (to secure data)
• Blockchain (to create secure chains of blocks)
• Digital Signatures (to verify authenticity)
• Password Storage (to securely store passwords)
• Bitcoin Mining (to create puzzles for mining)
Digital Signature

What is a Digital Signature?


• A digital signature is like an electronic stamp which will be send by sender
to the reciver with the message
○ This proves,who sent that message (like an email) and shows that the
message hasn't been changed since it was sent.
 By this reciver can understand that the message came from a
valid sender and the message isn't tampered

Importance of a Digital Signature


1. Message Authentication:
○ When you verify a digital signature, you know the sender is who they
say they are.
 Private key of a person is required to create a signature
 Since private key of sender is only known to the sender, reciever
comes to a conclusion that the message came from a valid
sender
2. Data Integrity:
○ If someone tries to change the message after it has been signed, the
verification will fail, meaning the message hasn’t been altered.
3. Non-repudiation:
○ The sender can’t deny sending the message because they are the
only one who can create that specific digital signature. If there’s ever
a disagreement, the digital signature proves who sent it.

Key Management
• Private Key:
○ Used to sign the message, and kept secret by the owner.
• Public Key:
○ Used by others to verify the signature. It’s open to everyone, but we
need a system to make sure it really belongs to the person we think it
does.
Verifiable Random Function (VRF)
What is a VRF?
• A Verifiable Random Function (VRF) creates a random number that
seems unpredictable to everyone, but also provides proof that the
number is valid.
○ Random Number: It looks random, but it’s actually generated in a
secure way.
○ Proof: The proof shows that the random number is valid without
revealing the private key used to generate it.

Key Features of VRF:


1. Verifiable:
 Anyone can check that the number is valid, but only the person
with the secret key can create it.
2. Random:
 The number looks random to everyone unless you know the
secret key.
3. Function:
 A special math formula generates both the random number and
the proof that proves it's valid.

Elliptic Curve Digital Signature Algorithm (ECDSA) – Simplified


• ECDSA is a method used to create digital signatures in Bitcoin and other
cryptocurrencies.
• It uses elliptic curves (a type of math) to make it harder to break than
traditional methods, making the system more secure.

Memory-Hard Algorithm – Simplified


• Memory-Hard Algorithms are used in blockchains to stop big companies
with powerful machines from dominating the mining process.
• These algorithms need a lot of memory to solve, making it harder for
attackers to take over mining.
• Examples: Ethash, Equihash, CryptoNight.

Zero Knowledge Proof (ZKP) – Simplified


• A Zero Knowledge Proof (ZKP) lets you prove you know something
without revealing the actual information.
○ Example: You can prove you know the password to a website
without actually showing the password.

Three Key Properties of ZKP:


1. Completeness:
○ If the statement is true, the person checking will be convinced it’s
true.
2. Soundness:
○ If the statement is false, no one can trick the verifier into believing
it’s true.
3. Zero-knowledge:
○ The verifier only learns that the statement is true, but doesn’t learn
any other information.

To Remember for Exams:


• VRF: Generates a random number with proof that it’s valid, without
revealing the secret key.
• ECDSA: A secure method of creating digital signatures using elliptic curve
math.
• Memory-Hard Algorithms: Require a lot of memory to prevent powerful
companies from dominating mining.
• Zero Knowledge Proof (ZKP): Proves you know something without
revealing the actual information.
Bitcoin Transaction Process

1. Initiating the Transaction:


• Someone (let's call them Person A) wants to send Bitcoin to someone else
(Person B).
• Person A creates a transaction by specifying the amount of Bitcoin they
want to send, and Person B's Bitcoin address.
2. Transaction Signing:
• Person A needs to "prove" they own the Bitcoin they want to send.
• To do this, Person A uses their private key to sign the transaction. This is
like a digital signature that confirms the transaction is genuine and
authorized by Person A.
3. Broadcasting the Transaction:
• Once signed, Person A sends this transaction to the Bitcoin network (the
"blockchain").
• The transaction is broadcast to a network of Bitcoin miners.
4. Verification by Miners:
• Miners check the transaction to make sure it’s valid. They look for things
like:
○ Does Person A have enough Bitcoin to send?
○ Is the signature valid?
• If everything checks out, miners creates a block for this transaction.
5. Adding to the Blockchain:
• Once the transaction is verified, the block containing the transaction is
added to the blockchain
6. Confirmation:
• Once the block is added, the transaction is considered confirmed.
• Person B can now see that they’ve received the Bitcoin.
7. Completion:
• The transaction is complete. The Bitcoin has officially moved from Person
A's wallet to Person B's wallet.
Double Spending

• Double-spending is when someone tries to spend the same Bitcoin more


than once.
• Imagine you have a $10 bill and try to spend it at two different stores at
the same time we cannot do that because its physical money.
• But Bitcoin is digital, it's possible to copy and send the same Bitcoin to
multiple people, leading to a "double-spending" problem.

How Bitcoin Solves Double-Spending


Bitcoin solves the double-spending problem using a decentralized system
called the blockchain. Here's how:
1. Public Ledger (Blockchain):
○ Every Bitcoin transaction is recorded in the blockchain, which is a
public, digital ledger.
○ All transactions are visible to everyone on the Bitcoin network.
○ Once a transaction is verified and added to the blockchain, it
becomes permanent and cannot be changed.
2. Proof of Work:
How it works:
 Imagine you want to send Bitcoin to someone. Before this can
happen, the network needs to make sure that you're not trying
to spend the same Bitcoin again (double-spending).
 Miners (special computers in the network) are responsible for
checking if the transaction is valid. To do this, miners solve very
difficult puzzles. These puzzles are like a lottery, and solving
them takes a lot of computing power.
 Once a miner solves the puzzle, they can add your transaction to
the blockchain. It’s like getting your transaction stamped as
valid.

Why it helps: This process makes it nearly impossible to change any


past transaction or spend the same Bitcoin twice because changing
anything would require a huge amount of computing power to solve
the puzzle again.

3. Consensus Mechanism:
○ How it works:
 Every participant (computer) in the Bitcoin network has a copy
of the blockchain.
 If someone tries to double-spend (send the same Bitcoin to two
places), the network checks the blockchain to see which
transaction is valid.
 The first transaction that gets added to the blockchain is
considered the valid one, and the second attempt to double-
spend is rejected by the network.
○ Why it helps: It ensures that all transactions are agreed upon by the
whole network. Even if someone tries to trick the system, the
network will catch it and stop the double-spending.

How to Ensure No Double-Spending


• Wait for Confirmations: When you send Bitcoin, the transaction isn’t fully
confirmed until it's included in a block on the blockchain. The more
confirmations (blocks added after your transaction), the harder it is for
someone to alter the transaction.
• Miners' Role: Miners work together to verify and confirm that no one is
spending the same Bitcoin more than once. Their work is crucial in
preventing double-spending.
• Distributed Network: Since Bitcoin is decentralized (no central authority),
everyone in the network has a copy of the blockchain, making it hard for
anyone to manipulate the system.
Peer-to-Peer (P2P) Network Architecture in Bitcoin:

• Bitcoin operates without a central server. Instead, it has a network of


many independent nodes (computers or devices) that work together.
• This is called a decentralized network, meaning no single entity controls
it.
• The network has a flat, mesh structure, meaning all nodes are equal.
There's no main server or central point, making it resilient and open to
everyone.

Types of Bitcoin Nodes and Their Roles:


1. Full Nodes:
○ These nodes store the entire blockchain (all Bitcoin transactions ever
made).
○ They verify all transactions independently to make sure everything is
correct.
2. Mining Nodes:
○ These nodes solve complex puzzles to create new blocks and add
them to the blockchain (this is called Proof of Work).
○ They help secure the network by validating and confirming
transactions.
3. Lightweight Nodes:
○ These nodes don’t store the full blockchain, making them faster and
more efficient.
○ They only verify transactions to make sure they are correct but don’t
keep all the historical data.
4. Wallet Nodes:
○ These nodes manage users' private keys (secrets that prove
ownership of Bitcoin) and help create and sign transactions for users.

Roles of Specific Nodes:


1. Wallet (W):
○ It helps manage private and public keys (used for secure
transactions) and creates and signs Bitcoin transactions.
2. Miner (M):
○ This node validates transactions and adds them to the blockchain by
solving cryptographic puzzles (Proof of Work).
3. Full Blockchain (B):
○ This node stores a complete copy of the entire blockchain and
ensures that the transactions are correct.
4. Network Routing Node (N):
○ This node helps with communication between different nodes,
ensuring the network works smoothly by passing messages and data.
Types of Nodes in Bitcoin:
1. Reference Client (Bitcoin Core):
○ This is the main Bitcoin software that includes:
 Wallet (W)
 Miner (M)
 Full Blockchain (B)
 Network Routing Node (N)
2. Full Blockchain Node:
○ This node stores the entire blockchain and helps with network
communication.
3. Solo Miner:
○ This node can mine Bitcoin by solving puzzles, and it stores the full
blockchain to verify transactions.
4. Lightweight (SPV) Wallet:
○ This node has a wallet and network node but doesn’t store the full
blockchain. It’s lighter and faster but relies on other nodes for
validation.
5. Mining Pool Servers:
○ These nodes work together in mining pools. Instead of mining alone,
miners combine their power and share the rewards. They use
protocols like Stratum to coordinate.
6. Lightweight (SPV) Stratum Wallet:
○ This is a wallet and network node used for pool mining but doesn’t
store the full blockchain. It’s used by miners in a pool to help with
mining without the need for the full blockchain.

In Simple Words:
• Bitcoin uses a network of nodes (computers) to work. Some nodes store
all data (full nodes), while others mine new Bitcoin (mining nodes), and
others help manage wallets for users.
• There’s no central control, and everyone works together to verify
transactions and secure the network. Some nodes store all the data,
while others only keep essential info to keep things fast and efficient.
07 May 2025 12:07

You might also like