0% found this document useful (0 votes)
17 views33 pages

Bitcoin, Ethereum, and Blockchain Basics

The document provides a comprehensive overview of various concepts related to blockchain, cryptocurrencies, and encryption. It covers topics such as Bitcoin's inventor, Ethereum's gas, types of blockchains, variables in Solidity, nonce in hashing, and differences between stream and block ciphers. Additionally, it explains the function of crypto wallets and their types.

Uploaded by

yashkhalate672
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)
17 views33 pages

Bitcoin, Ethereum, and Blockchain Basics

The document provides a comprehensive overview of various concepts related to blockchain, cryptocurrencies, and encryption. It covers topics such as Bitcoin's inventor, Ethereum's gas, types of blockchains, variables in Solidity, nonce in hashing, and differences between stream and block ciphers. Additionally, it explains the function of crypto wallets and their types.

Uploaded by

yashkhalate672
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

Q1) Attempt any eight of the

following .
a) Who is the inventor of Bitcoin?
➡️Answer:
Satoshi Nakamoto is the pseudonymous person (or group of people) who invented
Bitcoin in 2008 and released it as open-source software in 2009.
He also wrote the Bitcoin white paper titled “Bitcoin: A Peer-to-Peer Electronic
Cash System.”

b) What is Gas?
➡️Answer:
Gas is the unit of measurement used in the Ethereum blockchain to quantify the
computational effort required to execute operations like transactions or smart
contracts.

Every action on Ethereum costs gas.

Users pay gas in the form of Ether (ETH).

🧠 Think of gas like “fuel” that powers operations on the Ethereum network.

c) Which command is used to find the target


value?
➡️Answer:
The command used to find the target value in blockchain mining is typically related
to the hash comparison process.

Miners use hashing algorithms to find a hash less than or equal to the target
value.

In blockchain programming (like Bitcoin), this process happens automatically,


not via a simple command, but through the Proof of Work (PoW) algorithm
that adjusts the target dynamically.

(If referring to Ethereum CLI tools, the term “target” is not found by a command but
computed during mining.)
d) What is used for wallet security?
➡️Answer:
Crypto wallets are secured using Private Keys and Encryption techniques.

Main wallet security methods include:

Private Keys – unique secret codes to access funds.

Seed Phrase (Recovery Phrase) – backup to restore wallets.

Two-Factor Authentication (2FA) – adds an extra layer of security.

Cold Storage (Offline Wallets) – protects from hacking.

e) Define Nonce.
➡️Answer:
Nonce stands for “Number used once.”
It is a random number used in block mining to change the input of a hash function
and find a hash value that meets the difficulty target.

🧩 In Bitcoin mining:
Miners keep changing the nonce value until the correct hash (less than the target) is
found.

f) In which network, each node is itself a client and server?

➡️Answer:
In a Peer-to-Peer (P2P) network, each node acts as both a client and a server.

Nodes share resources directly without a central authority.

Blockchain operates on a P2P network model.

g) Name the institute that standardized AES


algorithm.

➡️Answer:
The National Institute of Standards and Technology (NIST), USA, standardized
the AES (Advanced Encryption Standard) algorithm in 2001.
h) What is IPO?

➡️Answer:
IPO (Initial Public Offering) is the process through which a private company
offers its shares to the public for the first time on the stock exchange.

It helps companies raise capital from investors.


(In blockchain, a similar concept is ICO – Initial Coin Offering.)

i) The blockchain is invented by Bitcoin. State and


explain true/false.

➡️Answer:
❌ False.
Explanation:

Blockchain was not invented by Bitcoin, but Bitcoin was the first practical
application of blockchain technology.

Blockchain as a concept (a chain of cryptographically linked blocks) existed


earlier (in 1991 by Stuart Haber and W. Scott Stornetta).

Bitcoin (2009) made blockchain popular.

j) What is Confidentiality?

➡️Answer:
Confidentiality means ensuring that information is accessible only to authorized
users and not disclosed to unauthorized parties.

In blockchain and cybersecurity:

It is achieved using encryption, secure keys, and access control mechanisms.

