Skip to content

swoet/py-blockchain-tutorial

Repository files navigation

πŸ”— Python Blockchain Tutorial

    ╔═══════════════════════════════════════════════════════════╗
    β•‘                                                           β•‘
    β•‘     β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—      β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—  β–ˆβ–ˆβ•—           β•‘
    β•‘     β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•           β•‘
    β•‘     β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•            β•‘
    β•‘     β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•—            β•‘
    β•‘     β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•—           β•‘
    β•‘     β•šβ•β•β•β•β•β• β•šβ•β•β•β•β•β•β• β•šβ•β•β•β•β•β•  β•šβ•β•β•β•β•β•β•šβ•β•  β•šβ•β•           β•‘
    β•‘                                                           β•‘
    β•‘        β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—  β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ•—   β–ˆβ–ˆβ•—             β•‘
    β•‘       β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ•‘             β•‘
    β•‘       β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘             β•‘
    β•‘       β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘             β•‘
    β•‘       β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘             β•‘
    β•‘        β•šβ•β•β•β•β•β•β•šβ•β•  β•šβ•β•β•šβ•β•  β•šβ•β•β•šβ•β•β•šβ•β•  β•šβ•β•β•β•             β•‘
    β•‘                                                           β•‘
    β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

A production-ready FastAPI blockchain with PoW, Consensus, and Multi-Node Docker

Python FastAPI Docker Tests Type Checked


🎯 Overview

A lightweight, educational blockchain framework built with FastAPI, featuring:

  • ⛏️ Proof-of-Work mining with adjustable difficulty
  • πŸ”— SHA-256 cryptographic block hashing
  • 🌐 Multi-node peer-to-peer consensus
  • πŸ“‘ RESTful + OpenAPI with auto-generated docs
  • 🎨 Real-time HTMX/Tailwind UI dashboard
  • 🐳 Multi-node Docker orchestration
  • βœ… Full Pydantic validation and type safety

Perfect for learning how blockchains work under the hood or as a foundation for custom distributed ledger experiments.


