A fully functional blockchain cryptocurrency system built with Python and Flask, featuring proof-of-work consensus, digital wallets, and peer-to-peer networking.
- Proof-of-Work Consensus: Secure mining with adjustable difficulty
- Digital Wallets: RSA key pair generation and management
- Transaction System: Cryptographically signed transactions
- Peer-to-Peer Network: Multi-node blockchain synchronization
- Conflict Resolution: Longest chain rule implementation
- Interactive Dashboard: Real-time blockchain monitoring
- Wallet Management: Create/load wallets with balance tracking
- Transaction Processing: Send/receive cryptocurrency
- Network Visualization: View connected peer nodes
- Mining Interface: Mine new blocks and earn rewards
- RESTful API with comprehensive endpoints
- Persistent data storage (JSON-based)
- Bootstrap-responsive web UI
- Modular architecture with proper separation of concerns
- Production-ready with Heroku deployment configuration
- Backend: Python 3.9, Flask, Flask-CORS
- Cryptography: PyCrypto (RSA signatures, SHA-256 hashing)
- Frontend: HTML5, CSS3, Bootstrap 4, Vanilla JavaScript
- Deployment: Gunicorn WSGI server
- Networking: HTTP REST API, JSON data exchange
- Python 3.9+
- pip package manager
-
Clone the repository
git clone https://github.com/yourusername/blockchain-project.git cd blockchain-project -
Install dependencies
pip install -r requirements.txt
-
Run a single node
python node.py
Access the web interface at
http://localhost:5000
Run multiple nodes to test peer-to-peer functionality:
# Terminal 1 - Node on port 5000
python node.py --port 5000
# Terminal 2 - Node on port 5001
python node.py --port 5001
# Terminal 3 - Node on port 5002
python node.py --port 5002Connect nodes via the web interface to create a distributed network.
POST /wallet- Create new wallet keysGET /wallet- Load existing wallet
POST /transaction- Submit new transactionGET /transactions- Get pending transactions
GET /chain- Retrieve full blockchainPOST /mine- Mine a new blockPOST /resolve-conflicts- Synchronize with network
POST /node- Add peer nodeGET /nodes- List connected peersDELETE /node/<node_id>- Remove peer node
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Web UI │ │ Flask API │ │ Blockchain │
│ (Bootstrap) │◄──►│ (REST) │◄──►│ Core Logic │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│
┌─────────────────┐
│ Utilities │
│ - Hash Utils │
│ - Verification│
│ - Crypto │
└─────────────────┘
blockchain.py: Core blockchain logic and consensus algorithmnode.py: Flask REST API server and routingwallet.py: RSA cryptography and key managementtransaction.py: Transaction data structuresblock.py: Block data structuresutility/: Hashing, verification, and helper functions
- Create a wallet - Generate RSA key pairs
- Mine blocks - Earn initial cryptocurrency
- Send transactions - Transfer funds between wallets
- Add peer nodes - Test network synchronization
- Resolve conflicts - Verify longest chain consensus
The application is configured for production deployment with:
- Heroku: Ready-to-deploy with
Procfileandruntime.txt - Railway/Render: Modern cloud platforms with Git integration
- Environment Variables: Configurable port and settings
heroku create your-blockchain-app
git push heroku main- Digital Signatures: All transactions cryptographically signed
- Hash Verification: Block integrity through SHA-256 chaining
- Proof-of-Work: Prevents double-spending and spam
- Input Validation: Comprehensive request validation
- Key Security: Private keys stored locally, never transmitted
- Mining Difficulty: Adjustable proof-of-work complexity
- Data Persistence: Efficient JSON-based storage
- Network Optimization: Minimal bandwidth peer communication
- Scalability: Modular design supports feature expansion
This project demonstrates core blockchain concepts and is open for improvements:
- Fork the repository
- Create a feature branch
- Implement your changes
- Add tests if applicable
- Submit a pull request
This project is open source and available under the MIT License.
Built to demonstrate blockchain technology, cryptographic principles, and full-stack development skills.