It protects sensitive data like private keys and transaction details from
exposure.
Q2) Attempt any four of the
following
a) What is Ether? List any two denominations
in wei?
Ether (ETH) is the native cryptocurrency of the Ethereum blockchain platform.
It is used as:

Fuel (Gas): To pay for transactions, deploy smart contracts, and run
decentralized applications (DApps).

Currency: To transfer value between users — similar to Bitcoin but also


powers smart contract operations.

💡 In short:
Ether is both a digital currency and the computational fuel that keeps the Ethereum
network running.

Denominations of Ether:

Ether can be divided into smaller units, just like a rupee can be divided into paise or a
dollar into cents.
The smallest unit is called wei.

Common Denominations in Wei:

Denomination
Value in Wei
Name
Wei 1 Wei = 1 Wei
Kwei
1 Kwei = 1,000 Wei
(babbage)
Mwei
1 Mwei = 1,000,000 Wei
(lovelace)
Gwei
1 Gwei = 1,000,000,000 Wei
(shannon)
1 Ether = 1,000,000,000,000,000,000 Wei (10¹⁸
Ether
Wei)

✅ Two Denominations in Wei (As per Question):


Gwei (shannon) – 1 Gwei = 1,000,000,000 Wei

Mwei (lovelace) – 1 Mwei = 1,000,000 Wei

💬 Example:

If gas price = 20 Gwei and gas used = 21,000,


then transaction cost = 20 × 21,000 = 420,000 Gwei = 0.00042 Ether

Summary:

Ether = Native currency of Ethereum.

Used for: Paying gas, executing contracts, and transferring value.

Two denominations in Wei: Gwei (10⁹ Wei) and Mwei (10⁶ Wei).

b) What is consortium and private


blockchain?
Definition:

A Consortium Blockchain is a semi-decentralized blockchain where the control is


shared among a group of organizations or institutions rather than a single entity or
the public.
Only selected participants have the authority to validate transactions and maintain
the ledger.

💡 In simple terms:
It’s a blockchain governed by a group (consortium) of trusted members.

Features:

Permissioned access: Only approved nodes can participate.

Shared control: Managed by multiple organizations (e.g., banks, companies).

Faster transactions: Since fewer nodes are involved in consensus.

More secure than public blockchains (less exposure to unknown


participants).
Examples:

Hyperledger Fabric

R3 Corda

Energy Web Foundation

Use Cases:

Banking and finance networks (inter-bank settlements)

Supply chain management

Healthcare data sharing between hospitals

Advantages:

Better privacy than public blockchains

Controlled access and governance

High transaction speed

Suitable for inter-organizational cooperation

Disadvantages:

Less decentralized than public blockchains

Requires trust among member organizations

🧱 2. Private Blockchain:

Definition:

A Private Blockchain is a permissioned blockchain controlled by a single


organization.
The owner decides who can read, write, and participate in the network.

💡 In simple terms:
A single authority manages and validates all transactions.
Features:

Centralized control: Only one entity governs the blockchain.

Restricted access: Only authorized members can join.

High efficiency: Faster consensus and lower computational cost.

Examples:

Hyperledger Fabric (private mode)

Quorum (developed by JPMorgan)

Use Cases:

Internal business operations

Enterprise record keeping

Supply chain tracking within a company

Advantages:

High speed and scalability

Strong data privacy

Easy governance and regulation

Disadvantages:

Centralized control (less transparency)

Trust depends on the central authority

🧾 Comparison Table:
Feature Consortium Blockchain Private Blockchain
Shared by multiple Controlled by one
Control
organizations organization
Restricted to selected Restricted to members of
Access
participants one entity
Decentralizati
Partially decentralized Centralized
on
Transparency Moderate Limited
R3 Corda, Hyperledger
Examples Quorum, Multichain
Fabric
Inter-company
Use Case Internal enterprise use
cooperation

✅ Summary:

Consortium Blockchain: Managed by a group of trusted organizations —


semi-decentralized.

Private Blockchain: Controlled by a single organization — centralized but


