Docsity

Chapter_18_Blockchain_and_Distributed_Ledgers, Lecture notes of Computer Fundamentals

Toggle sidebar
bg1
AP PL IED CO MPU TI NG • CH AP TER 1 8
Blockchain & Distributed Ledgers
Cryptographic Hashing, Merkle Trees, Consensus Mechanisms & Smart Contracts
1. Anatomy of a Cryptographic Block
A blockchain is an append-only, distributed ledger where batches of transactions are linked together using cryptographic hash
functions (such as SHA-256).
Figure 18.1 — Tamper-Evident Hash Linking Across Sequential Ledger Blocks
Immutability: Altering a single transaction in Block #101 changes its hash, breaking the Prev Hash pointer in Block
#102 and every subsequent block.
Merkle Tree: Pairs of transaction hashes are repeatedly hashed together into a single root hash, allowing lightweight nodes
to verify inclusion in O(log n) steps.
2. Consensus Mechanisms
Mechanism How Validators Are Chosen Trade-Offs
Proof of Work
(PoW)
Miners compete to find a nonce producing a target hash High security, but high electricity use & slower
throughput
Proof of Stake
(PoS)
Validators lock native tokens as collateral; malicious
acts get slashed
99%+ lower energy use & faster block finality
PBFT / Raft Known permissioned nodes vote in rounds Sub-second finality, suited for private enterprise
consortia
3. Smart Contracts & Practical Use Cases
Smart Contracts: Deterministic programs stored on-chain that automatically execute agreements (e.g., escrow release) when
predefined conditions are met.
Block #101
Prev Hash: 000a8f...
Merkle Root + Nonce
Block #102
Prev Hash: 0004c1...
Merkle Root + Nonce
Block #103
Prev Hash: 0009e2...
Merkle Root + Nonce
•
•
•
pf2

Partial preview of the text

Download Chapter_18_Blockchain_and_Distributed_Ledgers and more Lecture notes Computer Fundamentals in PDF only on Docsity!

AP PLIED COMPUTING • CH AP T ER 18

Blockchain & Distributed Ledgers

Cryptographic Hashing, Merkle Trees, Consensus Mechanisms & Smart Contracts

1. Anatomy of a Cryptographic Block

A blockchain is an append-only, distributed ledger where batches of transactions are linked together using cryptographic hash functions (such as SHA-256).

Figure 18.1 — Tamper-Evident Hash Linking Across Sequential Ledger Blocks

Immutability: Altering a single transaction in Block #101 changes its hash, breaking the Prev Hash pointer in Block #102 and every subsequent block. Merkle Tree: Pairs of transaction hashes are repeatedly hashed together into a single root hash, allowing lightweight nodes to verify inclusion in O(log n) steps.

2. Consensus Mechanisms

Mechanism How Validators Are Chosen Trade-Offs Proof of Work (PoW)

Miners compete to find a nonce producing a target hash High security, but high electricity use & slower throughput Proof of Stake (PoS)

Validators lock native tokens as collateral; malicious acts get slashed

99%+ lower energy use & faster block finality

PBFT / Raft Known permissioned nodes vote in rounds Sub-second finality, suited for private enterprise consortia

3. Smart Contracts & Practical Use Cases

Smart Contracts: Deterministic programs stored on-chain that automatically execute agreements (e.g., escrow release) when predefined conditions are met.

Block # Prev Hash: 000a8f... Merkle Root + Nonce

Block # Prev Hash: 0004c1... Merkle Root + Nonce

Block # Prev Hash: 0009e2... Merkle Root + Nonce

Best-Fit Applications: Cross-border settlement, tamper-proof supply chain provenance, and verifiable digital credentials— not high-frequency private databases where a central authority is already trusted.