A proof-of-work cryptocurrency system with Flask-based server and lightweight mining client.
- Server: Flask API (server.py) with SQLite database
- Client: Python CLI miner (pvtxcoinminer.py)
- Consensus: Proof-of-Work with dynamic reward calculation
- Cryptography: Password hashing with Werkzeug security
- 🖥️ REST API server with JWT-like authentication
- ⛏️ CPU-based mining algorithm with decreasing rewards
- 👤 User registration/login system
- 💰 Wallet system with coin transfers
- 📜 Transaction history tracking
- ⚖️ Balance management with SQL transactions
- 📊 Automatic database schema initialization
- Python 3.7+
- pip package manager
- SQLite3 (included with Python)
git clone https://github.com/PingVortex/PVTX-Coin.git
cd PVTX-CoinServer Requirements:
pip install flask python-dotenv werkzeugClient Requirements:
pip install requestsCreate .env file:
SECRET_KEY=your_secure_key_herepython3 server.py(This automatically creates pvtxc.db on first run)
python3 server.pyServer runs on 0.0.0.0:5057 by default
In pvtxcoinminer.py:
SERVER_URL = "http://localhost:5057" # For local developmentpython3 pvtxcoinminer.py- Start server in terminal 1:
python3 server.py- Start miner in terminal 2:
python3 pvtxcoinminer.py- Open second miner instance to test transfers
- Set proper WSGI server (Gunicorn/UWSGI)
- Configure reverse proxy (Nginx/Apache)
- Set production SECRET_KEY
- Enable HTTPS
- Regular database backups
| Endpoint | Method | Description |
|---|---|---|
| /register | POST | User registration |
| /login | POST | User authentication |
| /mine | POST | Submit mining solution |
| /transfer | POST | Transfer coins |
| /transactions | POST | Get transaction history |
| /problem | POST | Get mining problem |
- Uses Werkzeug password hashing
- SQL injection protected through parameterized queries
- Sensitive credentials never stored in plaintext
- Production requires:
- HTTPS encryption
- Rate limiting
- Input validation
- Regular security audits
Server not starting:
- Check port 5057 availability
- Verify database file permissions
- Check .env file exists
Mining errors:
- Verify client and server versions match
- Check system clock synchronization
- Ensure client points to correct server URL
Transaction issues:
- Confirm recipient username exists
- Verify sufficient balance
- Check transaction history for errors
Contributions are welcome! Please:
- Fork repository
- Create feature branch
- Commit changes
- Push to branch
- Open Pull Request
Distributed under MIT License. See LICENSE for details.
This is an educational project demonstrating basic cryptocurrency concepts. Not suitable for:
- Real financial transactions
- Production environments
- Investment purposes