efficient.

c) List and explain types of variables in


solidity.
In Solidity, variables are used to store data in smart contracts.
They can have different scopes and storage locations depending on how and where
they are declared.

Solidity mainly supports three types of variables:

🧩 1. State Variables
Definition:

These are variables that are declared inside a contract but outside any
function.

They are stored permanently on the blockchain.

Their values are preserved even after the function execution is completed.

Key Points:

Stored in blockchain storage (costs gas to update).


Accessible by all functions inside the contract.

Declared with visibility keywords like public, private, internal, or


external.

Example:

pragma solidity ^0.8.0;

contract Example {
uint public age = 25; // State variable
string private name = "Alice";
}

Here, age and name are state variables — they are saved on the blockchain.

🧠 2. Local Variables
Definition:

These are variables declared inside a function and exist only while the
function executes.

They are temporary and not stored on the blockchain.

Key Points:

Exist only in memory (RAM).

Do not consume gas (unless performing blockchain operations).

Cannot be accessed outside the function where they are declared.

Example:

pragma solidity ^0.8.0;

contract Example {
function getSum() public pure returns (uint) {
uint a = 5; // Local variable
uint b = 10; // Local variable
return a + b;
}
}

Here, a and b are local variables, existing only during the execution of getSum().
💾 3. Global Variables
Definition:

These are special built-in variables provided by Solidity to get information


about the blockchain, transactions, and contracts.

They are available globally within the smart contract.

Key Points:

Provide environmental data like [Link], [Link],


[Link], etc.

Useful for tracking transaction details and blockchain state.

Common Global Variables:

Variable Description
[Link] Address of the account that called the function
[Link] Amount of Ether sent with the transaction
[Link] Current block number
[Link]
Timestamp of the current block
mp
gasleft() Returns remaining gas for the transaction
Original external account that initiated the
[Link]
transaction

Example:

pragma solidity ^0.8.0;

contract Example {
function getInfo() public view returns (address, uint) {
return ([Link], [Link]); // Global variables
}
}

✅ Summary Table:
Storage Stored on
Type Lifetime Example
Location Blockchain
State uint public age
Storage Permanent ✅ Yes
Variable = 25;
Storage Stored on
Type Lifetime Example
Location Blockchain
Temporary
Local uint sum = a +
Memory (function ❌ No
Variable b;
scope)
Global Environment Temporary [Link],
❌ No
Variable (Predefined) (read-only) [Link]

In Short:

State Variables: Stored on blockchain permanently.

Local Variables: Exist temporarily inside functions.

Global Variables: Predefined variables that give blockchain and transaction


info.

d) How nonce useful in hashing?


Nonce stands for “Number used once” — it is a random or incremental number
added to the input data before hashing.
It is mainly used in block mining to ensure that the resulting hash value meets a
specific difficulty target.

⚙️Role of Nonce in Hashing (Mining Process):

In blockchain systems like Bitcoin or Ethereum, every block must have a unique
hash that satisfies a condition such as:

The hash must start with a certain number of leading


zeros.

To achieve this, miners continuously change the nonce value and re-hash the block’s
data until they find a hash that meets the required difficulty level.

🧠 Step-by-Step Explanation:

Combine Block Data + Nonce:


The miner takes the block’s data (like transaction details, previous hash,
timestamp) and adds a nonce value.

Hash the Combined Data:


The entire data is passed through a hash function (e.g., SHA-256 in Bitcoin).
Check the Hash Result:
If the resulting hash satisfies the difficulty condition (e.g., starts with 0000…),
it is accepted.

If Not, Change the Nonce and Retry:


If the hash doesn’t meet the condition, the miner increments the nonce and
re-hashes the data again.

Repeat Until Success:


This process continues until a valid hash is found — the miner who finds it
wins the right to add the new block to the blockchain.

🔁 Simplified Example:

Let’s say the blockchain requires a hash starting with “0000”.

Non Hash (SHA- Valid


ce 256) ?
1001 a4b6f12... ❌
1002 4cd9f09... ❌
1003 0000a8b... ✅

