A state-of-the-art blockchain-based energy trading platform enabling peer-to-peer energy exchange, carbon tracking, automated market mechanisms, and comprehensive dashboards for multiple user personas.
- Blockchain-Based Trading: Secure, transparent energy trading using Ethereum-compatible smart contracts
- Multiple User Personas: Dedicated dashboards for Prosumers, Consumers, Producers, Grid Operators, Regulators, and Traders
- Carbon Tracking: Real-time carbon emissions monitoring and offset mechanisms
- DER Management: Register and manage Distributed Energy Resources (solar, batteries, EVs)
- Automated Market Maker: Efficient price discovery and order matching
- Scenario Modeling: What-if analysis for energy decisions
- End-to-End Traceability: Complete provenance tracking from production to consumption
- Anomaly Detection: AI-powered detection of unusual trading patterns
- Scalable Architecture: Designed to handle billions of users
- Frontend: React + TypeScript + Vite + Tailwind CSS
- Backend: Node.js + Express + TypeScript
- Database: PostgreSQL (production) / SQLite (development)
- Blockchain: Hardhat (local dev) / Polygon (production)
- Real-time: WebSocket for live market updates
- AI/ML: TensorFlow.js for forecasting and anomaly detection
energy-exchange-defi/
├── contracts/ # Smart contracts (Solidity)
├── backend/ # Node.js backend API
├── frontend/ # React frontend application
├── docs/ # Documentation
└── docker-compose.yml # Docker configuration
-
Clone and Install
git clone <repository-url> cd energyexchangedapp npm install
-
Start Services
# In one terminal, start the local blockchain npm run local-node # In another terminal, start the platform (Backend + Frontend) npm run dev
The app will be available at:
- Frontend: http://localhost:5173
- Backend: http://localhost:3000
- Blockchain: http://localhost:8545
Test the platform immediately with our pre-configured demo account:
- Email:
sarah.johnson@email.com - Password:
demo123
The platform provides specialized, "glass-card" design dashboards for every key participant in the energy ecosystem.
Energy producers and consumers who can both buy and sell energy.
- Sub-Views: Dashboard, Trading Interface, DER Management, Carbon Footprint, Analytics.
- Key Features: Solar production tracking, battery storage oversight, and P2P trading.
Households or businesses looking for cost-effective and clean energy.
- Sub-Views: Dashboard, Marketplace, Billing, Optimization.
- Key Features: AI-driven cost recommendations and direct renewable energy purchasing.
Large-scale renewable farms and power plants.
- Sub-Views: Dashboard, Wholesale Desk, Asset Manager, Grid Integration.
- High-Fidelity features:
- Wholesale Desk: Interactive market bidding and futures management.
- Asset Manager: Advanced fleet health monitoring and maintenance scheduling.
Ensures grid stability and manages infrastructure.
- Sub-Views: Dashboard, Network Topology, Outage Center, Demand Response.
- High-Fidelity features:
- Network Topology: Real-time load flow visualization and node health tracking.
- Outage Center: Rapid response mission control for service restoration.
Oversees market compliance and ensures fairness.
- Sub-Views: Dashboard, Compliance Tracker, Market Surveillance, Reporting.
- High-Fidelity features:
- Compliance Tracker: Automated audit trail generation and threshold monitoring.
- Market Surveillance: AI-powered detection of price manipulation and wash trading.
Professional energy traders and portfolio managers.
- Sub-Views: Dashboard, Trading Terminal, Risk Analyzer, Portfolio.
- High-Fidelity features:
- Trading Terminal: High-performance order books with depth charts and instant execution.
- Risk Analyzer: Comprehensive VaR metrics and portfolio exposure heatmaps.
- Connect MetaMask wallet
- Register as Prosumer
- Add a solar panel (5kW) in DER Management
- Create sell order: 10 kWh @ $0.15/kWh
- Switch to Consumer account
- Purchase energy from marketplace
- View trade on blockchain
- Check traceability dashboard
- Login as Prosumer
- Navigate to Carbon Footprint
- View emissions based on energy mix
- Run scenario: "Add 2kW battery storage"
- Compare carbon impact
- Login as Grid Operator
- View real-time grid topology
- Simulate high demand
- Activate demand response
- Monitor congestion alerts
# Run all tests
npm test
# Test smart contracts
npm run test:contracts
# Test backend
npm run test:backend
# Test frontend
npm run test:frontend
# Run with coverage
npm run test:coverageCore marketplace for energy trading with automated market maker.
Registration and management of Distributed Energy Resources.
Carbon credit tokenization and trading (ERC-20).
Immutable trade history and provenance tracking.
DAO governance for platform parameters.
- JWT authentication with wallet signature verification
- Role-based access control (RBAC)
- Smart contract access controls
- Rate limiting on API endpoints
- SQL injection prevention
- XSS protection
- CORS configuration
- Microservices architecture
- Database connection pooling
- Redis caching layer
- WebSocket for real-time updates
- Layer 2 blockchain (Polygon) for production
- CDN for static assets
- Horizontal scaling support
- IEC 62325 (energy market communications)
- ENTSO-E guidelines
- FERC regulations (US markets)
- GDPR compliance
- KYC/AML integration points
Contributions are welcome! Please read our contributing guidelines before submitting PRs.
MIT License - see LICENSE file for details
For issues and questions:
- Create an issue on GitHub
- Check documentation in
/docs - Review demo scenarios above
- Set up PostgreSQL database
- Configure environment variables for production
- Deploy smart contracts to Polygon
- Build frontend:
npm run build:frontend - Deploy backend to cloud service (AWS, GCP, Azure)
- Configure CDN for frontend assets
- Set up monitoring and logging
docker-compose up -dThis starts all services including PostgreSQL, Redis, and the application.
Built with ❤️ for a sustainable energy future