A Streamlit-based educational blockchain implementation demonstrating core concepts including block structure, Merkle trees, and state transitions.
- Block Traversal: View and edit blocks to demonstrate immutability
- Merkle Tree Visualization: Interactive visualization of transaction verification
- Turing System: State-based computation demonstration
- Transaction Management: Create and manage transactions and blocks
MathChain/
├── src/
│ ├── __init__.py
│ ├── core/
│ │ ├── __init__.py
│ │ ├── transaction.py
│ │ ├── block.py
│ │ └── blockchain.py
│ ├── utils/
│ │ ├── __init__.py
│ │ └── merkle_tree.py
│ └── ui/
│ ├── __init__.py
│ ├── block_traversal.py
│ ├── merkle_visualization.py
│ └── turing_system.py
├── app.py
├── requirements.txt
└── README.md
- Clone the repository:
git clone https://github.com/cherry-aggarwal/MathChain.git
cd MathChain- Install dependencies:
pip install -r requirements.txtRun the application:
streamlit run app.pyThe application will open in your browser at http://localhost:8501
- Transaction: Represents a transfer between two parties
- Block: Contains multiple transactions and links to previous block
- Blockchain: Manages the chain of blocks and validates integrity
- Merkle Tree: Computes Merkle roots and generates visualization data
- Block Traversal: Allows viewing and editing blocks to demonstrate how changes break the chain
- Merkle Visualization: Shows how transactions are verified using Merkle trees
- Turing System: Demonstrates state transitions and account balances
- Immutability: Editing a transaction breaks the chain by invalidating hashes
- Merkle Trees: Efficient transaction verification
- State Transitions: Deterministic computation of account balances
- Hash Linking: Each block references the previous block's hash
The codebase follows clean architecture principles:
- Separation of Concerns: Core logic separated from UI
- Modularity: Each component has a single responsibility
- Type Hints: All functions include type annotations
- Documentation: Comprehensive docstrings
MIT License