✅ When Nonce = 1003, the hash meets the condition, so the block is accepted.

🔒 Importance of Nonce in Hashing:

Purpose Explanation
Ensures Each nonce generates a new hash, preventing
Uniqueness repetition.
Maintains Makes it computationally hard to tamper with a
Security block.
Proof of Work Nonce is the key variable used by miners to
(PoW) prove they did computational work.
Prevents Randomization through nonce ensures
Predictability unpredictable hash outcomes.

✅ In Short:

A nonce is a number miners adjust during hashing to find a valid hash that satisfies
the blockchain’s difficulty target.
It ensures security, randomness, and fairness in the Proof of Work (PoW) process.
e) Define stream cipher and block
cipher.
A Stream Cipher is a type of encryption algorithm that encrypts data one bit or
one byte at a time.
It converts plaintext into ciphertext by combining it with a pseudo-random key
stream using operations like XOR (Exclusive OR).

💡 In simple terms:
It encrypts the data bit by bit or byte by byte continuously — like streaming water.

Working:

A key is used to generate a keystream (a sequence of random bits).

Each bit/byte of plaintext is XORed with a bit/byte of the keystream.

The process is reversible, meaning decryption is done by XORing again with


the same keystream.

🧩 Formula:

Ciphertext = Plaintext ⊕ KeystreamPlaintext = Ciphertext ⊕


Keystream

Example:

RC4 (Rivest Cipher 4)

A5/1 (used in GSM mobile encryption)

Salsa20 / ChaCha20

Advantages:

Fast encryption and decryption.

Suitable for real-time applications (e.g., voice or video streaming).

Simple and lightweight implementation.

Disadvantages:

If the same keystream is reused, encryption becomes insecure.


More vulnerable to certain attacks (like key reuse attacks).

🔸 2. Block Cipher

Definition:

A Block Cipher is a type of encryption algorithm that encrypts data in fixed-size


blocks, typically 64 bits or 128 bits at a time.
It uses the same key for encrypting each block of plaintext into ciphertext.

💡 In simple terms:
It processes the data block by block, not bit by bit.

Working:

The plaintext is divided into equal-sized blocks (e.g., 128 bits).

Each block is encrypted separately using the encryption key and algorithm
(like AES or DES).

For large data, different modes of operation (CBC, ECB, CTR, etc.) are used
to maintain security.

🧩 Example:

DES (Data Encryption Standard) – 64-bit block

AES (Advanced Encryption Standard) – 128-bit block

Blowfish, Twofish

Advantages:

Provides strong security.

Well-suited for encrypting large files or stored data.

Supports various modes of operation for flexibility.

Disadvantages:

Slower than stream ciphers for small or real-time data.

Requires padding for data that doesn’t fit exactly into block size.
⚖️Comparison Between Stream Cipher and Block
Cipher

Feature Stream Cipher Block Cipher


Data Bit-by-bit or byte-by-
Block-by-block
Processing byte
Speed Faster Slower
Key Usage Uses keystream Uses same key per block
Typical Block
1 bit or 1 byte 64-bit / 128-bit
Size
Example
RC4, ChaCha20 AES, DES
Algorithms
Real-time File or data storage
Use Case
communication encryption

✅ In Short:

Stream Cipher: Encrypts data bit by bit using a keystream (e.g., RC4).

Block Cipher: Encrypts data block by block using a fixed-size block (e.g.,
AES, DES).

Q3) Attempt any two of the


following
a) What is Wallet? Explain its
types.
A Crypto Wallet (or Blockchain Wallet) is a digital tool that allows users to store,
send, and receive cryptocurrencies like Bitcoin, Ethereum, and other tokens.

It does not store the actual coins, but instead keeps the public and private keys that
give access to the cryptocurrencies stored on the blockchain.

🧠 Key Concepts:

Public Key:
Works like a bank account number — shared with others to receive funds.
Private Key:
Works like a password or PIN — must be kept secret; used to sign and
authorize transactions.

🧩 If you lose your private key, you lose access to your crypto assets permanently.

⚙️Functions of a Crypto Wallet:

