Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blockchain in Theory and Practice

A Student's Guide to Distributed Ledgers

A 20-chapter course on blockchain technology, written as runnable Jupyter notebooks. Each chapter pairs a short explanation with hands-on Python examples — tampering with a naive ledger, building chained hashes, simulating consensus, scoring use cases, and more. Examples use the Python standard library almost exclusively and seed their random number generators, so every run is reproducible.

Link to Amazon: Blockchain in Theory and Practice: A Student's Guide to Distributed Ledgers

Each chapter is available in two formats:

  • ipynb/ — interactive Jupyter notebooks (run and modify the examples yourself)
  • pdf/ — pre-rendered PDFs for reading offline or printing

Table of Contents

# Chapter Notebook PDF
1 Blockchain and the Derivatives Market: An Introduction ipynb pdf
2 A Short History of Blockchain ipynb pdf
3 Types of Blockchain: Public, Private, Permissioned, and Consortium ipynb pdf
4 Transactions, Blocks, and the Chain Data Structure ipynb pdf
5 Cryptographic Foundations: Hashing, Signatures, and Wallets ipynb pdf
6 Consensus I: Byzantine Generals, Proof-of-Work, and Proof-of-Stake ipynb pdf
7 Consensus II: BFT Families, Raft, and Proof-of-Authority ipynb pdf
8 Performance and Scalability: Transactions per Second ipynb pdf
9 Smart Contracts, Peer-to-Peer Networks, and Hash Maps ipynb pdf
10 Reference Architecture: Inside Hyperledger Fabric ipynb pdf
11 Use Cases I: Cross-Border Data Clearance and the Coin-Based Exchange ipynb pdf
12 Use Cases II: Digital-Asset Custody and Immutable Metadata Storage ipynb pdf
13 The Landscape Since 2023: A 2026 Update ipynb pdf
14 Real-World Asset Tokenisation ipynb pdf
15 Stablecoins: Design, Reserves, and Risk ipynb pdf
16 Stablecoins, Money, and the Economy ipynb pdf
17 Central Bank Digital Currencies ipynb pdf
18 Decentralised Finance (DeFi) ipynb pdf
19 Oracles, Interoperability, and Cross-Chain Infrastructure ipynb pdf
20 Security, Risk, and Assurance in Tokenised Finance ipynb pdf

Getting Started

Requires Python 3.10 or newer.

# 1. Create and activate a virtual environment
python3 -m venv .venv
source .venv/bin/activate        # Windows: .venv\Scripts\activate

# 2. Install dependencies
pip install -r requirements.txt

# 3. Launch Jupyter and open any chapter
jupyter notebook ipynb/

The examples rely on the Python standard library, with one exception: chapter 5 uses the ecdsa package for elliptic-curve signatures (installed via requirements.txt). Run the cells in each notebook in order; they are designed to be modified and re-run.

Building the PDFs

The PDFs in pdf/ are generated from the notebooks with nbconvert, which requires two system tools in addition to the Python dependencies:

  • Pandoc
  • A LaTeX distribution with XeLaTeX (e.g. texlive-xetex and texlive-fonts-recommended on Debian/Ubuntu)

On Debian/Ubuntu:

sudo apt install pandoc texlive-xetex texlive-fonts-recommended

Then rebuild any chapter (or all of them):

jupyter nbconvert --to pdf ipynb/chapter01.ipynb --output-dir pdf/

Repository Layout

ipynb/            # 20 chapter notebooks (the source of truth)
pdf/              # pre-rendered PDF of each chapter
requirements.txt  # Python dependencies

About

TextBook: Blockchain in Theory and Practice: A Student's Guide to Distributed Ledgers

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages