GreenProof is a University project regarding a blockchain-based platform that tracks CO₂ emissions throughout the entire food supply chain, enabling transparency, accountability, and rewarding sustainable practices through tokenization.
- Overview
- Features
- System Architecture
- Prerequisites
- Installation
- Operating System Compatibility
- Configuration
- Database
- Usage
- Project Structure
- Security Measures
- Troubleshooting
- License
- Acknowledgments
GreenProof connects the entire food supply chain on a unified platform to track environmental impact from farm to the final consumer. The system creates a transparent ecosystem where:
Key Stakeholders:
- Manufacturers — Primary producers who create raw materials
- Processors — Transform raw materials into processed products
- Transporters — Move products between supply chain participants
- Sellers — Retail companies that sell to end consumers
Each transaction and transfer in the supply chain is recorded on the blockchain, with CO₂ emissions calculated and tokenized. Companies with better environmental performance earn more green tokens, creating a sustainable incentive model.
-
🔗 Blockchain Integration
- Immutable records of supply chain activities
- Smart contracts for automated token distribution
- Transparent and tamper-proof data storage
-
🌱 CO₂ Tracking
- Real-time emission calculations
- Industry-specific emission models
- Historical emission trends and analytics
-
🏆 Token Economy
- ERC20-based green tokens
- Performance-based token rewards
- Trading capabilities between supply chain participants
-
👥 User Management
- Role-based access control
- Company verification process
- Administrative approval workflow
GreenProof uses a layered architecture that combines blockchain, web services, and data analytics:
┌─────────────────────────┐
│ User Interface │
│ (Web/Mobile Frontend) │
└───────────┬─────────────┘
│
┌───────────▼─────────────┐
│ Application Layer │
│ (Flask API Services) │
└───────────┬─────────────┘
│
┌───────────▼─────────────┐ ┌────────────────────┐
│ Integration Layer │────▶│ External Services │
│ (Blockchain Connectors) │ │(Email, Storage, etc)│
└───────────┬─────────────┘ └────────────────────┘
│
┌───────────▼─────────────┐ ┌────────────────────┐
│ Storage Layer │────▶│ Supabase │
│ (Database & Chain) │ │ Database │
└───────────┬─────────────┘ └────────────────────┘
│
┌───────────▼─────────────┐
│ Blockchain Layer │
│ (Ethereum/Contracts) │
└─────────────────────────┘
Before installing GreenProof, ensure you have the following:
- Python 3.10+ - For backend services
- Node.js 21+ and npm - For smart contract development
- Docker and Docker Compose - For containerization
- Truffle - Ethereum development framework
- MetaMask - Ethereum wallet for testing
- Supabase account - For backend database
-
Clone the repository
git clone https://github.com/Pryce22/GreenProof.git cd Software-Security-and-Blockchain -
Install Python dependencies
pip install -r requirements.txt
-
Install and configure smart contracts
cd app/token npm install -
Install Truffle globally
npm install -g truffle
-
Start Docker services
docker-compose up -d
GreenProof has been developed and tested with different levels of compatibility across operating systems:
- Fully supported and tested on Windows 11
- Complete functionality is available
- Recommended platform for production use
- All installation steps in this documentation are verified on Windows 11
- Basic support available with limited testing
- May require additional configuration in some environments
- Known limitations:
- Some Docker networking features may need manual configuration
- Performance may vary depending on distribution
- Not officially supported
- The application was not designed or tested to run on macOS
- Users may encounter unexpected issues if attempting to deploy on macOS
- No official troubleshooting support is available for macOS-specific problems
For the best experience and stability, we recommend deploying GreenProof on Windows 11.
Create a .env file in the root directory with the following variables:
# Blockchain Configuration
PRIVATE_KEY="the_first_key_of_the_first_account_in_the_genesis_file_in_QBFT-Network"
# Database Configuration
SUPABASE_URL="your_supabase_url"
SUPABASE_KEY="your_supabase_key"
# Email Configuration
EMAIL_USER="notification_email_address"
EMAIL_PASSWORD="notification_email_password(preferred email app password)"
# Application Configuration
WERKZEUG_RUN_MAIN = "True"
SECRET_KEY="your_secret_key"- Create a Supabase project from the Supabase Dashboard
- Import the database schema using one of these methods:
- Option A: Using the command line (if you have PostgreSQL client installed):
psql -h your-supabase-host -d postgres -U postgres -f database/schema.sql
- Option B: Using the Supabase interface:
- Go to Supabase SQL Editor
- Create a new query
- Copy and paste the entire content of schema.sql file
- Execute the query
- Option A: Using the command line (if you have PostgreSQL client installed):
- Configure the connection in your .env file with your Supabase credentials
-
Wait for Docker container to be ready
-
Start the Flask server:
python main.py
-
Access the web interface at
http://localhost:5000
- Admin: Approve new companies, manage system settings
- Company Admin: Manage company profile, view emissions, trade tokens
- Company User: Input data, view company emissions
/
├── app/ # Main application code
│ ├── controllers/ # Business logic controllers
│ ├── routes/ # API endpoints
│ ├── QBFT-Network/ # Blockchain network configuration
│ ├── templates/ # HTML templates
│ │ └── includes/ # Template partials and components
│ ├── token/ # Smart contract code
│ │ ├── contracts/ # Solidity smart contracts
│ │ ├── migrations/ # Contract migration scripts
│ │ └── build/ # Contract compilation artifacts
│ ├── static/ # Static assets
│ │ ├── css/ # Stylesheets
│ │ ├── js/ # JavaScript files
│ │ ├── images/ # Image resources
│ │ └── favicon/ # Favicon files
│ │
│ │
│ └── utils/ # Helper functions
All inputs are validated before being processed:
- Emission data is verified against industry standards
- User inputs are sanitized to prevent injection attacks
- Implemented email-based MFA for enhanced account security
- Requires users to verify their identity via a code sent to their registered email address during login
- Sensitive data (e.g., passwords, API keys) is encrypted at rest in the database
- Utilizes industry-standard encryption algorithms to protect data confidentiality
- Comprehensive logging of user actions for auditing and security monitoring
- Logs include timestamps, user IDs, action types, and affected data
- Secure password recovery process using email verification
- Prevents unauthorized access to accounts during password resets
- Implemented rate limiting on login attempts to prevent brute-force attacks
- Accounts are temporarily locked after a certain number of failed login attempts
- Enforces unique user sessions to prevent session hijacking
- Each user can only have one active session at a time
- Enforces strong password policies to ensure password complexity
- Requires passwords to meet minimum length, character type, and complexity requirements
-
Smart contract deployment fails
- Ensure Docker is running and accessible
-
Database connection errors
- Verify your Supabase credentials
- Check network connectivity to Supabase server
-
Token transfer issues
- Ensure MetaMask is connected to the correct network
- Verify the sender has sufficient token balance
This project is licensed under the MIT License - see the LICENSE file for details.
Made by: Loris Bottegoni, Leonardo Cambiotti, Valerio Crocetti