Stores keys securely (public & private keys).

Sends and receives cryptocurrency.

Tracks balances and transaction history.

Authenticates transactions using private keys.

💼 Types of Crypto Wallets


Crypto wallets are mainly divided into two categories:

Hot Wallets

Cold Wallets

🔹 1. Hot Wallets

Definition:

Hot wallets are connected to the internet and allow quick access to cryptocurrencies.
They are convenient for frequent transactions but are more vulnerable to hacking.

Examples:

Web Wallets – accessed via browsers (e.g., MetaMask, MyEtherWallet)

Mobile Wallets – smartphone apps (e.g., Trust Wallet, Coinbase Wallet)

Desktop Wallets – installed on computers (e.g., Exodus, Electrum)

Advantages:

Easy to set up and use.


Fast transactions and transfers.

Suitable for active traders.

Disadvantages:

Less secure (vulnerable to malware or phishing).

Requires constant internet access.

🔸 2. Cold Wallets

Definition:

Cold wallets are offline wallets, meaning they store keys without an internet
connection, making them highly secure from online attacks.

Examples:

Hardware Wallets: Physical devices like Ledger Nano S, Trezor.

Paper Wallets: Keys printed or written on paper and stored physically.

Advantages:

Very secure from hacking and malware.

Ideal for long-term storage of large amounts of crypto.

Disadvantages:

Less convenient for frequent transactions.

Risk of physical damage or loss of device/paper.

🧾 Comparison Table:

Feature Hot Wallet Cold Wallet


Internet
Online Offline
Connection
Security Level Lower Very High
Speed of Access Fast Slower
Use Case Frequent trading Long-term storage
MetaMask, Trust Ledger, Trezor, Paper
Examples
Wallet Wallet
✅ In Short:

A Wallet is a secure tool that manages a user’s cryptographic keys to access


cryptocurrencies.

Hot Wallets: Online, convenient, but less secure.

Cold Wallets: Offline, very secure, best for long-term storage.

💡 Tip: Many investors use both types — a hot wallet for daily transactions and a
cold wallet for safe, long-term storage.

b) Explain tasks of miners.


Miners play a crucial role in maintaining and securing a blockchain network,
especially in Proof of Work (PoW) based systems like Bitcoin. Their main tasks are
as follows:

Transaction Verification:

Miners collect unconfirmed transactions from the mempool (a pool of


pending transactions).

They verify the validity of each transaction (e.g., checking digital


signatures, ensuring no double spending)

Block Formation:

After verifying transactions, miners bundle them together into a new


block.

Each block includes a list of valid transactions, a timestamp, and a


reference (hash) to the previous block.

Solving Cryptographic Puzzle (Mining):

Miners must find a nonce (a special number) such that the hash of the
block meets the network’s difficulty target.

This process requires heavy computation and is known as Proof of


Work (PoW).

Block Broadcasting:

Once a miner successfully finds a valid hash, the new block is


broadcast to the entire network.
Other nodes verify the block before adding it to their copy of the
blockchain.

Consensus Maintenance:

Miners help maintain consensus by always building on the longest


valid chain.

This ensures that all participants agree on a single version of the


blockchain.

Reward Collection:

The miner who successfully mines a block receives a block reward,


which includes:

Newly generated cryptocurrency (block subsidy)

Transaction fees from the transactions included in the block

c) List the applications of smart


contract. Explain any three.
Smart contracts are self-executing digital agreements that automatically carry out
the terms of a contract when predefined conditions are met. They run on blockchain
platforms like Ethereum and eliminate the need for intermediaries.

List of Applications:

Supply Chain Management

Financial Services (Banking & Insurance)

Real Estate Transactions

Voting Systems

Healthcare Systems

Intellectual Property and Copyright Protection

Crowdfunding

Decentralized Finance (DeFi)


Explanation of Any Five:

1. Supply Chain Management

Smart contracts track goods throughout the supply chain.

Every transaction or movement of goods is recorded on the blockchain for


transparency and authenticity.

Example: Payment is automatically released to the supplier once the product