πŸ—οΈ 3D Architecture

                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚         FastAPI Application              β”‚
                    β”‚    (Uvicorn ASGI Server - Port 5000)     β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                   β”‚
                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                  β”‚                β”‚                β”‚
                  β–Ό                β–Ό                β–Ό
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚   UI Routes     β”‚ β”‚ API Routesβ”‚ β”‚ Legacy Routes   β”‚
        β”‚ (HTMX/Jinja2)   β”‚ β”‚ (/api/*)  β”‚ β”‚ (/mine, /chain) β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                 β”‚                 β”‚                 β”‚
                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                   β”‚
                        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                        β”‚   Blockchain Core   β”‚
                        β”‚  (In-Memory State)  β”‚
                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                   β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚                    β”‚                    β”‚
              β–Ό                    β–Ό                    β–Ό
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚   Block Chain   β”‚  β”‚    Mempool      β”‚  β”‚  Peer Nodes    β”‚
    β”‚ [Blockβ‚€, B₁...] β”‚  β”‚ [Pending Txs]   β”‚  β”‚ {node1, node2} β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β”‚                    β”‚                    β”‚
              β”‚                    β”‚                    β”‚
              β–Ό                    β–Ό                    β–Ό
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚   PoW Mining    β”‚  β”‚  Tx Validation  β”‚  β”‚   Consensus    β”‚
    β”‚ (SHA-256 hash)  β”‚  β”‚ (Pydantic)      β”‚  β”‚ (Longest chain)β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Multi-Node Network Topology

         Internet/Host Machine (localhost)
                    β”‚
     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
     β”‚              β”‚              β”‚
Port 5000      Port 5001      Port 5002
     β”‚              β”‚              β”‚
     β–Ό              β–Ό              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Node 1  │◄──►│ Node 2  │◄──►│ Node 3  β”‚
β”‚ (node1) β”‚    β”‚ (node2) β”‚    β”‚ (node3) β”‚
β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜
     β”‚              β”‚              β”‚
     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    β”‚
            Docker Bridge Network
             (blockchain-net)
                    β”‚
         Auto-registration via PEERS env

πŸ“¦ Project Structure

py-blockchain-tutorial/
β”‚
β”œβ”€β”€ πŸ“ app/                      # Core application package
β”‚   β”œβ”€β”€ __init__.py              # Flask legacy factory (deprecated)
β”‚   β”œβ”€β”€ api.py                   # πŸš€ FastAPI app + all endpoints
β”‚   β”œβ”€β”€ blockchain.py            # ⛓️  Blockchain logic (PoW, consensus)
β”‚   β”œβ”€β”€ models.py                # πŸ“‹ Pydantic schemas for validation
β”‚   β”œβ”€β”€ main.py                  # 🎬 Uvicorn entrypoint
β”‚   └── routes.py                # (deprecated, migrated to api.py)
β”‚
β”œβ”€β”€ πŸ“ templates/                # Jinja2 HTML templates
β”‚   β”œβ”€β”€ index.html               # 🎨 Main dashboard (HTMX + Tailwind)
β”‚   └── _status.html             # πŸ“Š Live status partial
β”‚
β”œβ”€β”€ πŸ“ tests/                    # Pytest test suite
β”‚   β”œβ”€β”€ test_app.py              # βœ… API & integration tests
β”‚   └── requirements.txt         # Test dependencies
β”‚
β”œβ”€β”€ πŸ“ .github/workflows/        # CI/CD pipelines
β”‚   └── ci.yml                   # GitHub Actions: lintβ†’testβ†’audit
β”‚
β”œβ”€β”€ 🐳 Dockerfile                # Production container image
β”œβ”€β”€ 🐳 docker-compose.yml        # Multi-node orchestration
β”œβ”€β”€ βš™οΈ  pyproject.toml            # Project metadata + tool configs
β”œβ”€β”€ πŸ”§ .pre-commit-config.yaml   # Git hooks for quality checks
β”œβ”€β”€ πŸ“„ requirements.txt          # Legacy root deps (use pyproject.toml)
└── πŸ“– README.md                 # This file

πŸš€ Quick Start

1️⃣ Local Development (Single Node)

# Install dependencies
pip install -e .[dev]

# Run the server
python -m app.main

# Open in browser
# UI:       http://127.0.0.1:5000
# API docs: http://127.0.0.1:5000/docs
# ReDoc:    http://127.0.0.1:5000/redoc

2️⃣ Multi-Node Demo (Docker)

# Spin up 3 interconnected nodes
docker compose up --build -d

# Access nodes
# Node 1: http://127.0.0.1:5000
# Node 2: http://127.0.0.1:5001
# Node 3: http://127.0.0.1:5002

# Example: Mine a block on node 1
curl http://localhost:5000/mine

# View the chain
curl http://localhost:5000/chain | jq

# Trigger consensus on node 2 (sync from peers)
curl http://localhost:5001/nodes/resolve | jq

# Stop nodes
docker compose down

🎨 UI Dashboard

The live dashboard (powered by HTMX + Tailwind) provides real-time updates, interactive buttons, and toast notifications:

UI Screenshot

Features:

  • πŸ“Š Live status cards (height, difficulty, mempool, last block hash)
  • βž• Add Tx button (green) - adds test transactions to mempool
  • ⛏️ Mine Block button (blue) - mines pending transactions
  • πŸ“¦ Recent blocks viewer with auto-refresh
  • πŸ“ Mempool viewer showing pending transactions
  • πŸ”” Toast notifications for success/error feedback
  • πŸ”„ Auto-refresh every 2-5 seconds

πŸ“‘ API Endpoints

Modern API (/api/*)

Method Endpoint Description
GET /api/status Chain status + metrics
GET /api/blocks Recent blocks (paginated)
GET /api/mempool Pending transactions
POST /api/tx Submit a transaction
POST /api/mine Mine pending txs into a block

Legacy Endpoints (Tutorial Compatible)

Method Endpoint Description
GET /mine Mine block with reward tx
POST /transactions/new Add transaction (validated)
GET /chain Full chain + length
POST /nodes/register Register peer nodes
GET /nodes/resolve Consensus (longest chain wins)

Interactive Docs


πŸ”¬ Example Usage

Mining Workflow

# 1. Add transactions to mempool
curl -X POST http://127.0.0.1:5000/api/tx \
  -H "Content-Type: application/json" \
  -d '{"from": "alice", "to": "bob", "amount": 10}'

curl -X POST http://127.0.0.1:5000/api/tx \
  -H "Content-Type: application/json" \
  -d '{"from": "charlie", "to": "dave", "amount": 5}'

# 2. Check mempool
curl http://127.0.0.1:5000/api/mempool | jq

# 3. Mine a block
curl -X POST http://127.0.0.1:5000/api/mine | jq

# 4. Verify chain
curl http://127.0.0.1:5000/chain | jq '.chain[-1]'

Multi-Node Consensus

# Node 1: Mine several blocks
for i in {1..3}; do
  curl -X POST http://127.0.0.1:5000/api/tx \
    -H "Content-Type: application/json" \
    -d "{\"from\":\"miner\",\"to\":\"user$i\",\"amount\":1}"
  curl http://127.0.0.1:5000/mine
done

# Node 2: Check initial state
curl http://127.0.0.1:5001/chain | jq '.length'
# Output: 1 (genesis only)

# Node 2: Resolve conflicts (sync from node 1)
curl http://127.0.0.1:5001/nodes/resolve | jq

# Node 2: Verify sync
curl http://127.0.0.1:5001/chain | jq '.length'
# Output: 4 (genesis + 3 mined blocks)

πŸ§ͺ Testing

# Run all tests
pytest

# With coverage
pytest --cov=app

# Type check
mypy app

# Lint & format
ruff check --fix .
ruff format .
black .
isort .

# Security audit
pip-audit

Test Coverage:

  • βœ… Status endpoint
  • βœ… Transaction submission + mining flow
  • βœ… Legacy /mine endpoint
  • βœ… Transaction validation (Pydantic)
  • βœ… Chain retrieval
  • βœ… Node registration
  • βœ… Consensus resolution

πŸ› οΈ Technology Stack

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Layer          β”‚  Technology                           β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Web Framework  β”‚  FastAPI 0.121+ (ASGI)                β”‚
β”‚  Server         β”‚  Uvicorn (asyncio event loop)         β”‚
β”‚  Validation     β”‚  Pydantic 2.12+                       β”‚
β”‚  Templates      β”‚  Jinja2 3.1+                          β”‚
β”‚  Frontend       β”‚  HTMX 1.9 + Tailwind CSS (CDN)        β”‚
β”‚  Testing        β”‚  Pytest 9.0+, Hypothesis 6.147+       β”‚
β”‚  Type Checking  β”‚  Mypy 1.18+ (strict mode)             β”‚
β”‚  Linting        β”‚  Ruff 0.14+, Black, Isort             β”‚
β”‚  Security       β”‚  Bandit, pip-audit                    β”‚
β”‚  Containerizationβ”‚ Docker + Docker Compose              β”‚
β”‚  CI/CD          β”‚  GitHub Actions                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ” Security Features

  • πŸ”’ SHA-256 hashing for block integrity
  • βœ… Pydantic validation for all inputs
  • πŸ›‘οΈ Request size limits (FastAPI defaults)
  • πŸ” Dependency auditing via pip-audit
  • πŸ” No secrets in code (env var best practices)
  • πŸ“Š Type safety with mypy strict mode

πŸ“Š Block Structure

Block {
    index: int              # Sequential block number
    timestamp: float        # Unix timestamp
    previous_hash: str      # SHA-256 of previous block
    nonce: int              # Proof-of-Work solution
    transactions: [...]     # List of transactions
    hash: str               # SHA-256 of this block
}

Visual Block Chain

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Block 0   β”‚    β”‚   Block 1   β”‚    β”‚   Block 2   β”‚
β”‚  (Genesis)  │◄───│             │◄───│             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€    β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€    β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ idx: 0      β”‚    β”‚ idx: 1      β”‚    β”‚ idx: 2      β”‚
β”‚ prev: 000...β”‚    β”‚ prev: abc...β”‚    β”‚ prev: def...β”‚
β”‚ nonce: 0    β”‚    β”‚ nonce: 1234 β”‚    β”‚ nonce: 5678 β”‚
β”‚ txs: [gen]  β”‚    β”‚ txs: [tx1]  β”‚    β”‚ txs: [tx2]  β”‚
β”‚ hash: abc...β”‚    β”‚ hash: def...β”‚    β”‚ hash: ghi...β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

βš™οΈ Configuration

Environment Variables

Variable Description Default
PORT Server port 5000
NODE_ID Unique identifier for this node Random UUID
PEERS Comma-separated peer addresses (empty)

Docker Compose

Nodes auto-register peers via PEERS env:

node1:
  environment:
    - NODE_ID=node1
    - PEERS=blockchain-node2:8000,blockchain-node3:8000

πŸŽ“ Learning Path

Beginner

  1. βœ… Run locally and explore the UI
  2. βœ… Submit transactions via /api/tx
  3. βœ… Mine blocks with /api/mine
  4. βœ… Inspect chain structure at /chain

Intermediate

  1. βœ… Study blockchain.py PoW algorithm
  2. βœ… Add custom transaction fields
  3. βœ… Modify mining difficulty
  4. βœ… Run multi-node Docker setup

Advanced

  1. βœ… Implement Merkle tree for transactions
  2. βœ… Add ECDSA signatures (secp256k1)
  3. βœ… Persistent storage (SQLite/LevelDB)
  4. βœ… WebSocket live updates
  5. βœ… UTXO model with double-spend prevention

🀝 Contributing

Contributions welcome! Please:

  1. Fork the repo
  2. Create a feature branch
  3. Run tests + linting: pytest && mypy app && ruff check .
  4. Submit a PR

πŸ“ License

MIT License - feel free to use for learning or commercial projects.


πŸ™ Acknowledgments

  • Original tutorial inspired by classic blockchain educational resources
  • Built with modern Python best practices (2025)
  • Community feedback and contributions

⭐ Star this repo if you found it helpful!

Made with ❀️ for the blockchain learning community

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published