2
Outline
• Describing thefundamentals of distributed systems
• Defining blockchain technology
• Understanding how blockchain technology was developed
• Detailing the elements of a blockchain
• Identifying the benefits and limitations of blockchain technology
3.
3
Introduction
Blockchain is anew revolutionary technology that will change our lives. In this chapter we will
cover the theory of blockchain technology, and its technical foundations.
4.
4
Introducing distributed computing
•A distributed system is a computing paradigm whereby two or more nodes work with one
another, in a coordinated fashion, to achieve a common outcome.
• A distributed system is modeled in such a way that end users see it as a single logical
platform.
• Examples include clusters and clouds.
6
Design of adistributed system
N4 is a Byzantine node, L2 is broken or a slow network link
Node
– computer or participant
– miners (in Proof of Work), validators (in
Proof of Stake), or simple participants
N4 – leader node or reference node
Communication Link
– L1 → L5 is communication path
– shows the transactions, propose blocks
and broadcast validations
– peer to peer communication
7.
7
CAP theorem
This statesthat a distributed system cannot have all three of the
desired properties simultaneously; that is:
• Consistency - All nodes see the same data at the same time. If you write
data to one node, all others must update immediately before serving that
data.
• Availability - The system is always responsive. Even if some nodes are
down, others will still serve the request.
• Partition tolerance - A partition is when communication breaks between
parts of the system. A partition-tolerant system keeps running in both
halves, even if they can’t talk.
8.
8
CAP theorem
• Canall of them exist at the same time?
• CA (if no partition ever happens — unrealistic in practice)
• CP (but might have downtime for some users)
• AP (but may serve stale data)
9.
9
Types of faultsin distributed systems
Fail-stop faults (crash faults)
• Where components crash or cease to operate
• Simpler to deal with
Byzantine faults
• Where components are potentially untrustworthy or malicious
• Difficult to deal with
10.
10
Defining ‘Blockchain’
Layman's definition:Blockchain is an ever-growing, secure, shared
recordkeeping system in which each user of the data holds a copy of the
records, which can only be updated if all parties involved in a transaction
agree to update.
Technical definition: Blockchain is a peer-to-peer distributed ledger that is
cryptographically-secure, append-only, immutable (extremely hard to
change), and updateable only via consensus or agreement among peers.
11.
11
Blockchain definition
• Peer-to-peer- A peer-to-peer (P2P) network is a system where computers (called peers) communicate and share data directly with each
other, without a central server. Each peer can act as both a client and a server, allowing decentralized sharing and equal participation
• Distributed ledger - A distributed ledger is a shared database that is spread across multiple computers (nodes). Every participant has a
copy of the ledger, and all changes are synchronized across the network. It ensures transparency, security, and removes the need for a
central authority.
• Cryptographically secure - Cryptographically secure means that the system uses strong mathematical techniques (like hashing and
encryption) to protect data. This ensures that information is private, tamper-proof, and that identities and transactions can be verified
safely.
• Append only - An append-only system allows data to be added but not deleted or changed. Once information is written, it becomes a
permanent part of the record.
• Updateable via consensus (consensus-driven) - Consensus-driven means that any update to the system must be agreed upon by a
majority of participants (nodes). This ensures that no single party can make changes alone, promoting fairness, trust, and integrity in a
decentralized environment.
12.
How did blockchaintechnology develop?
• 1950s – Hash functions
• 1970s – Merkle trees - hashes in a tree structure
• 1970s continued – Research in distributed systems, consensus, state
machine replication
• 1980s – Hash chains for secure logins
• 1990s – e-Cash for e-payments
• 1991 – Secure timestamping of digital documents.
• 1992 – Hashcash idea to combat junk emails
• 1994 – S/KEY application for Unix login.
• 1997/2002 – Hashcash
• 2008/2009 – Bitcoin (the first blockchain)
12
Architectural view ofBlockchain 15
Users/Node:
• Users interact with blockchain through
nodes.
• A personal computer, laptop, or even
mobile device running blockchain
software. They may also be servers,
especially in enterprise or mining/validator
setups.
• Nodes maintain the ledger, validate
transactions, and participate in consensus.
• Types of nodes:
• Full Nodes: Store complete
blockchain.
• Light Nodes: Store partial blockchain,
rely on others for validation.
• Mining / Validator Nodes: Contribute
to block creation and consensus.
16.
Architectural view ofBlockchain 16
Applications:
•Smart Contracts: Self-executing agreements
with predefined rules. (Examples)
•Decentralized Applications (DApps): Apps
running on blockchain, transparent and
trustless.
•Decentralized Autonomous Organizations
(DAOs): Community-governed organizations
operating via smart contracts.
•Autonomous Agents: Software agents that
operate independently on blockchain.
17.
Examples of SmartContract 17
Examples of Smart
Contracts
1. Voting Contract (5
Nodes)
Purpose: To decide outcomes
based on majority approval.
How it works: Each of the 5
nodes casts a vote. The contract
specifies that at least 3 out of 5
approvals are needed.
Outcome: Once the threshold is
met, the result is automatically
finalized and recorded on the
blockchain.
2. Payment Contract (5
Nodes)
Purpose: To securely transfer
tokens between users.
How it works: Node A initiates a
transfer of 10 tokens to Node B.
All 5 nodes validate the
transaction using consensus.
Outcome: Once confirmed, the
tokens are automatically moved
from A to B without
intermediaries.
3. Multi-Signature Wallet
(5 Nodes)
Purpose: To manage funds with
shared control.
How it works: A wallet contract
requires at least 3 out of 5
authorized nodes to sign before
releasing funds.
Outcome: Prevents a single party
from misusing funds; ensures
trust among group members.
4. Escrow Agreement (5
Nodes)
Purpose: To hold funds until
conditions are met.
How it works: Funds are locked
in the contract. The contract
specifies that 4 out of 5 nodes
must confirm delivery of
goods/services.
Outcome: Once confirmation is
reached, the funds are released
to the seller; otherwise, they are
returned to the buyer.
18.
Architectural view ofBlockchain 18
Execution:
• Virtual Machines (VMs): E.g., Ethereum
Virtual Machine (EVM) executes smart
contract code.
• Blocks: Groups of validated transactions
added to the chain.
• Transactions: Digital records of asset
transfers or contract executions.
19.
Architectural view ofBlockchain 19
Consensus:
• State Machine Replication: Keeps all
nodes in sync.
• Proof-Based Consensus: PoW, PoS, or
Proof of Authority.
• Byzantine Fault Tolerant (BFT) Protocols:
Such as PBFT, ensuring reliability even with
faulty or malicious nodes.
20.
Architectural view ofBlockchain
• Cryptography:
• Public Key Cryptography: Provides digital
identity and security.
• Digital Signatures: Authenticate and verify
integrity of transactions.
• Hash Functions: Ensure immutability of data. (
Hash Property)
20
21.
Architectural view ofBlockchain
• P2P:
• Gossip Protocols: Spread information rapidly
across nodes.
• Routing Protocols: Ensure efficient
communication.
• Flooding Protocols: Broadcast data widely
within the network.
21
Genesis block
Transactions &
otherdata
Block 1
Transactions &
other data
Previous hash
Block 2
Transactions &
other data
Previous hash
. . . . .
Block N
Transactions
& other data
Previous
hash
Generic structure of a blockchain 23
24.
Generic structure ofa blockchain 24
•Blocks in Sequence
• The diagram shows a sequence of blockchain blocks: Genesis Block,
Block #1, Block #2, Block #3.
• Each block is linked to the previous one, forming a chain.
•Block Components
• Each block consists of two main parts:
1. Header (contains metadata about the block)
2. Data (contains transactions or other information)
•Header Details
• Parent (Previous Block Hash):
• Found in all blocks except the Genesis Block.
• Ensures that each block is cryptographically linked to the block
before it.
•Merkle Root:
•A hash representing all transactions in that block.
•Provides a compact way to verify the integrity of transactions.
•Genesis Block
•First block in the blockchain.
•Does not have a parent since it is the starting block.
•Still contains a Merkle Root and Data.
•Linking Between Blocks
•The Parent hash in Block #1 points back to the Genesis Block.
•Block #2 references Block #1, and Block #3 references Block #2, and
so on.
•This chaining makes tampering difficult—any change in one block
would invalidate all subsequent blocks.
•Data Section
•Stores the actual transaction records or relevant block data.
•Its integrity is verified through the Merkle Root in the header.
25.
25
Generic elements ofa blockchain
• Addresses - Unique identifiers used to receive or send cryptocurrency or data on a blockchain. Similar to a bank account number
• Accounts - Entities that hold balances and can initiate transactions. In Ethereum, accounts can be user-controlled (EOA) or smart contracts
• Transactions - Instructions sent from one account to another, usually involving the transfer of assets or execution of smart contract code.
• Blocks - Groups of validated transactions bundled together and added to the blockchain. Each block links to the previous one.
• Peer-to-peer network - A decentralized network where each computer (node) communicates directly with others, without relying on a central
server.
• Scripting or programming language - Used to write logic for smart contracts. Examples include Solidity (Ethereum) and Bitcoin Script
• Virtual machine - A sandboxed environment (like Ethereum Virtual Machine) that runs smart contracts securely and ensures consistent
execution across nodes
• State machine - A system that maintains and updates the status of all blockchain data (accounts, balances, contracts) after each transaction
• Nodes - Computers that participate in the blockchain network by storing data, validating transactions, and broadcasting update
• Smart contracts - Self-executing programs stored on the blockchain that automatically perform actions when predefined conditions are met
26.
26
How a blockchainworks
1. User X transacts with User Y
Smart contract or transfer of value
2. Transaction broadcast 3. Find new block (mining) 4. New block found (mined)
5. Add new block to
the blockchain
27.
27
How a blockchainworks
1. User X transacts with User Y
This is the starting point of a transaction, which could be:
• A smart contract execution (e.g., automated agreement with set rules).
• A transfer of value (e.g., sending cryptocurrency from one wallet to another).
2. Transaction broadcast
• The transaction is broadcast to the blockchain network.
• This means the details of the transaction are shared with multiple nodes (computers) in
the network.
• Each node receives and records the pending transaction.
3. Find new block (mining)
• Nodes (miners/validators) work to verify the transaction.
• In Proof of Work (PoW) systems, this involves solving a complex mathematical puzzle
(hashing).
• In Proof of Stake (PoS), validators are selected to propose the new block.
4. New block found (mined)
• Once a miner/validator successfully verifies the transaction, a new block is created.
• This block contains:The verified transaction(s).A timestamp.A cryptographic hash linking it
to the previous block.
5. Add new block to the blockchain
• The newly created block is added to the blockchain ledger.
• This update is replicated across all nodes in the network.
• Once added, the transaction becomes permanent and immutable (cannot be changed or
deleted
29
Benefits of blockchain
•Decentralization
• Transparency
• Trust
• Immutability
• High availability
• Highly secure
• Simplification of current paradigms
• Faster transactions
• Cost saving
30.
30
Limitations of blockchain
•Scalability - Blockchain networks process transactions slowly due to consensus mechanisms,
limiting throughput compared to traditional systems like Visa.
• Adaptability - Blockchain protocols are rigid, making it difficult to modify or upgrade without
disrupting the network or requiring consensus
• Regulation - Lack of clear legal frameworks causes uncertainty in adoption, especially regarding
taxes, compliance, and cross-border use
• Relatively immature technology - Blockchain is still evolving; many platforms face bugs,
inefficiencies, and lack robust infrastructure compared to mature technologies.
• Privacy - Most blockchains are transparent by design, making it hard to keep sensitive data
confidential without additional privacy layers
31.
Features of ablockchain
• Distributed consensus
• Transaction verification
• Platform for smart contracts
• Transferring value between peers
• Generation of cryptocurrency
• Provider of security
• Immutability
• Uniqueness
19
32.
Exercise
• Think abouta scenario where blockchain can solve a challenge at your place of work or
education, or in your community.
• Read the Bitcoin paper at https://bitcoin.org/bitcoin.pdf
20
33.
33
Summary
In this presentation,we:
• Covered the design of a distributed system and faults in distributed systems.
• Defined blockchain as a distributed ledger—a replicated digital ledger which is immutable
and updateable only via consensus.
• Introduced precursors to blockchain technology such as hash functions, consensus
mechanisms, Hashcash, and e-cash schemes.
• Explored various elements of a blockchain, such as addresses, peer-to-peer networks,
blocks, and transactions.
• Considered the benefits and limitations of blockchain technology.