reaches its destination and is verified.

2. Financial Services (Banking & Insurance)

Smart contracts automate loan approvals, payments, and insurance claims.

They ensure that funds are released only when specific terms are satisfied,
reducing fraud and delays.

Example: Insurance claims can be automatically paid after verifying accident


data from trusted sources.

3. Real Estate Transactions

Real estate deals involve multiple parties and documents.

With smart contracts, property ownership transfers and payments occur


automatically once the buyer meets all conditions.

This reduces paperwork, legal costs, and the risk of fraud.

4. Voting Systems

Smart contracts can ensure secure, transparent, and tamper-proof voting.

Each vote is recorded as a transaction on the blockchain, preventing double


voting or manipulation.

Example: Governments or organizations can conduct transparent elections


using blockchain-based voting systems.

5. Healthcare Systems
Smart contracts can securely store and share medical records among
authorized parties like doctors, hospitals, and insurance companies.

Patients control access to their data, ensuring privacy and security.

Example: A patient’s data can be automatically shared with a specialist once


the patient gives permission via a smart contract.

✅ In summary:
Smart contracts are widely used in supply chains, finance, real estate, voting, and
healthcare because they provide automation, trust, transparency, and efficiency.

Q4) Attempt any two of the


following .
a) Describe the structure of EVM.
The Ethereum Virtual Machine (EVM) is the runtime environment for executing
smart contracts on the Ethereum blockchain.
It acts as a virtual computer that ensures all nodes execute smart contract code in the
same way, maintaining consistency and consensus across the network.
⚙️Structure / Components of EVM:

The EVM consists of the following main components:

1. Stack

The stack is a temporary memory area used to store data during execution.

It works on the Last-In-First-Out (LIFO) principle.

Each operation (like addition or multiplication) takes input values from the
stack and pushes the result back onto it.

Stack depth is limited (usually 1024 elements).

2. Memory

Memory is a volatile (temporary) storage area used during transaction


execution.

It is cleared after the execution of each transaction.

It is used to store data that contracts need only temporarily.

3. Storage

Storage is non-volatile and permanently stores contract data on the


blockchain.

Each smart contract has its own storage area, which holds variables and
states.

It is expensive in terms of gas to write or modify data in storage.

4. Program Counter (PC)

The program counter keeps track of the current instruction being executed
in the smart contract bytecode.

It increments after each instruction, allowing sequential execution.


5. Gas Mechanism

Every operation in EVM consumes a certain amount of gas (computational


cost).

Gas prevents infinite loops and ensures efficient execution.

If a transaction runs out of gas, execution stops and changes are reverted.

6. Opcodes / Instruction Set

The EVM executes smart contract code written in bytecode, made up of


opcodes (operation codes).

Opcodes represent low-level instructions like ADD, MUL, STORE, LOAD, etc.

7. Environment Information

The EVM also accesses external information such as:

Block data: timestamp, number, difficulty, etc.

Transaction data: sender address, value, and input data.

Global state: information about all accounts and contracts.

🧠 Diagram (Text Representation):

+--------------------------------------+
| Ethereum Virtual Machine |
+--------------------------------------+
| Smart Contract Bytecode (Opcodes) |
+--------------------------------------+
| Stack | Memory | Storage |
+--------------------------------------+
| Program Counter (PC) |
| Gas Mechanism |
| Environment Info (Block, Txn) |
+--------------------------------------+
✅ In summary:
The EVM structure includes stack, memory, storage, program counter, gas
mechanism, and opcode set — all working together to execute smart contracts
securely and consistently on the Ethereum network.

b) Explain digital signature with neat


diagram.
A Digital Signature is a cryptographic technique used to verify the authenticity,
integrity, and non-repudiation of a digital message or document.
It ensures that the message was sent by the claimed sender and has not been altered
during transmission.

Digital signatures are created using asymmetric key cryptography — involving a


private key and a public key.

🔹 Working of Digital Signature:

The process of digital signature involves three main steps:

1. Key Generation

The sender generates two keys:

Private Key (used for signing)

Public Key (used for verification)

