A carbon credit trading platform leveraging React, Flask, and Solidity to promote transparency andaccountability in CSR activities which are main disadvantages of traditional carbon trading.
Idea: Allow companies and corporations to reduce thier net carbon emissions by financially helping NGO that help reduce carbon emissions by buying smart contract based Carbon Tokens from them.
- Reduce problems like double spending, ambiguous credit generation, curruption that plague the traditional carbon credits system
- Implemented a royality system which ensure that 10% of every transaction is given back to NGOs to unsure continues
- A web app that simulates a blockchain carbon marketplace deployed on sepolia
The test web app deplyed here
The contract deployed at address 0x5E5D1D1Dc0EDDB4f9e9E05FD872642Cd78F6eF51
on Sepolia view it on EtherScan
To get started use test credentials:
- username:
test_buyer
- password:
sepolia
(You will require Sepolia account to use credits) Or ssee the demo here.
In India under section 135 of the Companies Act (2013), corporations must spend 2% of their average net profit from the preceding three years on Corporate Social Responsibility (CSR).
However, many companies resort to "greenwashing" rather than making genuine societal contributions. Simultaneously, NGOs face inadequate funding, limiting their ability to execute impactful projects.
A decentralized Carbon Credit system leveraging blockchain can address these challenges.
It ensures timely funding for NGOs, promotes transparency and accountability in CSR activities, and aligns corporate efforts with genuine societal and environmental betterment.
Carbon trading originated in the 1990s as a market-based solution to combat climate change, starting with the Kyoto Protocol in 1997, which introduced emissions trading among countries. It later evolved into voluntary markets and cap-and-trade systems, allowing companies to trade carbon credits globally.
-
NGOs will register on the platform and create Carbon Credits based on thier projects which will then be put up for sale.
-
Companies or traders can buy these can buy these credits from the NGO and resell them further if they wish to.
- For every resell of a carbon credit, 10% of the transaction value is returned to the original creator of the credit (NGO).
- This mechanism ensures continuous funding support for the NGO's environmental projects.
-
Credits must be available for finite amount of time to prevent double spending, once the project is completed the credits will be expired and can’t be sold further.
-
Once the NGO completes the promised project, it can expire all credits associated with that project.
- Once the NGO completes the promised project, it can expire all credits associated with that project.
- The web app generates a certificate verifying the credit purchase and acknowledging the person’s contribution to offsetting specific amount of carbon.
DemoCarbonCredits.mp4
Language: Solidity
Testing and Deployment: Hardhat
![Image 1](https://private-user-images.githubusercontent.com/124084350/396219414-e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wZGI5OGFhNzVhN2U5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.wSmCAFyPrQnzvx5azQNhW66mpTrZFdWh4VMKlxS8KjM)
![Image 1](https://private-user-images.githubusercontent.com/124084350/396222172-f39f222c-0790-4779-909e-7c8c4687620b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NTE5NjgsIm5iZiI6MTczOTU1MTY2OCwicGF0aCI6Ii8xMjQwODQzNTAvMzk2MjIyMTcyLWYzOWYyMjJjLTA3OTAtNDc3OS05MDllLTdjOGM0Njg3NjIwYi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNFQxNjQ3NDhaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT03ZjQ0YTcwN2JhZWMzZmE2M2RjNWNmNzczODRmMGVmOTAyODJhN2Q0MzdmZGNmOGVhMmJmNjY4ZTE2MTBkYzk5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.rYHUuebF9jr4uwmiV_OhY19p7SHGZRtg40C_f8vDl9w)
Framework: Python-Flask
Database: PostgreSQL
If you want to create your own smart contract
-
Installing hardhat: Learn more about about hardhhat and for troubleshooting check here Go to SmartContracts folder
npm install --save-dev hardhat
-
Create a
.env
file and add: (will be required if you want to deploy on Sepolia otherwise remove sepolia fromsmartContracts\hardhta.config.js
)TESTNET_URL=<YOUR_ALCHEMY_OR_INFURA_URL> PRIVATE_KEY=<YOUR_METAMASK_PRIVATE_KEY>
To get alchemy/infura url go to Alechmy or Infura To get private key Metamask -> account details -> show private key (it will be preffered to use spare account for this)
-
Compile contract:
npx hardhat compile
-
Test contract:
npx hardhat test
-
To Run local node:
npx hardhat node
then
npx hardhat ignition deploy ./ignition/modules/cc.js --network localhost
-
Setup local network in metamask:
- Go to metamask
- Press the network button (to the top left)
- Add custom network
- Write your network name
- In RPC url add
http://127.0.0.1:8545/
(when you run hardhat node) - ChainID:
31337
- Name your network currency
- Save network
-
To Deploy on sepolia
npx hardhat ignition deploy ./ignition/modules/cc.js --network sepolia
remeber to enable sepolia on metamask to access it
Go to backend folder
- Create virtual env (not needed in windows):
pip install virtualenv python<version> -m venv <virtual-environment-name>
- Activate the virtual env:
source env/bin/activate
- Install requirements:
pip install requirements.txt
- Run Backend:
python run.py
Go to client folder
- run:
npm install
- Start client:
npm start