Teaching Blockchain
Teaching Blockchain
Maic Sebakara
ICP Rwanda
+250 786 091 893
[email protected]
What is blockchain?
Let’s see some terminologies in blockchain:
Summary
1. Block: a group of data
2. Chain: linked together.
3. A blockchain is a group of data linked
together!
History and Evolution
Web1 (Read-Only Web)
Web1.0, also known as the “Read-Only Web” or the “Static Web,” refers to the early days of the internet when
it primarily served as an information repository. Key characteristics of Web1.0 include:
1. One-Way Communication: Web1.0 was mainly a one-way communication platform, where website owners
provided content, and users consumed that content passively.
2. Limited User Interaction: Users had limited ability to interact with websites beyond basic browsing and
clicking on links.
3. Static Websites: Websites in Web1.0 were predominantly static, with fixed content that rarely changed.
Updates required manual editing of HTML code.
4. Lack of Social Interaction: Social networking and user-generated content were virtually non-existent in
Web1.0. Websites focused on delivering information rather than facilitating user collaboration or
participation.
5. Absence of Dynamic Content: Web1.0 lacked dynamic content, personalized experiences, and real-time
updates.
Web2(Read-Write Web)
Web2.0, often referred to as the “Read-Write Web” or the “Social Web,” marks a significant shift in the
internet’s evolution, emphasizing user-generated content and social interaction. Key characteristics of
Web2.0 include:
1. User-Generated Content: Web2.0 platforms empowered users to create, share, and modify
content, resulting in a significant increase in user participation and collaboration.
2. Interactivity and Engagement: Web2.0 enabled dynamic and interactive websites that allowed
users to engage, comment, and interact with both content creators and other users.
3. Social Media and Networking: The rise of social media platforms like Facebook, Twitter, and
YouTube defined Web2.0, enabling users to connect, share, and communicate with each other on a
global scale.
4. Rich Internet Applications (RIAs): Web2.0 introduced the concept of RIAs, leveraging technologies
like AJAX, JavaScript, and Flash to create more responsive and interactive web experiences.
5. Personalization and Customization: Web2.0 platforms offered personalized experiences, allowing
users to customize their profiles, receive tailored content recommendations, and participate in
collaborative filtering.
Web3(Decentralized Web)
Web3.0, also known as the “Decentralized Web” or the “Semantic Web,” represents the next phase of internet
development, focused on decentralization, data ownership, and enhanced user control. Key characteristics of
Web3.0 include:
1. Decentralization and Blockchain Technology: Web3.0 leverages decentralized networks, blockchain
technology, and smart contracts to enable peer-to-peer interactions, secure transactions, and decentralized
applications.
2. User Control and Data Ownership: Web3.0 emphasizes giving users greater control over their data, digital
identities, and online interactions. It aims to shift power away from centralized entities and towards individual
users.
3. Enhanced Privacy and Security: Web3.0 focuses on improving privacy and security by leveraging encryption,
decentralized storage, and privacy-preserving technologies.
4. Interoperability and Seamless Integration: Web3.0 aims to establish interoperability among different
blockchain networks and protocols, enabling seamless communication, data sharing, and value transfer across
platforms.
5. Intelligent Web and AI Integration: Web3.0 envisions integrating artificial intelligence (AI) technologies,
machine learning, and natural language processing to enhance search capabilities, content curation, and user
experiences.
6. Use of token-based economics
7. blockchain technologies
History of Blockchain
The blockchain technology was described in 1991 by the
research scientist Stuart Haber and W. Scott Stornetta.
They wanted to introduce a computationally practical
solution for time-stamping digital documents so that
they could not be backdated or tampered.
They develop a system using the concept of
cryptographically secured chain of blocks to store the
time-stamped documents.
2020: Stablecoins were in demand as they promised more stability than traditional cryptocurrencies.
2022 : Ethereum has shifted from Proof of Work(PoW) to Proof of Stake(PoS) consensus mechanism.
Blockchain types
Public Blockchain Private Blockchain Consortium Blockchain
Accessibility: Public blockchains are Access Control: Private blockchains are Shared Control: Consortium
open to anyone who wants to permissioned, meaning that access to blockchains are semi-
participate, read, or write transactions the network and participation in decentralized networks where
on the network. consensus are restricted to authorized multiple organizations share the
Decentralization: Public blockchains entities. control and governance of the
are highly decentralized, with no Centralization: Private blockchains are blockchain.
single entity controlling the network more centralized compared to public Permissioned Access: Similar to
Transparency and Immutability: blockchains since they are controlled by private blockchains, consortium
Public blockchains offer transparency, a single organization or consortium of blockchains require permissioned
as all transactions are recorded on a organizations. access, participants are vetted
public ledger that is visible to all Privacy: Private blockchains offer and authorized to join the
participants. enhanced privacy, as transactions are network.
EX: Internet computer, Ethereum,... typically visible only to the participating
parties. Ex: R3 Corda
Ex: Hyperledger Fabric
Hybrid Blockchain
Combination of Public and Private Features
EX: Dragonchain
How does blockchain work?
Step 1 –
Step 2 – Step 3
Record the transaction
Gain consensus Link the blocks
A blockchain transaction shows the
Most participants on the distributed Once the participants have reached a
movement of physical or digital assets from
blockchain network must agree that the consensus, transactions on the blockchain are
one party to another in the blockchain
recorded transaction is valid. Depending on written into blocks equivalent to the pages of
network. It is recorded as a data block and
the type of network, rules of agreement can a ledger book. Along with the transactions, a
can include details like these:
vary but are typically established at the start cryptographic hash is also appended to the
Who was involved in the transaction?
of the network. new block. The hash acts as a chain that links
What happened during the transaction?
the blocks together. If the contents of the
When did the transaction occur?
block are intentionally or unintentionally
Where did the transaction occur?
modified, the hash value changes, providing a
Why did the transaction occur?
way to detect data tampering.
How much of the asset was exchanged?
How many pre-conditions were met
during the transaction?
Step 4
Share the ledger
The system distributes the latest copy of the
central ledger to all participants.
How Does Blockchain Work?
Each block contains stored data, as well as its own unique alphanumeric code, called a hash.
These cryptographically generated codes can be thought of as a digital fingerprint.
They play a role in linking blocks together, as new blocks are generated from
the previous block’s hash code, thus creating a chronological sequence, as well as tamper proofing.
blockchains distribute control across a peer-to-peer network made up of interconnected computers, or nodes.
These nodes are in constant communication with one another, keeping the digital ledger up-to-date.
So when a transaction is taking place among two peers, all nodes take part in validating the transaction
using consensus mechanisms.
No blocks can be added to the blockchain until it is verified and has reached consensus. Luckily,
this step has been sped up with the advent of smart contracts, which are self-executing programs
coded into a blockchain that automate the verification process.
Once a transaction is recorded, it’s considered permanent. Blockchains are one-way operations
in that there are no reversible actions. This immutability is part of creating transparency across
the network and a trustworthy record of all activities on the blockchain.
Blockchain Decentralization
One of the most important concepts in blockchain technology is decentralization.
No one computer or organization can own the chain. Instead, it is a distributed ledger via the nodes connected to the chain.
Blockchain nodes can be any kind of electronic device that maintains copies of the chain and keeps the network functioning.
Every node has its own copy of the blockchain and the network must algorithmically approve any newly added block for the chain to
be updated, trusted and verified.
Each participant is given a unique alphanumeric identification number that shows their transactions.
Blockchain Hash Function
A hash function takes an input string (numbers, alphabets, media files) of
any length and transforms it into a fixed length. The fixed bit length can
vary (like 32-bit or 64-bit or 128-bit or 256-bit) depending on the hash
function which is being used. The fixed-length output is called a hash.
This hash is also the cryptographic byproduct of a hash algorithm.
Efficiency: Balancing the need for security and speed, ensuring that
transactions are processed in a timely manner.
Security in Blockchain
Blockchain security is a comprehensive risk management system for a blockchain network. It uses cyber-security frameworks,
assurance services and best practices to reduce risks against attacks and fraud.
Each new block connects to all the blocks before it in a cryptographic chain in such a way that it's nearly impossible to tamper with.
All transactions within the blocks are validated and agreed upon by a consensus mechanism, ensuring that each transaction is true
and correct.
Blockchain technology enables decentralization through the participation of members across a distributed network. There is no
single point of failure and a single user cannot change the record of transactions. However, blockchain technologies differ in some
critical security aspects.
Secure Node Access
Ensuring secure access to blockchain nodes involves several practices:
Authentication: Nodes must authenticate themselves before joining the network. This can be
achieved using digital certificates or other cryptographic means.
Authorization: Different nodes may have different roles (e.g., validator, light node). Ensuring
proper access control policies can prevent unauthorized actions.
Encryption: Secure communication between nodes using TLS/SSL to protect data in transit.
Firewalls and Intrusion Detection Systems (IDS): Implementing network security measures to
protect nodes from unauthorized access and attacks.
Secure Smart Contracts
Smart contracts are self-executing contracts with the terms of the agreement directly
written into code. Ensuring their security involves:
Code Audits: Regular and thorough auditing of smart contract code to identify and
fix vulnerabilities.
Formal Verification: Using mathematical methods to prove the correctness of smart
contracts.
Upgrading: Implementing mechanisms for updating contracts to fix bugs or add
features, while ensuring the new versions are secure.
Testing: Extensive testing, including unit tests, integration tests, and security tests,
to ensure the contract behaves as expected.
Encrypt Data
Encryption protects data from unauthorized access, both in
transit and at rest:
Data Encryption: Using algorithms like AES (Advanced
Encryption Standard) to encrypt data stored on the
blockchain or transmitted between nodes.
Key Management: Securely generating, storing, and
managing cryptographic keys used for encryption and
decryption.
End-to-End Encryption: Ensuring that data remains
encrypted from the sender to the receiver, protecting it
from interception.
DDoS Protection
A distributed denial-of-service (DDoS) attack attempts to take down a website or an online service by flooding it with requests,
depleting its capacity and affecting its ability to respond to valid requests.
Attacking a blockchain network with a DDoS attack is theoretically feasible, though it is more difficult than targeting centralized
systems like websites or servers. Blockchain networks are inherently resistant to such attacks thanks to their decentralization.
A blockchain operates as a decentralized distributed ledger, functioning across an array of nodes, which are responsible for
validating and processing transactions and creating blocks. Unlike traditional systems, there is no central point of control within a
blockchain network. Decentralization makes a blockchain network harder to attack as attackers need to deal with a multitude of
nodes.
A well-known instance of a DDoS attack was one on the Solana blockchain network, which lead to a 17-hour downtime in September
2021. During Grape Protocol’s initial decentralized exchange offering (IDO) on the Solana-based DEX Raydium, bots bombarded the
network with 400,000 transaction loads per second, causing network congestion.
DDoS attacks may target decentralized applications (DApps), which are applications built on top of the blockchain, rather than the
blockchain network itself. Cryptocurrency exchanges, which play a key role in ensuring liquidity in a blockchain-based ecosystem,
frequently fall victim to DDoS attacks, resulting in temporary service outages.
How can DDoS attacks affect blockchain networks?
DDoS attacks can affect blockchain networks via transaction flooding and compromising smart contracts. The objective is to clog
the network with fraudulent transactions, slowing it down and, in worse cases, bringing it to a halt.
Transaction flooding
Malicious actors can intentionally overload a blockchain Smart contracts
network with a voluminous number of transactions, Hackers can identify vulnerable smart contracts in a blockchain
disrupting its normal operations. network and flood them with transaction requests. These
The attackers would stir up a volley of transaction requests, transactions contain fraudulent instructions or excessive
usually using automated scripts or specialized software. computations to exhaust the functionality of the contract and the
These transactions resemble legitimate transactions but are underlying network. The execution of code in the smart contract
designed to squeeze the network. becomes increasingly burdensome, leading to inordinate delays in
The attackers broadcast these transactions to the nodes. To transaction validation.
achieve consensus, the network propagates the As smart contracts are a key part of blockchains, the impact of such
transactions across multiple nodes, which work to process an attack may propagate across the network, affecting other smart
these transactions. However, the sheer volume of incoming contracts and transactions, disrupting critical operations and
transactions overwhelms their processing capacity. The rendering services inaccessible to legitimate users.
network becomes congested and even genuine transactions
get stuck in the backlog. The disruption could affect
businesses, exchanges and other services reliant on the
blockchain network.
Cont’d
Stress testing
Networks and systems should perform stress Redundancy and backup
tests on blockchain protocols at regular Blockchain protocols and DApps need to have redundant
intervals to evaluate their ability to withstand network infrastructure and backups to ensure that the
DDoS attacks. This will facilitate the detection system keeps functioning even when under attack. Nodes
of potential vulnerabilities in time, enabling located across multiple geographical locations can hold out
patching of the network infrastructure and against a DDoS attack that is limited to a specific region.
upgrading of defense mechanisms.
Secure public keys
In blockchain technology, a public key is a cryptographic key that is used to receive funds and verify digital signatures. It is part of a
key pair, which includes a private key.
This key is shared openly and used by others to encrypt information or verify a digital signature.
On a blockchain, a public key is a hashed version of a cryptocurrency's private key. Blockchains use public keys in different ways, but
generally, they are digital signatures used to provide proof of ownership and create a public address.
How Public Keys Are Used in Blockchain
A public key is a cryptographic code used to create a Wallet Addresses: When you create a blockchain wallet, it
blockchain address. generates a pair of keys. The public key (or an address derived
When a transaction is received, users are issued a from it) is what you share to receive funds.
private key, which is used to generate the public key. Transaction Security: To send a transaction, you sign it with your
The private key is made available only to its user and private key. The network uses your public key to verify the
authorizes the user to facilitate transactions from their signature, ensuring the transaction is authentic.
account. Smart Contracts: In platforms like Ethereum, public keys are
The public key is used as a digital signature, which used to deploy and interact with smart contracts. Each contract
proves ownership of the private key and creates interaction is verified using the sender's public key.
cryptocurrency public addresses.
Secure Private Keys
In blockchain technology, a private key is a crucial cryptographic key used to secure and manage digital assets, authenticate transactions, and maintain the
integrity of communications. It is an essential component of public key cryptography, where it works alongside a corresponding public key.
A private key is an alphanumeric code generated by a cryptocurrency wallet. It is used to authorize transactions and prove ownership of a blockchain asset.
A private key is an integral part of cryptocurrency, and its encrypted properties help protect users from thieves and unauthorized access to their funds.
A cryptocurrency private key is a randomly generated number usually converted to 64-digit hexadecimal format.
Private keys represent control and ownership of cryptocurrency.
If your keys are stolen or lost, your crypto is gone.
Private keys can take several different forms. Cryptocurrency private keys There are several ways private keys can
are randomly generated numbers that can be one of 2256 possibilities. be stored. They can be written or typed
Generally, they are 256 digits long, but for simplicity, private keys are on paper—these are called paper wallets.
usually expressed in hexadecimal form. You can also use software that generates
QR codes to print on paper so they can
easily be scanned when a transaction
needs to be signed.
Digital signatures
Digital signatures provide a way to verify the authenticity and integrity of a message or transaction
Creation: Using a private key to create a signature for a message or transaction, which can be verified by anyone with
the corresponding public key.
Verification: Ensuring that the message or transaction has not been tampered with and that it comes from the
expected sender.
Applications: Used in blockchain for signing transactions, ensuring that only the rightful owner of a private key can
authorize spending of cryptocurrency.
Characteristics of Blockchain
Security
Data immutability Decentralized
Once data is recorded on the blockchain, it In a decentralized blockchain, there is no Blockchain relies on consensus mechanisms to
cannot be altered or deleted. Each block central authority or single point of agree on the validity of transactions and to add
contains a hash of the previous block, control. Instead, the network is new blocks to the chain. Common mechanisms
linking them together in a secure chain. maintained by a distributed group of include Proof of Work (PoW), Proof of Stake (PoS),
Benefit: This ensures the integrity and nodes (computers). and others.
authenticity of the data, making it tamper- Benefit: This reduces the risk of Benefit: Consensus mechanisms ensure that all
proof and trustworthy. centralized failures or attacks and participants agree on the state of the blockchain,
enhances the resilience and reliability of maintaining its integrity and consistency.
Transparency the system.
Tokenization
All transactions on a public blockchain are
visible to all participants. Each node has a Consensus algorithm Blockchain can represent real-world assets as
Blockchain relies on consensus digital tokens, enabling fractional ownership and
copy of the entire blockchain, ensuring that
mechanisms to agree on the validity of easier transfer of assets.
everyone can verify the data.
transactions and to add new blocks to Benefit: This opens up new opportunities for
Benefit: This enhances trust and
the chain. Common mechanisms investment, liquidity, and democratization of asset
accountability, as participants can
include Proof of Work (PoW), Proof of ownership.
independently verify transactions and data.
Stake (PoS), and others.
Traceability Benefit: Consensus mechanisms Programmability
Blockchain provides a complete and immutable ensure that all participants agree on Blockchains support smart contracts, which are
record of all transactions. This traceability is crucial the state of the blockchain, self-executing contracts with the terms directly
for applications such as supply chain management, maintaining its integrity and written into code.
where the origin and journey of products need to be consistency. Benefit: This enables automation of complex
tracked. processes, enforceability of agreements, and the
Benefit: This enhances accountability, enables creation of decentralized applications (dApps).
efficient auditing, and helps in compliance with
regulations.
Uses Of Blockchain
network security
smart contracts
financial services
video games
healthcare
supply chain management
Identity Management
Real estate transaction
etc,,,,