| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A simple blockchain implementation built in Python, demonstrating the core concepts behind distributed ledger technology, block creation, SHA-256 hashing, chain linking, and tamper detection.
Each block in the chain contains:
Because each block's hash depends on the previous block's hash, any modification to a block invalidates every block that follows it. The validate() method detects this by recalculating and comparing hashes across the entire chain.
BlockChain/ ├── block.py # Defines the Block class and SHA-256 hashing logic ├── blockchain.py # Defines the Blockchain class — manages blocks and validation ├── transaction.py # Defines the Transaction class (sender, receiver, amount) └── main.py # Demo script — builds a chain, adds transactions, simulates tampering
Requirements: Python 3.x (no external dependencies)
Run the demo:
python main.pyThis will:
Index: 0, Timestamp: ..., Transaction: 0,0,0, Previous hash: 0, Block hash value: ... Transaction: 12345,23456,100 ... The ledger is authentic Transaction 1 is being modified... Validation error at block 1
Planned improvements:
This project is provided for educational purposes only as part of the course 26W-CST8400 - Analysis and Design Using Emerging Technologies at Algonquin College, Ottawa, ON, Canada.
| Back | FazBrowse Home | New Git URL |