2. Signing Process

The sender applies a hash function to the original message to create a


message digest (a fixed-size hash).

The message digest is then encrypted using the sender’s private key to
create the digital signature.

The digital signature is sent along with the original message to the receiver.

3. Verification Process
The receiver applies the same hash function to the received message to
generate their own message digest.

The receiver decrypts the digital signature using the sender’s public key to
obtain the original message digest.

If both message digests are identical, the signature is valid — meaning the
message is authentic and unaltered.

🔹 Diagram (Text Representation):

SIGNING PROCESS VERIFICATION


PROCESS----------------------------------------------------------------------------------
Sender: Receiver:

Original Message Received Message


| |
v v
Apply Hash Function Apply Same Hash Function
| |
v v
Message Digest -------------------Compare-------------- Message Digest
|
vEncrypt with Private Key
|
v
Digital Signature
|
vSend (Message + Signature)

🔹 Key Features:

Authentication – Confirms the identity of the sender.

Integrity – Ensures the message is not modified in transit.

Non-repudiation – Sender cannot deny having sent the message.

🔹 Example:

If Alice sends a message to Bob:

Alice signs the message using her private key.

Bob verifies the signature using Alice’s public key.


If valid, Bob knows the message truly came from Alice and was not tampered
with.

✅ In summary:
A digital signature is an electronic equivalent of a handwritten signature that
provides security, integrity, and trust in digital communications.

c) Explain the layered architecture of


blockchain.
The blockchain architecture is generally divided into five layers, each having a
specific role in the working of the blockchain system.

1. Application Layer

Description:
This is the topmost layer that interacts with end users.

Functions:

Provides user interfaces and DApps (Decentralized Applications).

Handles smart contracts and business logic.

Examples:

Cryptocurrency wallets, decentralized finance (DeFi) apps, supply


chain apps.

2. Execution Layer

Description:
This layer is responsible for the execution of smart contracts and
transaction instructions.

Functions:

Executes code written in languages like Solidity (Ethereum).


Uses a virtual machine, such as the Ethereum Virtual Machine
(EVM), to run contract logic securely.

Examples:

EVM (Ethereum Virtual Machine), WASM (WebAssembly) in


Polkadot.

3. Consensus Layer

Description:
This layer ensures agreement among all nodes about the current state of the
blockchain.

Functions:

Validates transactions and blocks.

Maintains network integrity and security.

Consensus Mechanisms:

Proof of Work (PoW)

Proof of Stake (PoS)

Practical Byzantine Fault Tolerance (PBFT)

4. Network Layer (P2P Layer)

Description:
Handles communication between blockchain nodes in a peer-to-peer (P2P)
network.

Functions:

Propagates transactions and blocks across the network.

Ensures every node has updated data.

Components:

Node discovery, data verification, and synchronization.


5. Data Layer (Ledger Layer)

Description:
This is the foundation of the blockchain. It manages how data is structured
and stored.

Functions:

Stores the immutable ledger of all transactions.

Uses hashing and Merkle trees to ensure data integrity and security.

Key Concepts:

Blocks, chains, timestamps, cryptographic hashes.

Q5) Attempt any one of the


following
a) State and explain Merkle tree.
A Merkle Tree (also called a Hash Tree) is a data structure used in blockchain to
efficiently and securely verify the integrity and consistency of large sets of data (such
as transactions in a block).

It is a binary tree in which:

Leaf nodes contain the hashes of individual transactions, and


Non-leaf (parent) nodes contain the hash of the concatenation of their
child nodes.

Structure of a Merkle Tree:

All transactions in a block are hashed individually.

Each pair of transaction hashes is combined and hashed again to form the
parent node.

The process continues until only one hash remains — this is called the
Merkle Root.

The Merkle Root uniquely represents all the transactions in the block.

Example:

Let’s say we have 4 transactions:


T1, T2, T3, T4

Compute individual transaction hashes:


H1 = Hash(T1)
H2 = Hash(T2)
H3 = Hash(T3)
H4 = Hash(T4)

Combine and hash pairs:


