Skip to content

Parth-Gochhwal/Carbon-Chain-Registry

Repository files navigation

🌊 CarbonChain - Blue Carbon Registry Platform

A complete blockchain-based platform for managing blue carbon credits from mangrove restoration projects.

πŸš€ Features

  • 🌱 Project Registration - Complete carbon credit project onboarding
  • πŸ›°οΈ AI Analysis - Satellite imagery and site analysis
  • πŸ” Multi-Stage Verification - Internal, third-party, and legal verification
  • ⛓️ Blockchain Integration - Aptos smart contracts for immutable records
  • πŸͺ™ Tokenization - ERC-20 compatible carbon credit tokens
  • 🌍 Global Marketplace - Real-time trading with live market data
  • πŸ“Š Impact Dashboard - Real-time environmental and social impact tracking
  • πŸ’Ή Live Pricing - Binance API integration for real-time market data

πŸ—οΈ Tech Stack

Frontend

  • React 18
  • Modern responsive UI
  • Real-time data updates
  • Progressive Web App ready

Backend

  • Python FastAPI
  • SQLAlchemy ORM
  • Real-time Binance API integration
  • Comprehensive REST API

Blockchain

  • Aptos Move smart contracts
  • GeoNFT (location-bound NFTs)
  • Automated tokenization
  • On-chain verification

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • Python 3.9+
  • Git

Installation

  1. Clone the repository
git clone <repository-url>
cd CarbonChain-Deploy
  1. Install dependencies
# Install backend dependencies
cd backend
pip install -r requirements.txt

# Install frontend dependencies
cd ../frontend
npm install
  1. Start the application

Backend (Terminal 1):

cd backend
python main.py

Frontend (Terminal 2):

cd frontend
npm start
  1. Access the application

πŸ“ Project Structure

CarbonChain-Deploy/
β”œβ”€β”€ backend/                 # Python FastAPI Backend
β”‚   β”œβ”€β”€ main.py             # Main API application
β”‚   β”œβ”€β”€ models.py           # Database models
β”‚   β”œβ”€β”€ schemas.py          # Pydantic schemas
β”‚   β”œβ”€β”€ database.py         # Database configuration
β”‚   β”œβ”€β”€ requirements.txt    # Python dependencies
β”‚   └── services/           # Business logic modules
β”‚       β”œβ”€β”€ image_analysis.py
β”‚       β”œβ”€β”€ carbon_calculator.py
β”‚       β”œβ”€β”€ blockchain_service.py
β”‚       β”œβ”€β”€ aptos_integration.py
β”‚       β”œβ”€β”€ binance_price_service.py
β”‚       β”œβ”€β”€ verification_service.py
β”‚       └── marketplace_service.py
β”‚
β”œβ”€β”€ frontend/               # React Frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/     # React components
β”‚   β”‚   β”‚   β”œβ”€β”€ InitialAssessment.js
β”‚   β”‚   β”‚   β”œβ”€β”€ VerificationSteps.js
β”‚   β”‚   β”‚   β”œβ”€β”€ BlockchainRegistry.js
β”‚   β”‚   β”‚   β”œβ”€β”€ SmartContracts.js
β”‚   β”‚   β”‚   β”œβ”€β”€ CarbonMarketplace.js
β”‚   β”‚   β”‚   └── ImpactDashboard.js
β”‚   β”‚   β”œβ”€β”€ App.js          # Main application
β”‚   β”‚   └── index.js        # Entry point
β”‚   └── package.json        # Node dependencies
β”‚
β”œβ”€β”€ aptos-contracts/        # Aptos Move Smart Contracts
β”‚   β”œβ”€β”€ sources/
β”‚   β”‚   └── carbon_credit.move
β”‚   └── Move.toml
β”‚
β”œβ”€β”€ package.json            # Root package.json
β”œβ”€β”€ netlify.toml           # Netlify deployment config
└── README.md              # This file

🌐 API Endpoints

Projects

  • POST /api/projects - Create new project
  • GET /api/projects/{id} - Get project details
  • GET /api/projects - List all projects

Analysis

  • POST /api/analysis/site-image/{id} - Upload & analyze image
  • POST /api/analysis/satellite/{id} - Satellite analysis

Verification

  • POST /api/verification/{id} - Create verification
  • PUT /api/verification/{id}/approve - Approve verification

Blockchain

  • POST /api/blockchain/deploy/{id} - Deploy smart contract
  • POST /api/blockchain/mint-geonft/{id} - Mint GeoNFT

Marketplace

  • POST /api/marketplace/list/{id} - List credits
  • GET /api/marketplace/statistics - Market statistics
  • GET /api/marketplace/live-prices - Real-time prices

Dashboard

  • GET /api/dashboard/{id} - Project metrics

πŸ”§ Configuration

Environment Variables

Backend (.env):

DATABASE_URL=sqlite:///./blue_carbon_registry.db
APTOS_NODE_URL=https://fullnode.testnet.aptoslabs.com/v1
APTOS_PRIVATE_KEY=your_private_key_here

Frontend (.env.local):

REACT_APP_API_URL=http://localhost:8000

πŸš€ Deployment

Frontend (Netlify)

The frontend is configured for automatic deployment to Netlify:

  1. Connect your GitHub repository to Netlify
  2. Set build command: npm run build
  3. Set publish directory: frontend/build
  4. Deploy automatically on push

Backend (Heroku/Railway)

Deploy the backend to any Python hosting service:

  1. Set Python version to 3.9+
  2. Install dependencies from requirements.txt
  3. Start command: python main.py

πŸ’Ή Real-Time Features

  • Live Market Data - Updates every second from Binance API
  • Dynamic Pricing - Carbon credits correlated to crypto markets
  • Real-Time Portfolio - Live portfolio value calculations
  • Market Sentiment - Bullish/Bearish indicators

πŸ”’ Security Features

  • Input validation with Pydantic
  • SQL injection prevention
  • CORS configuration
  • Smart contract authorization
  • Environment variable protection

πŸ“Š Impact Tracking

  • COβ‚‚ sequestration monitoring
  • Biodiversity index calculation
  • Community benefit tracking
  • Water quality assessment
  • Progress visualization

🀝 Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License.

πŸ™ Acknowledgments

  • Aptos Foundation for blockchain infrastructure
  • Binance for real-time market data API
  • FastAPI for excellent Python web framework
  • React team for powerful frontend library

Built with ❀️ for climate action and sustainable development

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •