Blockendance is a complete blockchain implementation built from scratch in Python, demonstrating core blockchain concepts through a practical attendance management system. This project showcases how to build a functional blockchain without relying on existing blockchain frameworks.
- Pure Python Implementation: Every component built from scratch
- Complete Blockchain Architecture: Genesis block, block creation, chain validation
- Cryptographic Security: SHA-256 hashing and block linking
- Real-world Application: Practical attendance management use case
- Educational Value: Perfect for understanding blockchain fundamentals
class Block:
- index: Block position in chain
- timestamp: Block creation time
- data: Attendance records (JSON)
- prev_hash: Previous block's hash
- hash: Current block's SHA-256 hash
- First block in the chain (index 0)
- No previous hash reference
- Initializes the blockchain
- Cryptographic hash verification
- Block linkage integrity
- Tamper detection algorithms
- Once written, data cannot be modified
- Any tampering breaks the chain
- Cryptographic proof of integrity
Blockendance/
βββ block.py # Block class with hashing and validation
βββ genesis.py # Genesis block creation
βββ newBlock.py # New block creation and addition
βββ getBlock.py # Block retrieval and search
βββ checkChain.py # Blockchain integrity verification
βββ blockchain.py # Main Flask application
βββ templates/ # Web interface templates
- SHA-256 Hashing: Each block secured with cryptographic hash
- Chain Linking: Blocks linked via previous block hashes
- Tamper Detection: Any modification breaks the chain
- Data Integrity: Immutable record storage
- Block Creation: Automated block generation with proper indexing
- Chain Validation: Complete integrity checking algorithms
- Data Retrieval: Efficient search through blockchain
- Statistics: Real-time blockchain analytics
- Responsive Design: Modern Material Design UI
- Form Validation: Client and server-side validation
- Real-time Feedback: Live attendance counting
- Error Handling: Comprehensive error management
- Python 3.6 or higher
- pip package manager
- Clone the repository
git clone https://github.com/adeen-s/Blockendance.git
cd Blockendance
- Install dependencies
pip install Flask
- Run the application
python blockchain.py
- Access the application
Open your browser and navigate to
http://localhost:5001
def create_genesis_block():
genesis_data = {
"type": "genesis",
"message": "Genesis Block - Blockchain Initialized",
"creator": "Blockendance System"
}
return Block(0, datetime.now(), genesis_data, "0")
def next_block(last_block, data):
this_index = last_block.index + 1
this_timestamp = datetime.now()
this_data = copy.deepcopy(data)
this_prev_hash = last_block.hash
return Block(this_index, this_timestamp, this_data, this_prev_hash)
def check_integrity(chain):
for i, block in enumerate(chain):
if not block.is_valid():
return f"Error: Block #{i} has invalid hash"
if i > 0 and block.prev_hash != chain[i-1].hash:
return f"Error: Block #{i} not properly linked"
return "Blockchain integrity verified"
This project demonstrates:
- Blockchain Fundamentals: Core concepts without complexity
- Cryptographic Hashing: SHA-256 implementation
- Data Structures: Linked list of blocks
- Web Development: Flask framework integration
- Security Principles: Immutability and integrity
- Educational: Learn blockchain development
- Proof of Concept: Demonstrate blockchain applications
- Research: Study blockchain behavior
- Development: Base for larger blockchain projects
- Educational Purpose: This is a simplified blockchain for learning
- No Consensus: Single-node implementation (no mining/proof-of-work)
- Centralized: Runs on single Flask server
- No Persistence: Data lost on restart (can be extended)
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
Adeen Shukla - Initial work - GitHub
Built with β€οΈ to demonstrate blockchain technology from scratch