How daxeel/blockshell works
Project type and purpose
• BlockShell is a Python-based educational tool combining a command-line interface (CLI) and a lightweight web explorer. Its core purpose is to let users interactively learn blockchain fundamentals (block creation, chaining, hashing, mining, proof of work).
File structure
• Top-level:
• bscli.py – entry point for the CLI
• web.py – entry point for the web explorer
• setup.py, .gitignore, LICENSE, docs files – build and project metadata
• _config.yml – configuration (likely for documentation or GitHub Pages)
• Package “blockchain/”:
• chain.py – implements the Block and Blockchain logic
• templates/:
• HTML templates (blockdata.html, blocks.html, guide.html) used by web.py
README insights
• No external database—blockchain state is managed in memory or local files by the core library.
• Uses standard Python packages (templating engine, HTTP server) injected by setup.py dependencies.
a. Main Components
• User Interfaces
– CLI Application (bscli.py)
– Web Explorer (web.py + templates + HTTP server)
• Core Business Logic
– Blockchain module (blockchain/chain.py)
• Data Store
– In-memory or flat-file persistence managed by chain.py
• External Dependencies
– Python runtime, virtualenv/pip, templating engine (e.g., Jinja2), HTTP framework (Flask or built-in)
b. Relationships & Interactions
• CLI → Core: invokes create-block, mine, inspect commands in the blockchain module
• Web Explorer → Core: on HTTP requests, reads chain state, renders via HTML templates
• Core → Data Store: reads/writes block list to memory or disk
c. Architectural Patterns & Principles
• Monolithic modular design: distinct “presentation” (CLI & web) and “domain” (blockchain core) layers
• Separation of concerns: UI layers never implement block logic—they defer to chain.py
• Lightweight server: embedded web server with templating, no heavy frameworks or microservices
d. Key Technologies & Frameworks
• Python 2.7+ with virtualenv
• Setup via setuptools (setup.py) for CLI entry point (“blockshell”) and web entry point (“blockshell-web” or similar)
• Template engine (Jinja2) for HTML views
• HTTP server (Flask or Bottle) for the explorer