Blockchain Intro
Chapter 1: Introduction
Overview
Introduction to blockchain fundamentals and the key concepts involved.
Full Nodes
Four full nodes: f1, f2, f3, f4 in the network.
All full nodes should maintain an identical blockchain, leading to a distributed ledger.
Transparency and Verifiability
All data is transparent within the network, allowing any participant to view and verify any block.
Participants can verify blocks like the Genesis block (block 0) and others (e.g., block 5, block 6).
Data Availability
Even if one node goes offline, the remaining nodes maintain the blockchain, ensuring availability.
Offline nodes can update their blockchains once they reconnect.
Connection between Nodes
Nodes do not require a complete graph; they do not need to connect with every other node directly.
Chapter 2: Structure of Blockchain Blocks
Block Components
Consist of two parts: block header and block data.
Block Data
Contains actual data (e.g. patient records for healthcare-related blockchain, or transaction data for Bitcoin).
Block Header
Comprises four elements: timestamp, hash of the block data, and hash of the block header.
Timestamp
Represents when the block was created, with sequentially increasing timestamps.
Nonce
A number used only once, serving as a puzzle for miner nodes to solve to create a block.
Hash of Block Data
Ensures the integrity of block data, often through hashing the entire block data using algorithms like SHA256 or Merkle Tree for Bitcoin.
Chapter 3: Create A Block
Transaction Generation
Initial transactions are made (e.g., Alice buys something online).
Transactions are digitally signed to ensure authenticity.
Transaction Validation
Full nodes verify transactions using public key cryptography before adding them to their memory pools.
Transactions remain pending until confirmed in a block.
Chapter 4: Block Creation Process
Full Node Processing
Full nodes store valid transactions in their memory pools.
They broadcast transactions to neighboring nodes to communicate new pending transactions.
Competition Among Miners
Miners compete to create new blocks by selecting transactions from their own or neighboring memory pools based on transaction fees.
Mining Rewards
Miners are incentivized through transaction fees and block rewards for creating new blocks.
Chapter 5: Proof of Work Process
Mining Process
Miners solve computationally intensive HashCash puzzles to create blocks.
Success involves finding a nonce that meets network difficulty requirements.
Difficulty Adjustment
The network adjusts mining difficulty based on the average block production time to maintain a consistent block creation rate.
Chapter 6: Conflicting Blockchain States
Temporary Forks
Miners may occasionally produce blocks simultaneously, leading to two competing blockchains.
Eventually, the longest valid chain is accepted due to greater proof of work.
State Blocks
Shorter chains with less work are discarded, and their transactions return to the memory pool.
Chapter 7: Disadvantages of Proof of Work
Environmental Impact
High energy consumption associated with Bitcoin mining (estimated to consume 150 terawatt hours annually).
Comparatively, some countries like New Zealand use less energy overall.
Hardware Arms Race
Miners continually seek superior hardware, leading to market pressures and shortages.
Chapter 8: Attacks and Prevention
Double Spending Attack
An attacker executes two conflicting transactions to exploit the delay before confirmation.
Prevention involves waiting for transactions to be confirmed before further actions are taken, typically waiting for 6 confirmations to ensure security.