🌿 Inspiration

Carbon credits are one of the most powerful tools we have to fight climate change — but the system is broken. Fraud, manual verification, and lack of transparency mean that billions of dollars in carbon credits go unverified every year. We asked: what if every emission reading was automatically verified by AI and permanently recorded on a blockchain, with zero human intervention?

That question became our project.

🔨 What We Built

A Blockchain-Integrated AI Framework for Carbon Credit Verification — a fully automated, four-layer pipeline that goes from raw IoT sensor data to tamper-proof carbon credit issuance: Layer 1 — IoT Simulation: Virtual sensors emit CO₂ (ppm), energy (kWh), temperature, and humidity readings every 5 seconds, with a 10% artificial anomaly injection rate to simulate real-world sensor faults.

Layer 2 — AI Inference Engine: Each reading passes through an LSTM rolling predictor (for time-series forecasting) followed by an XGBoost classifier that labels it VALID or ANOMALY with ~96% accuracy. Only clean, validated readings proceed further.

Layer 3 — Blockchain Node: Valid readings are hashed with SHA-256 and committed as immutable blocks. A Solidity smart contract (CarbonCreditVerifier.sol) enforces five on-chain rules — including replay-attack prevention and CO₂ range validation — and automatically issues one carbon credit per 100 kg of verified CO₂ reduction.

Layer 4 — Real-Time Dashboard: A Server-Sent Events (SSE) stream pushes live data to a browser dashboard showing readings, anomaly flags, blockchain ledger entries, and carbon credit totals.

🧠 What We Learned

  • How to architect a microservices system where each layer communicates over REST and SSE
  • The power of combining LSTM time-series prediction with XGBoost classification for sensor anomaly detection
  • How Solidity smart contracts can enforce business rules trustlessly — no middleman needed
  • The difference between simulating Hyperledger Fabric (our current approach) and deploying to a real Fabric network (our roadmap)
  • How SHA-256 chaining creates an immutable audit trail — altering any block breaks the entire chain

🚧 Challenges We Faced

  • Graceful degradation: Making the AI engine work even when TensorFlow or XGBoost aren't installed required careful fallback logic
  • Service orchestration: Getting four independent services (Python Flask ×3, Node.js ×1) to start, discover each other, and fail gracefully took significant work — solved with both a shell script (run_local.sh) and Docker Compose
  • Smart contract design: Encoding COâ‚‚ values as integers (×100 to avoid Solidity's lack of floats) and preventing replay attacks with SHA-256 deduplication were non-trivial design decisions
  • Real-time streaming: Implementing SSE correctly across service boundaries (dashboard bus proxying AI + blockchain events) without race conditions

🔭 What's Next

  • Replace the simulated blockchain node with a real Hyperledger Fabric deployment
  • Deploy CarbonCreditVerifier.sol to the Ethereum Sepolia testnet
  • Add satellite imagery analysis (computer vision) as a second verification input
  • Build a mobile app for facility managers to view their credits in real time

Built With

Share this project:

Updates