A comprehensive Python-based blockchain project for secure, tamper-proof academic certificate management using Proof-of-Authority consensus.
- Custom Proof-of-Authority (PoA) Consensus: Only authorized institutions can validate transactions
- Block Structure: Index, timestamp, certificate data, previous hash, and validator
- Genesis Block Creation: Automatic initialization of the blockchain
- Chain Validation: Complete blockchain integrity verification
- SQLite Persistence: Reliable data storage with database backup
- Digital Certificate Issuance: Universities can issue signed certificates
- RSA Digital Signatures: 2048-bit RSA encryption for certificate authenticity
- Certificate Verification: Hash-based lookup for instant verification
- Certificate Revocation: Tamper-proof revocation system with reasons
- Privacy Protection: Optional PII encryption and hash-only verification
- University Admins: Issue, verify, and revoke certificates (authenticated)
- Students: View and share their certificates securely
- Employers/Third Parties: Verify certificate authenticity instantly
- System Admin: Manage university registrations and system settings
- RSA Key Management: Secure wallet system for each user
- Digital Signatures: Non-repudiation through cryptographic signatures
- Hash-based Verification: Verify authenticity without exposing data
- Authority-based Access: Only authorized institutions can issue certificates
- Flask REST API: Complete API for all blockchain operations
- Responsive Frontend: Modern web interface for easy interaction
- QR Code Generation: Quick certificate sharing and verification
- Real-time Stats: Live blockchain statistics and monitoring
- Python 3.7 or higher
- pip package manager
-
Clone or download the project files
-
Install dependencies:
pip install -r requirements.txt
-
Run the application:
python app.py
-
Open your browser and navigate to:
http://localhost:5000
academic-blockchain/
βββ blockchain.py # Core blockchain implementation
βββ wallet.py # RSA wallet and digital signature system
βββ certificate_issuer.py # Certificate issuance and management logic
βββ app.py # Flask web application and API
βββ requirements.txt # Python dependencies
βββ README.md # This documentation
βββ academic_blockchain.db # SQLite database (auto-generated)
βββ wallets/ # Wallet storage directory (auto-generated)
βββ [wallet_id]/
βββ private_key.pem
βββ public_key.pem
βββ wallet_data.json
curl -X POST http://localhost:5000/api/institutions/register \
-H "Content-Type: application/json" \
-d '{
"institution_name": "Massachusetts Institute of Technology",
"authority_id": "mit"
}'curl -X POST http://localhost:5000/api/certificates/issue \
-H "Content-Type: application/json" \
-d '{
"authority_id": "mit",
"student_name": "Alice Johnson",
"student_id": "MIT2024001",
"degree": "Bachelor of Computer Science",
"institution": "Massachusetts Institute of Technology",
"issue_date": "2024-06-15",
"grade": "Magna Cum Laude"
}'curl http://localhost:5000/api/certificates/verify/[CERTIFICATE_HASH]curl "http://localhost:5000/api/certificates/search?student_name=Alice Johnson"GET /api/blockchain/info- Get blockchain statisticsGET /api/blockchain/export- Export blockchain data
POST /api/institutions/register- Register new institutionGET /api/institutions/list- List all institutionsGET /api/institutions/{id}/statistics- Get institution stats
POST /api/certificates/issue- Issue new certificateGET /api/certificates/verify/{hash}- Verify certificateGET /api/certificates/search- Search certificatesPOST /api/certificates/revoke- Revoke certificate
GET /api/wallets/list- List all wallets
- Consensus Algorithm: Proof-of-Authority (PoA)
- Block Time: Variable (on-demand mining)
- Data Structure: JSON-based block storage
- Persistence: SQLite database with JSON columns
- Digital Signatures: RSA-PSS with SHA-256
- Key Size: 2048-bit RSA keys
- Hashing: SHA-256 for certificate hashes
- Signature Padding: PSS with MGF1
- Backend: Flask 2.3.3 with CORS support
- Frontend: Vanilla JavaScript with modern CSS
- Database: SQLite 3 with JSON1 extension
- QR Codes: qrcode library with PIL
The application comes with pre-registered sample institutions:
- MIT (Authority ID:
mit) - Stanford University (Authority ID:
stanford) - Harvard University (Authority ID:
harvard)
You can immediately start issuing certificates using these institutions.
- RSA-2048 Digital Signatures: Industry-standard encryption
- SHA-256 Hashing: Collision-resistant hash function
- PSS Padding: Probabilistic signature scheme for enhanced security
- Non-repudiation: Cryptographic proof of certificate authenticity
- Immutable Records: Tamper-proof certificate storage
- Authority Verification: Only registered institutions can issue
- Chain Validation: Complete blockchain integrity checks
- Revocation Tracking: Transparent certificate invalidation
- Hash-based Verification: Verify without exposing personal data
- Optional PII Encryption: Protect sensitive student information
- Role-based Access: Different permissions for different user types
- Automatic QR code generation for certificates
- Instant verification through QR scanning
- Mobile-friendly verification interface
- Live blockchain statistics
- Certificate issuance tracking
- Institution activity monitoring
- JSON export of complete blockchain
- Certificate batch export for institutions
- Audit trail generation
The modular architecture makes it easy to extend:
- New Consensus Mechanisms: Modify
blockchain.py - Additional Cryptography: Extend
wallet.py - Custom Certificate Types: Update
certificate_issuer.py - New API Endpoints: Add routes to
app.py
The system uses SQLite with three main tables:
blocks: Blockchain block storagecertificates: Certificate lookup indexauthorities: Institution registry
Key configuration options in app.py:
- Database path
- Flask secret key
- CORS settings
- Default key sizes
Complete REST API enables integration with:
- Mobile applications
- External verification systems
- University information systems
- Employment platforms
Mobile-friendly QR codes allow:
- Instant certificate verification
- Offline certificate sharing
- Easy integration with mobile apps
- Docker containerization for easy deployment
- IPFS integration for distributed certificate storage
- Zero-knowledge proofs for privacy-preserving verification
- Multi-signature support for institutional oversight
- Batch certificate processing for graduation ceremonies
- Certificate templates with custom fields
- Email notifications for certificate events
- Audit logging with compliance reports
- Layer 2 solutions for high-throughput scenarios
- Database sharding for large-scale deployments
- Caching layers for improved performance
- Load balancing for production environments
We welcome contributions! Areas where you can help:
- Additional consensus mechanisms
- Enhanced privacy features
- Mobile application development
- Performance optimizations
- Security audits
- Documentation improvements
- This is a demo/educational implementation
- In production, use proper key management (HSM, key escrow)
- Implement proper authentication and authorization
- Use HTTPS for all communications
- Regular security audits recommended
For production use:
- Enable key encryption with strong passwords
- Use environment variables for secrets
- Implement proper logging and monitoring
- Set up regular database backups
- Use production-grade web server (Gunicorn, uWSGI)
This project is provided as an educational example. Use responsibly and ensure proper security measures for production deployments.
For questions, issues, or contributions:
- Check the API documentation in the code
- Review the demo functions in each module
- Test with the provided sample data
- Ensure all dependencies are properly installed
Built with β€οΈ using Python, Flask, and Blockchain Technology
Securing Academic Integrity through Decentralized Verification