Corporate Carbon Credit Trading with Privacy & Verification
A decentralized carbon credit trading platform built on Uniswap v4, integrating Fhenix privacy encryption and EigenLayer AVS verification to solve critical issues in the $2B+ carbon credit market.
The corporate carbon credit market faces three critical challenges:
- Fraud & Double Counting: $2B+ worth of "ghost credits" and fraudulent certificates
- Privacy Concerns: Corporate buyers forced to reveal order sizes, enabling front-running
- Manual Compliance: Broken infrastructure for ESG reporting and audit trails
GreenSync integrates three cutting-edge technologies to create the first institutional-grade carbon trading infrastructure:
🔒 Fhenix Privacy: Fully Homomorphic Encryption (FHE) for private corporate purchases
⚡ EigenLayer AVS: Decentralized verification across multiple carbon registries
🦄 Uniswap v4 Hook: Dynamic fees and automated compliance retirement
Corporate Buyer → Frontend → Fhenix Encryption → Uniswap v4 Hook → EigenLayer AVS → Registry Verification → Compliance Proof
Fhenix Privacy Layer:
- Encrypted purchase amounts using FHE
- Hidden corporate identity during trades
- Privacy-preserving compliance tracking
buyCreditsPrivately()function with real encryption
EigenLayer AVS Verification:
- Cross-registry verification (Verra, Gold Standard, CAR)
- Decentralized quality scoring
- Real-time fraud detection
- Event-driven verification architecture
Uniswap v4 Hook:
- Dynamic fees based on credit quality + AVS scores
- Automated retirement for corporate compliance
- Before/after swap logic for ESG automation
- Proper hook address mining and deployment
- Dynamic Fee Calculation: Higher quality credits = lower trading fees
- Auto-Retirement: Corporate buyers automatically retire credits for compliance
- ESG Proof Generation: Cryptographic compliance certificates
- Real-time Verification: AVS operators validate credits across registries
GreenSync/
├── src/
│ ├── CarbonToken.sol # ERC20 with carbon credit metadata
│ └── CarbonFlowHook.sol # Main hook with sponsor integrations
├── avs/
│ ├── carbon-verifier.js # EigenLayer AVS operator
│ ├── package.json
│ └── .env # Configuration
├── script/
│ └── DeployReal.s.sol # Deployment with hook mining
├── test/
│ └── CarbonFlowHook.t.sol # Contract tests
├── frontend/
│ └── src/App.js # React dashboard
└── README.md
- Foundry
- Node.js 18+
- Git
# Clone repository
git clone <your-repo-url>
cd GreenSync
# Install Foundry dependencies
forge install
# Install AVS dependencies
cd avs
npm install
cd ..
# Install frontend dependencies
cd frontend
npm install
cd ..- Start Anvil blockchain:
anvil --code-size-limit 30000- Deploy contracts:
forge script script/DeployReal.s.sol:DeployReal \
--rpc-url http://localhost:8545 \
--private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \
--broadcast \
--code-size-limit 30000- Update AVS configuration:
# Copy the deployed hook address to avs/.env
echo "HOOK_CONTRACT_ADDRESS=<DEPLOYED_HOOK_ADDRESS>" > avs/.env
echo "RPC_URL=http://localhost:8545" >> avs/.env- Start AVS service:
cd avs
node carbon-verifier.js- Launch frontend:
cd frontend
npm start
# Open http://localhost:3000forge test -vv# Test corporate stats
cast call <HOOK_ADDRESS> \
"getCorporateStats(address)" \
0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 \
--rpc-url http://localhost:8545
# Test AVS verification
cast call <HOOK_ADDRESS> \
"getAVSVerificationDetails(uint256)" 1 \
--rpc-url http://localhost:8545
# Test Fhenix encryption
cast call <HOOK_ADDRESS> \
"createEncryptedInput(uint64)" 100 \
--rpc-url http://localhost:8545- Problem (30s): Explain carbon market fraud and privacy issues
- Solution (1m): Show integrated dashboard with all sponsor tech
- Live Demo (3m):
- Toggle privacy mode (Fhenix)
- Execute private purchase
- Show AVS verification in terminal
- Generate ESG compliance report
- Impact (30s): Market size and adoption potential
# Terminal 1: Blockchain
anvil --code-size-limit 30000
# Terminal 2: AVS Service
cd avs && node carbon-verifier.js
# Terminal 3: Frontend
cd frontend && npm startFhenix Integration:
- Real FHE types:
euint64,inEuint64 - Actual encryption/decryption calls
- Privacy-preserving state storage
- Compatible with Fhenix testnet deployment
EigenLayer AVS:
- Event-driven architecture
- Multi-registry verification logic
- Proper operator setup with ethers.js
- Real verification result submission
Uniswap v4:
- Correct hook permissions and flags
- Working address mining with HookMiner
- Dynamic fee calculation logic
- Before/after swap lifecycle integration
| Contract | Address | Purpose |
|---|---|---|
| CarbonToken | 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512 |
Carbon credit ERC20 with metadata |
| CarbonFlowHook | 0x2f11783E75f5D0BF0dB3DD6A5Ca05ed375aE80c0 |
Main hook with all integrations |
| PoolManager | 0x5FbDB2315678afecb367f032d93F642f64180aa3 |
Uniswap v4 pool manager |
- Hook address validation through CREATE2
- Corporate buyer authentication
- AVS operator access controls
- Fhenix encryption key management
- Total Addressable Market: $2B+ voluntary carbon market
- Target Users: Fortune 500 companies with ESG mandates
- Regulatory Drivers: 2025 SEC/EU climate disclosure requirements
- Technical Moat: First institutional privacy + verification infrastructure
- Anvil deployment with all sponsor integrations
- Corporate dashboard
- Basic AVS verification
- Deploy to Fhenix testnet for real FHE
- Othentic AVS registration
- Expanded registry integrations
- Enterprise registry API partnerships
- Institutional user onboarding
- Audit and security review
MIT License - See LICENSE file for details
Built during Uniswap Hook Incubator (UHI6) hackathon with focus on real sponsor integration rather than superficial demos.
GreenSync: Bringing institutional-grade infrastructure to carbon markets through decentralized privacy and verification.