GreenSol is a full-stack blockchain project that allows IoT devices (e.g., ESP32 energy meters) to log renewable energy production and mint verifiable NFT-based Green Certificates.
Each unit of energy produced is represented by an NFT minted on-chain, while off-chain logs are stored in a database for analytics and leaderboards.
- Written in Solidity (ERC721 standard).
- Mints NFTs representing energy units produced.
- Emits
Transferevents for traceability. - Metadata hosted on IPFS (
tokenURI).
- Exposes REST APIs for logging energy, minting, burning, transfers, etc.
- Interacts with the smart contract via Web3.py.
- Persists rich energy logs in DB for analytics.
- Provides endpoints for leaderboard & user history.
-
Connects via MetaMask or WalletConnect.
-
Allows users to view:
- Certificates (NFTs) they own.
- Total energy produced (units).
- Leaderboards.
- Transaction history.
-
Admin dashboard for monitoring logs.
- Python 3.10+
- Node.js 18+
- MetaMask wallet
- Access to a blockchain RPC (e.g. Monad, Ethereum testnet, Polygon Mumbai)
# Clone repo
git clone https://github.com/jazzy1902/Monad-BlockHackers.git
cd Monad-BlockHackers/backend
# Install dependencies
pip install -r requirements.txt
# Create .env file
cp .env.example .envMONAD_RPC=https://rpc.testnet.monerchain.io
PRIVATE_KEY=your_private_key_here
CONTRACT_ADDRESS=0xYourDeployedContract
CHAIN_ID=12345
CORS_ORIGINS=http://localhost:3000
MINT_PER_UNIT=1uvicorn main:app --reload --port 8000cd ../frontend
npm install
npm startFrontend runs at 👉 http://localhost:3000
- Go to
contracts/GreenCertificateNFT.sol. - Compile & deploy using Hardhat or Remix.
- Save the deployed contract address in
.env. - Export ABI JSON to
backend/artifacts/GreenCertificateNFT.json.
GET /api/ping → returns network info.
POST /api/logEnergy
{
"wallet": "0xabc...",
"units": 12.5,
"device_id": "esp32-1",
"device_timestamp": "2025-08-29T10:00:00Z"
}GET /api/leaderboard?limit=10
GET /api/getEnergyLogs?wallet=0xabc...
GET /api/balance?wallet=0xabc...
- NFTs ≠ energy units:
balanceOfgives NFT count, but actual energy is summed from DB logs. - Gas fees: Transactions use EIP-1559 with fallback.
- Security: Never expose private keys; use
.env. - CORS: Default allows all, restrict for production.
- Add ERC721Enumerable to allow on-chain querying of NFTs.
- Add staking/rewards for energy producers.
- Deploy to Layer-2 (Polygon zkEVM, Arbitrum).