H12 = Hash(H1 + H2)
H34 = Hash(H3 + H4)

Combine again:
Merkle Root = Hash(H12 + H34)

Diagram (Text Representation):

Merkle Root
|
-----------------
| |
H12 H34
/ \ / \
H1 H2 H3 H4
T1 T2 T3 T4
Features of Merkle Tree:

Each node is labeled with a hash value.

The Merkle Root summarizes all transactions in the block.

Any change in a single transaction changes the Merkle Root — ensuring data
integrity.

Advantages of Merkle Tree:

✅ Efficient verification:
Verifies if a transaction is part of a block without downloading the entire
block (used in SPV – Simplified Payment Verification).

🔒 Data integrity:
Any modification in data changes the hash and the Merkle Root immediately.

⚡ Scalability:
Enables quick verification even for large datasets.

📦 Reduced storage:
Only hashes are stored instead of entire transaction data for verification.

b) What are the properties of


SHA 256?
SHA-256 stands for Secure Hash Algorithm – 256 bits, part of the SHA-2 family
developed by the National Security Agency (NSA) in 2001.
It is one of the most widely used cryptographic hash functions in blockchain
technology, digital signatures, and data integrity verification.

SHA-256 takes any size of input data and produces a fixed-size 256-bit (32-byte)
hash value.

Detailed Properties of SHA-256


1. Fixed Output Length

No matter how long or short the input message is, SHA-256 always produces a
fixed 256-bit (64 hexadecimal characters) output.

Example:

Input: "A"Output: 559aead08264d5795d3e... (256-bit


hash)Input: "Blockchain Technology"Output:
e2763f9aee5c90d8b8b6... (256-bit hash)

This fixed length makes it easy to store, compare, and use hashes in digital
systems like blockchain.

2. Deterministic

SHA-256 is deterministic, meaning that the same input will always produce
the same output.

Example:

Input: "hello" →
2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e730
43362938b9824

If you hash "hello" a thousand times, you will always get this same hash value.

This property is vital for data verification and block validation in


blockchain.

3. Irreversible (One-Way Function)

SHA-256 is a one-way function, meaning it is computationally impossible


to reconstruct the original input from its hash.

There is no known algorithm that can “reverse” a SHA-256 hash.

This ensures data confidentiality — even if someone obtains the hash, they
cannot find the original message.

4. Collision Resistance
A collision occurs when two different inputs produce the same hash output.

SHA-256 is designed so that finding collisions is practically impossible


(requires around 2¹²⁸ operations).

This ensures that each input has a unique hash, maintaining data integrity.

Example:

Hash(“abc”) ≠ Hash(“abd”)

5. Avalanche Effect

A tiny change in the input causes a completely different hash output.

Example:

Input 1: "data" → 3a6eb0790f... Input 2: "Data" →


8d777f385d...

This property ensures unpredictability and security because attackers cannot


guess input patterns.

6. Preimage Resistance

It should be computationally infeasible to find an input that maps to a given


hash output.

Example:
Given 9b74c9897bac770ffc029102a200c5de, it is nearly impossible to find
what input generated it.

This property helps protect stored passwords and digital signatures.

7. Second Preimage Resistance

Given an input and its hash, it should be impossible to find another input
that produces the same hash.

Example:
If Hash("DocumentA") = X, you cannot find another "DocumentB" such that
Hash("DocumentB") = X.

Prevents data tampering and forgery.


8. Uniform Distribution

SHA-256 hash outputs are uniformly distributed across the entire 256-bit
space.

This avoids clustering and ensures that small differences in input produce
random-looking outputs, improving security and fairness in systems like
Bitcoin mining.

9. Fast Computation

Despite being secure, SHA-256 can be computed quickly and efficiently,


even for large amounts of data.

This makes it suitable for real-time applications like digital signatures,


blockchain mining, and authentication systems.

10. Widely Used in Blockchain

SHA-256 is a core component of Bitcoin and other blockchains.

Used to generate block hashes.

Used in Proof-of-Work mining algorithms.

Ensures data immutability and security.

You might also like