ESE - Blockchain & DLT
ESE - Blockchain & DLT
Module 2: Bitcoin
2.1 Bitcoin definition and evaluation of of Bitcoin, Transactions, Blocks, Mining, and the
Blockchain,
2.2 Bitcoin Transactions, Constructing a Transaction, Bitcoin Mining,
2.3 Keys, Addresses, Wallets, ECC, Base58 and Base58check Encoding, Advanced Keys
and Addresses.
2.4 Transaction Lifecycle, Transaction Structure, Transaction Outputs and Inputs,
Transaction Chaining and Orphan Transactions, Transaction Scripts and Script
Language, Standard Transactions
2.5 Bitcoin Network: Peer-to-Peer Network Architecture, Nodes Types and Roles, The
Extended Bitcoin Network, Network Discovery, Full Nodes, Exchanging “Inventory”,
2.6 Simplified Payment Verification (SPV) Nodes, Bloom Filters, Inventory Updates,
Transaction Pools, Alert Messages, Developing Bitcoin Systems Securely
● In August 2008, the domain bitcoin.org was registered, marking the early
groundwork for Bitcoin’s online presence.
● In November 2008, Satoshi Nakamoto published the foundational whitepaper
titled “Bitcoin: A Peer-to-Peer Electronic Cash System”, which proposed using
blockchain technology to solve the double-spending problem without a trusted
intermediary.
● In August 2017, the network experienced its first major hard fork, creating Bitcoin
Cash (BCH) — a separate blockchain focused on larger block sizes for improved
scalability.
● In November 2017, another hard-forked version called Bitcoin Gold (BTG) was
created, aiming to reintroduce GPU mining instead of ASIC dominance.
Summary of Milestones
| 2017 | Hard fork → Bitcoin Cash; later in the year, hard fork
→ Bitcoin Gold
💡 Key Concepts
🧾 Example
1. Block Header
2. Block Body
🔁 Block Lifecycle
● Security: The hash linking blocks ensures that altering one block invalidates all
following blocks.
● Decentralization: No central party decides which transactions are valid;
consensus is reached via mining.
● Immutability: Once a block is added, it cannot be changed without network
consensus.
🧾 Example in Bitcoin
1. Transaction Collection
Miners select verified transactions from the mempool (transaction pool).
2. Block Construction
The miner creates a block containing:
○ Block header (metadata)
○ Coinbase transaction (reward to the miner)
○ Other valid transactions
3. Proof of Work (PoW)
The miner repeatedly changes the nonce to find a hash of the block header that is
less than or equal to the difficulty target.
4. Block Broadcast
Once the correct hash is found, the block is broadcast to the network.
5. Block Validation
Other nodes verify the block and transactions. If valid, it is added to the
blockchain.
🧾 Example
Suppose the difficulty target requires a hash starting with 18 zeros. The miner tries
different nonce values until a hash like:
0000000000000000000a3b9... is produced.
Once this is achieved, the block is valid and added to the blockchain.
🚨 Mining Challenges
Structure of Blockchain
Each block in the blockchain contains:
1. Block Header
○ Previous block’s hash
○ Timestamp
○ Nonce
○ Merkle root (summary of transactions)
○ Difficulty target
2. Block Body
○ List of validated transactions
These blocks are chained together, where each block references the hash of the previous
block, ensuring the integrity of the entire ledger.
Characteristic Description
Distributed Data is stored across all nodes, making it resistant to data loss/failure.
🏦 Types of Blockchain
📌 Applications of Blockchain
A Bitcoin transaction is a digital instruction that allows the transfer of bitcoin from one
or more users (senders) to others (recipients). It is the core mechanism through which
value is exchanged and recorded on the Bitcoin blockchain.
🔹 Purpose
1. Inputs
○ Reference to previous transaction outputs (UTXOs).
○ Includes a digital signature proving the sender’s ownership.
2. Outputs
○ The recipient's address and amount to be sent.
○ Can include a change address (leftover amount returned to sender).
3. Scripts
○ Locking script (scriptPubKey) – Attached to the output; sets conditions for
spending.
○ Unlocking script (scriptSig) – Provided in the input to unlock (spend) the
output.
🔹 Lifecycle of a Transaction
🔹 Transaction Example
🔹 Scripts in Action
🔹 Fees in Transactions
✅ Summary
● Choose one or more Unspent Transaction Outputs (UTXOs) that belong to the
sender.
● These inputs must have enough total value to cover the amount being sent plus
transaction fees.
🔸 Example: If Alice wants to send 0.8 BTC and the fee is 0.0005 BTC, she
must select inputs totaling at least 0.8005 BTC.
2. 💸 Define Outputs
● Recipient Output: Amount and address of the person receiving the bitcoin.
● Change Output (if needed): If the input value exceeds the recipient’s amount + fee,
the leftover value is sent back to the sender’s change address.
🔸 Example:
Input: 1 BTC
Outputs:
• 0.8 BTC to Bob
• 0.1995 BTC to Alice (change)
Fee = 0.0005 BTC
Bitcoin mining is the process of using computational power to validate new transactions,
secure the Bitcoin network, and add new blocks to the blockchain. In return, miners are
rewarded with newly minted bitcoins and transaction fees.
Mining also serves as Bitcoin's consensus mechanism, ensuring that all participants in
the network agree on the current state of the blockchain.
🔹 Objectives of Mining
🔹 Mining Rewards
1. Block Reward (subsidy):
○ Initially 50 BTC (halves every 210,000 blocks).
○ As of 2024, it is 3.125 BTC (after fourth halving).
2. Transaction Fees:
○ Total input – total output = fee
○ Paid voluntarily by users to incentivize fast inclusion.
🔹 Importance of Mining
● Prevents double-spending.
● Maintains trust and integrity in a decentralized system.
● Makes attacks (like tampering with blocks) computationally expensive.
🔹 Challenges in Mining
Challenge Description
1️⃣Private Key
2️⃣Public Key
● A public key is mathematically derived from the private key using Elliptic Curve
Cryptography (ECC), specifically the secp256k1 curve.
● It can be shared publicly and is used by the network to verify transaction
signatures.
● The public key is also the base for creating Bitcoin addresses, which are what
users share to receive funds.
✔ Bitcoin Address:
Derived by hashing the public key with SHA-256 followed by RIPEMD-160, then
encoded (usually using Base58Check). This is what you share to receive bitcoins.
✔ Advanced Keys:
● Encrypted private keys (BIP-38): Private keys encrypted with a passphrase for
extra protection.
● Pay-to-Script-Hash (P2SH): Uses script hashes instead of public key hashes,
supporting multisignature addresses.
● Hierarchical Deterministic (HD) Wallets (BIP-32): Derive a tree of keys from a
single master seed, making backup and recovery easier.
Summary
Component Purpose
1️⃣Private Key:
A secret 256-bit number, known only to the owner.
2️⃣Public Key:
Mathematically derived from the private key using Elliptic Curve Cryptography (ECC).
3️⃣Address:
A shorter, hashed version of the public key (using SHA-256 and RIPEMD-160), encoded
in Base58Check format, which includes a version prefix and checksum for error
detection.
✅ Pay-to-Public-Key-Hash (P2PKH)
✅ Pay-to-Script-Hash (P2SH)
Important Characteristics
✔ Public:
You can safely share your address — it doesn’t expose your private key.
✔ One-Way Link:
Funds sent to an address can only be spent by someone with the matching private key.
✔ Multiple Addresses:
Wallets often generate new addresses for each transaction to improve privacy.
Summary Table
Aspect Description
Types P2PKH (starts with 1), P2SH (starts with 3), Bech32 (starts with
bc1)
In Bitcoin, a wallet is a software, hardware, or even paper-based tool that stores and
manages a user’s private keys and public keys, allowing them to send, receive, and
monitor their bitcoin balances.
Contrary to its name, a wallet doesn’t actually “store bitcoins” — the bitcoins exist on the
blockchain; the wallet holds the keys needed to access and control them.
✅ Key Management
● Securely generates, stores, and manages private keys and their derived public
keys.
✅ Transaction Signing
✅ Address Management
✅ Balance Tracking
● Monitors the blockchain (directly or via connected nodes) to show the user their
current balances.
Hardware Wallets Physical devices (e.g., Trezor, Ledger) that store keys
offline for extra security.
HD Wallets (Hierarchical Wallets that derive a tree of keys from a single master
Deterministic) seed (BIP-32/BIP-44), making backup and recovery
easier.
● Wallets can generate a human-readable recovery phrase to back up and restore all
keys.
✔ Multisignature (Multisig) Wallets
✔ Cold Storage
Summary Table
Aspect Description
Doesn’t Store Actual bitcoins — only the keys that control them
12. Explain the terms Base58 and Base58check Encoding and its difference as well
Both Base58 and Base58Check are encoding schemes used in Bitcoin to make binary data
(like keys and addresses) more human-friendly by converting them into alphanumeric
strings that are easy to read, type, and share.
123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz
✔ It excludes:
● Bitcoin addresses
● Private keys
● Public keys
✔ The version prefix tells the type of data (e.g., 0x00 for Bitcoin addresses, 0x80 for
private keys).
✔ The checksum is a 4-byte hash used for error detection — it helps detect if the
encoded string has been mistyped or corrupted.
Purpose Encodes binary data into a Encodes binary data with version and
human-readable string checksum for safety
Advanced keys and addresses in Bitcoin refer to enhanced cryptographic structures and
address types beyond the basic public/private key pairs and standard pay-to-public-key-
hash (P2PKH) addresses.
These advanced forms provide added functionality, flexibility, and security features,
enabling complex use cases like multi signature wallets, cold storage, and improved
backup/recovery.
● Instead of paying to a public key hash, P2SH pays to a script hash (starts with
prefix 3).
● Used for multisignature addresses where multiple private keys are required to
spend funds (e.g., 2-of-3 signatures).
● Adds flexibility for complex spending conditions.
● Script hash = RIPEMD160(SHA256(script)) encoded with Base58Check
(prefix 0x05).
3️⃣Vanity Addresses
● A form of offline key storage where the private/public key pair is printed on paper
(often with QR codes).
● Provides cold storage: keys are kept offline, safe from online hacks.
● Suitable for long-term, secure storage but risky if the paper is lost or damaged.
● A wallet system that can derive an entire tree of keys from a single root seed.
● Type-1 deterministic wallet: simple sequence of keys from a seed.
● Type-2 HD wallet: hierarchical tree of keys, allowing structured account
management.
● Great for easy backups and restoring all wallet addresses using just the mnemonic
seed.
Summary Table
Advanced Feature Description
HD Wallets (BIP- Hierarchical key derivation from a single master seed for
32/44) easier backups
A Bitcoin transaction is a data structure that moves bitcoins from one or more sources
(inputs) to one or more destinations (outputs).
It contains all the necessary information to prove that the sender has the right to spend
the coins and defines the conditions for the next owner to spend them.
1️⃣Transaction Inputs
2️⃣Transaction Outputs
3️⃣Version
4️⃣Locktime
● Defines the earliest time or block height when the transaction is valid.
● Counts specifying how many inputs and outputs the transaction contains.
Summary of Transaction Structure (Simplified)
Field Description
Example Flow
Important Concepts
✔ Scripts
✔ Chaining Transactions
● Transactions are linked together: the output of one becomes the input of another.
15. What are transaction Outputs and Inputs ?
Definition References past UTXOs and proves Creates new UTXOs and defines how
right to spend they can be spent
Role Provides source of funds and Assigns funds to new owners under set
authorization conditions
Script Satisfies past output’s conditions Sets conditions for future spending
Purpose
1️⃣Pay-to-Public-Key-Hash (P2PKH)
● The most common type, paying to a Bitcoin address (starts with 1).
2️⃣Pay-to-Script-Hash (P2SH)
● Uses a script hash (starts with 3) and allows complex scripts like multisignature
setups.
● Embed small, non-financial data into the blockchain (e.g., for timestamps or
metadata).
● Limited to 80 bytes to avoid bloating the blockchain.
Summary Table:
Decentralization
● Every node has equal status; there’s no central server or “main” node.
● Nodes independently enforce Bitcoin’s consensus rules.
Open Access
Direct Communication
● Nodes connect to other nodes (peers) over the internet using TCP (usually on port
8333).
● They share information like new transactions and new blocks.
● Because the network is globally distributed, it can survive node failures, attacks,
or shutdowns.
● Data is relayed across multiple pathways, ensuring no single point of failure.
✔ Node Discovery
● A new node finds peers using hardcoded seed nodes, DNS seeds, or manually
added addresses.
● Once connected, the node exchanges its known peers and adds them to its list.
✔ Message Exchange
✔ Data Propagation
● New transactions are broadcast to the network and stored in each node’s
mempool.
● Miners collect these and include them in new blocks, which are then broadcast
back across the network.
✔ Dynamic Maintenance
Full Node Stores the complete blockchain, validates all transactions and
blocks, relays data.
SPV (Lightweight) Verifies transactions using block headers, relies on full nodes
Node for full validation.
● Unstructured P2P Networks: In this type of P2P network, each device is able to
make an equal contribution. This network is easy to build as devices can be
connected randomly in the network. But being unstructured, it becomes difficult
to find content. For example, Napster, Gnutella, etc.
● Structured P2P Networks: It is designed using software that creates a virtual layer
in order to put the nodes in a specific structure. These are not easy to set up but
can give easy access to users to the content. For example, P-Grid, Kademlia, etc.
● Hybrid P2P Networks: It combines the features of both P2P networks and client-
server architecture. An example of such a network is to find a node using the
central server.
Applications:
● File Sharing: P2P network is the most convenient, cost-efficient method for file
sharing for businesses. Using this type of network there is no need for
intermediate servers to transfer the file.
● Blockchain: The P2P architecture is based on the concept of decentralization.
When a peer-to-peer network is enabled on the blockchain it helps in the
maintenance of a complete replica of the records ensuring the accuracy of the
data at the same time. At the same time, peer-to-peer networks ensure security
also.
● Direct Messaging: P2P network provides a secure, quick, and efficient way to
communicate. This is possible due to the use of encryption at both the peers and
access to easy messaging tools.
● Collaboration: The easy file sharing also helps to build collaboration among other
peers in the network.
https://www.geeksforgeeks.org/what-is-p2p-peer-to-peer-process/
In the Bitcoin network, nodes are computers running Bitcoin software that participate in
maintaining the network.
Different node types perform different roles — from fully validating the blockchain to
offering lightweight wallet services or specialized mining functions.
1️⃣Full Nodes
● Role:
○ Maintain a complete copy of the blockchain.
○ Independently validate all blocks and transactions against Bitcoin’s
consensus rules.
○ Relay valid transactions and blocks to other nodes.
● Example software: Bitcoin Core.
● Importance: Ensure the network’s security, decentralization, and integrity.
● Role:
○ Use Simplified Payment Verification (SPV) to verify transactions by
downloading only block headers (not full blocks).
○ Rely on full nodes for transaction proofs (Merkle branches).
● Example: Mobile wallets, lightweight desktop wallets.
● Importance: Provide Bitcoin access on devices with limited storage, sacrificing
some trust and security.
3️⃣Mining Nodes
● Role:
○ Build candidate blocks by collecting valid transactions from the mempool.
○ Perform Proof of Work (PoW) to find valid block hashes.
○ Broadcast new blocks to the network once mined.
● Note: Most mining nodes also act as full nodes; however, mining pools often use
lightweight or specialized nodes for coordination.
● Importance: Secure the network by producing new blocks and processing
transactions.
● Role:
○ Improve network efficiency by helping quickly propagate blocks and
transactions (e.g., using relay networks like FIBRE or Falcon).
○ Connect specialized protocols or provide services like data collection or
analytics.
● Importance: Enhance performance, speed, and robustness of the Bitcoin network.
Summary Table
Node Type Role and Function
SPV (Lightweight) Verifies transactions using block headers, relies on full nodes
Node for proofs
The extended Bitcoin network refers to all the systems and components that interact with
the core Bitcoin peer-to-peer (P2P) network — including specialized nodes, services, and
protocols that extend Bitcoin’s functionality beyond simple block and transaction
propagation.
It’s not just the regular Bitcoin full nodes but also various auxiliary systems that support
mining, lightweight wallets, scalability, and performance.
● Mining pools coordinate multiple miners to combine hash power and share
rewards.
● Mining nodes often run special protocols (like Stratum) that aren’t part of the
main Bitcoin P2P protocol.
● SPV (Simplified Payment Verification) wallets connect to full nodes but do not
store the entire blockchain.
● They rely on Merkle proofs and Bloom filters to verify transactions efficiently.
4️⃣Relay Networks
● Specialized overlay networks like FIBRE (Fast Internet Bitcoin Relay Engine) or
Falcon are used by miners to minimize latency in block propagation, improving
synchronization and reducing orphaned blocks.
✔ Scalability
● Mining pools and relay networks help maintain fast block distribution despite
global miner distribution.
✔ Efficiency
● Lightweight clients reduce the burden on user devices while still providing Bitcoin
access.
✔ Resilience
● The combination of core nodes, relay networks, and miners makes the system
robust against failures or attacks.
Summary Table
Component Role
Network discovery is the process by which a new or restarting Bitcoin node finds and
connects to other peers in the Bitcoin peer-to-peer (P2P) network.
Without central servers, Bitcoin nodes must independently locate peers to join the
decentralized network and begin exchanging transactions and blocks.
2. Establishing Connections
● The node initiates TCP connections (usually on port 8333) with known peers.
● Through a handshake process, the peers exchange version and verack
messages to confirm compatibility.
● Once connected, peers share lists of other known nodes using addr (address)
messages.
● The node learns about additional peers and may attempt to connect to them to
strengthen its network.
Purpose Allow a node to find and connect to peers in the Bitcoin network
Dynamic Learns new peers from connected nodes, replaces dead peers
Behavior
Ensures robust decentralization — nodes can find each other without central servers.
Allows the network to self-heal and adapt to node churn (nodes going offline or coming
online).
Provides resilience against attacks or failures by dynamically reconnecting to available
peers.
A full node in Bitcoin is a computer that fully enforces all of Bitcoin’s consensus rules by
maintaining a complete copy of the blockchain and independently verifying all
transactions and blocks.
Full nodes are essential for the security, decentralization, and integrity of the Bitcoin
network.
● A full node keeps a copy of all blocks and transactions, from the genesis block to
the present.
✅ Propagates Data
● Full nodes share validated transactions and blocks with other nodes, helping the
network stay synchronized.
● Full nodes serve lightweight (SPV) clients by answering requests for transaction
and block data.
✔ Disk Space
● Needs sufficient storage (currently hundreds of GB) to hold the entire blockchain.
✔ Bandwidth
✔ Processing Power
✅ Maximum Security
● Users don’t need to trust anyone else; they verify everything themselves.
✅ Better Privacy
● A full node downloads all transactions, not just the ones related to its own wallet,
preventing outside observers from easily tracking user interests.
Full Node Stores entire blockchain, fully verifies all rules, relays data
SPV Node Downloads only block headers, relies on full nodes for proofs
Mining Typically a full node with added mining software to find blocks
Node
Example Software
Simplified Payment Verification (SPV) nodes are lightweight Bitcoin clients that allow
users to verify transactions without downloading and storing the entire blockchain.
They were first described by Satoshi Nakamoto in the original Bitcoin whitepaper.
Key Idea
● Downloads only the block headers (each 80 bytes), not the full block data.
● Relies on proofs (Merkle paths) provided by full nodes to verify that a specific
transaction is included in a block.
This makes SPV nodes much faster and lighter, suitable for devices with limited storage
(e.g., mobile wallets).
● SPV nodes download and verify the chain of block headers to ensure they are on
the longest (valid) chain.
Transaction Verification
Trust Assumption
● SPV nodes trust that the majority of miners are honest and that the longest chain
is valid, but they do not independently validate the full block data.
● Only need to store block headers, not entire blocks (~80 bytes per block instead of
~1–2 MB per block).
Faster Synchronization
● Can connect and sync quickly, making them ideal for mobile or lightweight
applications.
Weaker Security
● SPV nodes are vulnerable to attacks like Sybil attacks or network partitioning,
where they might connect to fake nodes and be misled.
Less Privacy
● SPV nodes often reveal their addresses or interests to full nodes when requesting
filtered data, although Bloom filters can reduce this risk.
● SPV nodes depend on full nodes to supply accurate data (like Merkle proofs).
Summary Table
Aspect Description
Main Function Verify payments without downloading the full blockchain
A Bloom filter is a probabilistic data structure used in Bitcoin to help lightweight (SPV)
nodes efficiently request relevant transactions from full nodes without revealing exactly
which addresses or transactions they are interested in.
It allows nodes to filter large datasets quickly and with minimal bandwidth — but with a
small, controlled chance of false positives.
✔ Privacy Concern
● If an SPV node directly asked full nodes, “Do you have transactions for address
X?”, it would reveal its addresses and compromise user privacy.
● Instead of asking for exact matches, the SPV node sends a Bloom filter to the full
node.
● This filter represents the set of addresses or transaction patterns the SPV node is
interested in — but in a probabilistic way that doesn’t reveal exact details.
✔ Characteristics
✔ In Bitcoin
● The SPV node builds a Bloom filter from its wallet addresses.
● It sends this filter to the full node.
● The full node applies the filter when sending block or transaction data, reducing
the amount of irrelevant data.
Benefits
✅ Improves Privacy
● The filter hides the exact addresses the SPV node is interested in.
✅ Reduces Bandwidth
● The SPV node receives only a subset of all transactions, saving bandwidth.
✅ Efficient Search
● Bloom filters enable quick matching against large data sets (like blocks containing
thousands of transactions).
Limitations
⚠ False Positives
● The SPV node may receive some extra transactions it doesn’t care about, due to
the probabilistic nature of the filter.
⚠ Partial Privacy
● Over time, an attacker monitoring responses can still statistically infer the SPV
node’s addresses, especially if many filters are observed.
Summary Table
Aspect Description
In the Bitcoin network, inventory updates refer to the process by which nodes inform
each other about new data — mainly new blocks or transactions — that they have and can
share.
This mechanism ensures that all nodes stay synchronized and can efficiently exchange
the necessary data to maintain an up-to-date copy of the blockchain.
● Bitcoin nodes use special messages called inv (inventory) messages to advertise the
hashes of transactions or blocks they know about.
● Instead of flooding the network with full transaction or block data, nodes first
announce only the identifiers (hashes), which are small and efficient to transmit.
✔ Efficient Synchronization
Summary Table
Term Description
Purpose Let peers know what data you have without sending
everything
✅ Keeps nodes synchronized — ensures that all peers are aware of new
transactions and blocks.
✅ Reduces bandwidth usage — only necessary data is transmitted, not
everything.
✅ Supports decentralized operation — each node independently verifies and requests the
data it needs.
It acts as a waiting area for transactions before they are picked up and confirmed by
miners.
✔ Definition
● Every full node maintains its own local transaction pool (mempool).
● It holds all transactions that have been verified as valid but are still waiting to be
added to the blockchain.
✔ Temporary Storage
✔ Handling Orphans
● Nodes also keep track of orphan transactions — transactions whose parent (input)
transactions are unknown or missing.
● These are held temporarily in a separate orphan pool until the parent transactions
arrive.
Priority for Inclusion Based on transaction fees, age, and miner policy
Important Notes
✅ The size of the mempool can fluctuate based on network activity and block
space availability.
✅ During periods of congestion, transactions with low fees can remain stuck in
the mempool for extended periods.
✅ Each node’s mempool may differ slightly because nodes can have
different mempool limits or policies.
Alert messages were part of Bitcoin’s early design as a way for developers (particularly
Bitcoin Core maintainers) to broadcast critical messages across the entire Bitcoin
network.
They were used to notify all Bitcoin nodes about important events, such as:
✅ Security vulnerabilities
✅ Network emergencies
✅ Required software upgrades
✅ Critical forks or bugs
✔ Signed Broadcasts
● Alerts were digitally signed using a private key known only to Bitcoin Core
developers.
● This ensured that only authorized alerts could propagate across the network.
✔ Propagation Mechanism
● Once issued, the alert message would flood the P2P network and reach nodes and
wallets.
● Full nodes receiving the alert would verify the signature and, if valid, display or
log the message.
✔ Displayed to Users
● Many Bitcoin clients (especially earlier versions) were programmed to display the
alert to users, often as a popup or console message.
While the alert system was helpful early on, over time, it became centralized and posed
security risks:
Because of this, Bitcoin developers deprecated and disabled the alert system in 2016,
after transitioning to alternative communication methods (like developer mailing lists,
GitHub updates, and public announcements).
Summary Table
Feature Details
Current Status Alert system retired since Bitcoin Core v0.14 (2017)
Below are the key aspects to consider when developing Bitcoin systems securely:
Private keys are the single point of control over bitcoins. Secure systems
must:
✔ Generate keys using strong random number generators.
✔ Store private keys securely (e.g., hardware wallets, encrypted storage,
cold storage).
✔ Use BIP-38 encryption for private keys when necessary.
✔ Design recovery mechanisms (such as BIP-39 mnemonic seeds).
Bitcoin transactions involve scripts (locking and unlocking scripts, also called
scriptPubKey and scriptSig).
Secure systems must:
✔ Validate input/output amounts carefully.
✔ Avoid replay attacks or double-spending.
✔ Handle transaction chaining and orphan transactions properly.
✔ Follow best practices for constructing standard transactions (P2PKH,
P2SH, multisig).
Bitcoin offers:
● Testnet: A public test blockchain that allows developers to experiment without
real money.
● Regtest: A local blockchain for unit testing and simulations.
Secure systems are always tested extensively on test networks before mainnet
deployment.
Summary Table
Aspect Security Focus
1. Open Participation:
○ Anyone can read, write, or audit the blockchain.
○ No gatekeeping or centralized onboarding process is required.
2. Decentralization:
○ The control is distributed across the network’s participants rather than
being held by a single entity.
○ Nodes collectively maintain the blockchain.
3. Transparency:
○ All transactions are visible on the public ledger and can be verified by any
participant.
4. Security through Consensus:
○ Permissionless blockchains use consensus algorithms like Proof of Work
(PoW) or Proof of Stake (PoS) to validate transactions and maintain
network integrity.
5. Anonymity or Pseudonymity:
○ Users interact using cryptographic addresses rather than real-world
identities.
6. Immutable Ledger:
○ Once data is recorded on the blockchain and confirmed, it cannot be
altered or deleted without redoing the entire work, which is
computationally infeasible.
● It allows any developer to deploy smart contracts without needing any prior
approval.
● All Ethereum transactions are publicly visible and secured using decentralized
consensus mechanisms.
● Its state changes are synchronized through the blockchain and enforced by its
virtual machine, the Ethereum Virtual Machine (EVM).
Advantages:
Disadvantages:
1. Ether (ETH):
2. Test Ethers:
● Definition: Test Ethers are simulated or dummy Ether tokens used only on test
networks (not real or of monetary value).
● Purpose:
○ Enable developers to test and debug smart contracts and applications
without risking real ETH.
○ Help simulate real-world transactions in a safe environment.
● Networks: Used on Ethereum testnets like Ropsten, Goerli, Sepolia, etc.
3. Faucet:
● Definition: A Faucet is a web-based tool or service that provides free Test Ethers
to users.
● Functionality:
○ A user submits their wallet address to the faucet.
○ The faucet sends a small amount of Test Ether to the address.
● Use Case: Essential for developers working on testnets, as it gives them the
required ETH to run tests and deploy contracts.
Summary Table:
Component Description Purpose
Faucet Tool to get Test ETH Provides developers with free Test Ether
Key Differences:
Feature EOA Contract Account
Address Generation:
Example Scenario:
● Alice (EOA) wants to transfer ETH to Bob (EOA). She signs the transaction with
her private key and sends it.
● Alice (EOA) wants to interact with a voting dApp (Contract Account). She initiates
a transaction, and the smart contract's code executes the voting logic.
● A contract (like a decentralized exchange) interacts with another token contract to
swap assets.
● The contract account itself cannot trigger any transaction without an external call.
● Security: EOAs are prone to attacks if private keys are compromised, while
contract accounts rely on secure smart contract code.
● Functionality: Only EOAs can initiate actions, while contracts only respond to
them.
● Gas Costs: EOAs bear the gas costs when interacting with contracts.
4. What is Digital Signature with ECC
A Digital Signature is a cryptographic technique used to ensure the authenticity and
integrity of a message, transaction, or document. In Ethereum, digital signatures are
created using Elliptic Curve Cryptography (ECC), specifically the secp256k1 curve.
1. Key Generation:
○ A user generates a private key and derives a public key using ECC.
2. Signing:
○ When a transaction is created, it is hashed (e.g., using Keccak-256).
○ The sender signs the hash using their private key, generating a digital
signature.
3. Verification:
○ Anyone can verify the transaction using the public key, the signature, and
the original message (hash).
○ If the signature is valid, it confirms:
■ Authenticity (signed by the rightful private key holder)
■ Integrity (data hasn’t been tampered with)
● Security: Very hard to reverse-engineer the private key from the public key.
● Efficiency: ECC provides high security with smaller key sizes, making it faster and
less resource-intensive than RSA.
● Compact Signatures: Ideal for blockchain where storage and bandwidth are
limited.
Example in Ethereum:
An Ethereum transaction is a signed data message sent from one Ethereum account to
another. It is the fundamental unit of operation that triggers state changes on the
Ethereum blockchain.
Types of Transactions:
1. Regular Transactions:
○ From an Externally Owned Account (EOA) to another EOA.
○ Used for transferring Ether (ETH).
2. Contract Deployment:
○ From an EOA that creates a new smart contract on the blockchain.
○ No recipient address; includes compiled contract code in the data field.
3. Contract Execution:
○ Sent to an existing contract account to invoke specific functions.
○ May include ETH and data payload for function execution.
Main Components of an Ethereum Transaction:
Component Description
Gas Price Fee per unit of gas (in Gwei) the sender is willing to pay.
Gas Limit Maximum amount of gas units the sender is willing to use.
Signature (v, r, s) Digital signature fields that prove the sender’s identity.
Transaction Lifecycle:
1. Key Management:
○ Stores and manages private and public keys securely.
○ Uses the private key to sign transactions.
2. Transaction Handling:
○ Creates, signs, and sends Ethereum transactions.
○ Displays transaction history and balances.
3. User Interface:
○ Provides a friendly interface to view balances, manage tokens, and connect
to dApps.
● Hot Wallets: Connected to the internet (e.g., MetaMask); more convenient but less
secure.
● Cold Wallets: Offline wallets (e.g., hardware wallets); more secure but less
convenient.
Example – MetaMask:
● Mechanism:
○ Miners solve complex cryptographic puzzles to validate a block.
○ The first miner to find a valid solution broadcasts the block.
○ Other nodes verify it and add it to their blockchain.
● Algorithm used: Ethash (modified Dagger-Hashimoto).
● Security: High due to computational cost.
● Drawback: High energy consumption and slower scalability.
● Mechanism:
○ Validators are selected to propose and attest blocks based on the amount of
ETH they stake.
○ The more ETH staked, the higher the chance of being selected.
○ Malicious validators risk losing their stake.
● Consensus Protocol: Casper.
● Advantages:
○ Energy-efficient.
○ Faster and more scalable.
○ Encourages long-term participation via staking.
Risk Factor 51% attack if attacker controls 51% attack if attacker controls
over 50% of hash power. over 50% of total stake.
Mining in Ethereum (before the switch to Proof of Stake) was the process of validating
transactions, assembling them into blocks, and securing the blockchain using Proof of
Work (PoW) consensus. It involved solving complex cryptographic puzzles to add new
blocks to the Ethereum blockchain.
● Ethereum used a PoW algorithm called Ethash, a memory-hard algorithm that is:
○ ASIC-resistant: Favors GPU miners to support decentralization.
○ Requires a large DAG (Directed Acyclic Graph) file stored in memory to
solve.
● Each transaction has a gas cost, which compensates miners for computation and
storage.
● Transaction Fee = Gas Used × Gas Price (in Ether).
Post-Merge Change:
● After "The Merge" (September 2022), Ethereum transitioned from PoW to Proof of
Stake (PoS).
● Mining was replaced with staking and validator nodes.
9. What is Merkle Patricia Tree
A Merkle Patricia Tree (also called a Merkle Patricia Trie) is a specialized data structure
used by Ethereum to store and manage the blockchain’s state in a secure, efficient, and
verifiable way. It combines two concepts:
Purpose in Ethereum:
Feature Description
Deterministic Given same data, always produces the same tree and root
hash.
1. State Trie – Stores accounts, balances, nonce, contract code, and storage root.
2. Storage Trie – For each account with contract storage.
3. Transaction Trie – Stores all transactions in that block.
How It Works:
Benefits:
● Security: Detects tampering or invalid data instantly.
● Scalability: Only requires root hash for verification.
● Efficiency: Supports quick lookup, insert, and delete operations.
● Purpose: Maintains agreement among nodes about the state of the blockchain.
● Technologies:
○ BTC meta protocol
○ BTC merge-mine
○ Independent chain (PoW, PoS, DPoS)
○ ETH contract
● Explanation:
This layer ensures that all nodes follow the same rules and agree on the state of
the ledger. Ethereum initially used Proof of Work (PoW) and later transitioned to
Proof of Stake (PoS) via Ethereum 2.0.
Layer 4: Browsers
Ethereum Workflow
1. Transaction Creation:
○ A user creates and signs a transaction via a wallet.
2. Broadcast to Network:
○ The transaction is broadcast to Ethereum’s P2P network.
3. Validation and Consensus:
○ Validators (PoS) validate the transaction and include it in a proposed
block.
○ The network reaches consensus to accept the block.
4. Execution in EVM:
○ The Ethereum Virtual Machine (EVM) executes smart contracts.
○ State transitions (e.g., balance updates) are applied.
5. Block Finalization:
○ The block is added to the blockchain.
○ All nodes update their local copy of the blockchain.
Technical Definition:
State Machine EVM acts as a deterministic state machine that updates the
global state (Ethereum’s data) with every transaction.
Execution It executes programs written in bytecode, which is typically
Environment compiled from high-level languages like Solidity or Vyper.
Isolation Every contract runs in a sandboxed environment, ensuring that
execution doesn't affect other contracts or the node itself.
Gas Mechanism EVM uses gas to meter computation and prevent infinite loops or
denial-of-service (DoS) attacks.
EVM Architecture:
Why It Matters:
💡 Example Use-Case:
If you deploy a smart contract for a voting system:
● The EVM executes all voting logic (e.g., voter validation, counting).
● Updates state (e.g., vote count).
● Charges gas depending on the complexity of the operations.
The concept comes from Alan Turing, the father of modern computer science. He
proposed the idea of a Turing Machine, an abstract machine that manipulates symbols
on a tape to perform computation.
It is owned and controlled by the logic of its code, not by a person or organization.
Simplified Explanation:
Smart Contracts are self-executing agreements where the terms are directly written into
code. Once deployed on the blockchain, they run automatically when certain conditions
are met — without third-party involvement.
They are:
● Transparent
● Tamper-proof
● Decentralized
Deterministic Smart contracts always produce the same output for the same input
— ensures consistency across all Ethereum nodes.
Immutable Once deployed, the contract cannot be altered. This guarantees trust
and prevents tampering.
Transparent Anyone can inspect the code of the smart contract on the
blockchain, improving trust and auditability.
Autonomous Operates independently; its behavior is dictated only by its code and
inputs, not by external commands.
Cost-effective Reduces the need for intermediaries, thus lowering transaction and
administrative costs.
● Voting systems
● Escrow systems
● Insurance claim automation
● Supply chain tracking
Smart contracts can be classified based on how they are used, who can interact with
them, and what kind of data or control they provide.
● These are smart contracts that act as the backend logic of a decentralized
application.
● DApps can have one or many smart contracts interacting with frontends (e.g., a
web app).
● Example: Uniswap smart contracts powering the DApp frontend.
● These contracts govern organizations using rules coded into smart contracts.
● Decisions (e.g., budget spending, adding features) are made by community voting
via token holdings.
● Example: MakerDAO or Compound Finance governance models.
● Key feature: No central authority; decisions are made via code and community
votes.
// Optional
● These contracts interact with off-chain data using oracles (trusted data feeds).
● Example: Insurance payout contracts that rely on weather data.
● Without oracles, smart contracts cannot access external information (like stock
prices, weather, etc.).
Note: Oracles themselves are not smart contracts but act as bridges between
blockchain and real-world data.
In Summary :
Type of Smart Description
Contract
What is an Oracle?
In blockchain, a smart contract cannot directly access external data (off-chain data like
weather, prices, scores, etc.).
An oracle is a trusted third-party service that feeds external data into the blockchain so
smart contracts can use it.
Oracles act as bridges between the blockchain and the real world.
1. Software Oracles Fetch data from online sources like APIs, websites,
and databases.
Example: Price of ETH from CoinGecko API.
● They enable complex, real-world applications like insurance, supply chain, and
prediction markets.
● Without oracles, smart contracts would be isolated and blind to any external
event.
● Software Oracles
● Hardware Oracles
● Inbound Oracles
● Outbound Oracles
● Human Oracles
● Consensus-Based Oracles (Decentralized)
The life cycle of a smart contract describes the stages it goes through, from writing the
code to being deployed and executed on the Ethereum blockchain.
● The developer writes the smart contract logic using a language like Solidity or
Vyper.
● This includes defining functions, variables, events, etc.
● The high-level code is compiled into EVM bytecode, which is readable by the
Ethereum Virtual Machine.
● Tools like Remix, Truffle, or Solc are used for this.
5. Interaction / Execution
● Users interact with the deployed contract by calling its functions via transactions.
● The Ethereum nodes execute the contract’s logic via the EVM, and state changes
are recorded on the blockchain.
● Examples: transferring tokens, placing bets, voting, etc.
6. Termination (Optional)
What is IPFS?
Simplified Explanation:
Each file is given a cryptographic hash, and that hash becomes its address on the
network.
Decentralized Files are stored and retrieved from multiple peer nodes, not a
single server.
Offline-Friendly You can still retrieve files from peers even if some nodes go
offline.
Summary:
Swarm is Ethereum’s solution for decentralized file storage, enabling truly decentralized
applications to run without relying on centralized web servers. It complements Ethereum
by offloading data that is too large or expensive to store on-chain.
Whisper is ideal for scenarios where you want to send messages directly between users or
dApps, without revealing identities, and without storing messages on the blockchain.
1. P2P Broadcasting
○ Messages in Whisper are broadcast to all nodes in the network.
○ Only the intended recipient, who has the correct decryption key, can read
the message.
2. Asymmetric Encryption:
○ Whisper uses public/private key cryptography to ensure that only the
recipient of a message can decrypt and read it.
○ Messages are encrypted using the recipient’s public key.
3. Time-to-Live (TTL):
○ Each message has a TTL, indicating how long it should stay in the network.
○ After TTL expires, nodes delete the message.
4. Topics for Filtering:
○ Messages can be tagged with a "topic" (a short identifier, like a tag or
category).
○ Nodes can subscribe to specific topics to only receive relevant messages.
5. Proof-of-Work (PoW):
○ Whisper requires a small amount of PoW to send a message.
○ This prevents spam and abuse of the network.
● Resource Heavy: Every node receives all messages; this is bandwidth and storage
intensive.
● Slow Adoption: Due to performance issues, many Ethereum developers now
prefer off-chain or alternative messaging protocols.
● Being Deprecated: Whisper has been somewhat deprecated in favor of Libp2p and
other messaging stacks like Status.im or even Matrix.
Summary
Feature Description
It is designed to make dApp development easier by providing tools that automate and
streamline the development workflow.
Think of Truffle as what Node.js and npm are for web development — it gives Ethereum
developers a structured and efficient environment to build decentralized applications.
truffle-config.js The main configuration file for specifying networks, compilers, and
directories.
Advantages of Truffle
Limitations
Summary
Feature Description
Written In JavaScript
Ganache is a local Ethereum blockchain simulator used for developing, testing, and
deploying smart contracts in a controlled environment.
It is part of the Truffle Suite (which includes Truffle, Ganache, and Drizzle).
Ganache provides:
It helps developers test their dApps before deploying them to a live network like Ropsten
or Ethereum Mainnet.
Types of Ganache
Pre-funded Accounts Ganache creates multiple test accounts, each loaded with
fake ETH.
Logging View all transaction details, contract deployment history,
gas usage, etc.
Chain Reset You can reset the blockchain to start fresh without
reinstalling anything.
Events and Logs Shows events emitted by contracts for debugging purposes.
Advantages of Ganache
Limitations
● Not connected to the real Ethereum network (only for local dev).
● Cannot simulate real-world network latency or full-scale attacks.
● Not suitable for testing real PoW/PoS consensus behavior.
Summary
Field Detail
What is Remix?
Remix is a web-based IDE (Integrated Development Environment) used to write,
compile, deploy, and debug smart contracts written in Solidity — the main language for
Ethereum smart contracts.
It is one of the most beginner-friendly and widely used tools for Ethereum development.
Solidity Editor Write and edit smart contracts directly in your browser.
Solidity Compiler Compile Solidity code and get ABI (Application Binary Interface)
and bytecode.
Deploy & Interact Deploy smart contracts to JavaScript VM (local), Injected Web3
(like MetaMask), or external networks (like Ropsten).
Plugin Includes tools like Solidity Unit Testing, Gas Estimator, Static
Architecture Analysis, etc.
Security Tools Built-in linters and analyzers to detect vulnerabilities in smart
contracts.
1. Open Remix:
○ Go to https://remix.ethereum.org
○ No installation needed — it runs directly in the browser!
2. Write Code:
○ Create a .sol file (e.g., MyToken.sol) and write your Solidity smart
contract.
3. Compile Code:
○ Use the Solidity Compiler tab to compile the smart contract.
○ Errors and warnings are displayed to help fix issues.
4. Deploy Contract:
○ Choose an environment:
■ JavaScript VM – Simulated blockchain in browser (no real wallet
needed).
■ Injected Web3 – Deploy via MetaMask to testnets or mainnet.
■ Web3 Provider – Connect to Ganache, Infura, etc.
○ Deploy and interact with the contract from the UI.
5. Interact and Test
○ Call contract functions using the Remix UI.
○ Send transactions, view gas usage, and see return values.
Use Cases
Advantages of Remix
● Beginner-friendly with visual UI.
● No installation or dependencies.
● Fast feedback cycle — write → compile → test instantly.
● Compatible with MetaMask and test networks.
● Supports static analysis and testing tools.
Limitations
● Best for small to medium contracts — large projects are better handled in local
IDEs (like Truffle or Hardhat).
● Not as customizable or scalable as local development environments.
Summary
Field Description
Website https://remix.ethereum.org
MetaMask is a cryptocurrency wallet and browser extension that allows users to:
Summary
Feature Description
Website https://metamask.io
They allow developers to build, test, and debug dApps and smart contracts in a safe
environment — without the risk or cost of using real cryptocurrency.
Goerli Most widely used testnet, supported by MetaMask and faucets. Uses
Proof-of-Authority.
Sepolia A lightweight testnet designed for future use; fast and stable.
Currently, Sepolia and Goerli are the most recommended testnets for Ethereum.
You can get free test ETH (not real money) using a faucet, which is a service that sends
test coins to your address:
Deploying on Testnets
The process of deploying smart contracts to testnets is exactly like deploying to the
mainnet, but using:
Summary
Feature Description
Purpose Practice and test smart contracts without using real ETH
What is Web3?
Definition:
Web3 refers to the next generation of the internet, built on blockchain technology. It
emphasizes decentralization, user ownership, and direct peer-to-peer interaction,
removing the need for centralized intermediaries.
Web1 (Static Web) Read-only websites (1990s–early 2000s). Users could only view
content.
Web2 (Social Web) Read-write web (2000s–present). Users can create, share, and
interact, but centralized platforms (like Google, Facebook)
control the data.
Benefits of Web3
Benefit Description
Challenges of Web3
Summary
Field Detail