Empowering a Sustainable Future with Blockchain-Powered Green Hydrogen Credits
HydroChain is a comprehensive blockchain platform designed to be Transparent · Verifiable · Decentralized. Our system enables the seamless issuance, verification, and tracking of green hydrogen credits across their entire lifecycle, ensuring trust and accountability in the green hydrogen ecosystem.
HydroChain addresses critical market challenges in green hydrogen credit trading by:
- Enabling secure buying and selling of green hydrogen credits
- Preventing greenwashing through transparent verification
- Eliminating duplicate selling with blockchain-based immutability
- Facilitating safe retirement of credits with complete audit trails
Blockchain technology serves as the foundation for trust, ensuring every transaction is transparent, verifiable, and tamper-proof.
- Issue Request Management: Streamlined credit issuance workflow
- Buy Request Processing: Secure purchase transaction handling
- Authentication System: Role-based access control for all user types
- Request Tracking: PostgreSQL database for comprehensive audit trails
- Solidity-based Smart Contracts: Automated credit lifecycle management
- Non-Duplicatable Credits: Unique token generation preventing fraud
- Buying & Selling Logic: Secure transfer mechanisms
- Governing Authority Integration: Automated approval/rejection workflows
- Authority Verification: Governing bodies can accept or reject permissions
- Compliance Monitoring: Real-time oversight of all transactions
- Regulatory Integration: Support for external auditors and verifiers
Built with modern web technologies for optimal user experience:
- Landing Page: Professional introduction to the platform
- Plant Dashboard: Specialized interface for hydrogen producers
- High-Performance Stack: React.js with Vite, ShadCN UI components
- Credit Retirement System: Complete lifecycle management
- DID Verification: Decentralized Identity integration
- Verifiable Credentials (VCs): Cryptographic proof of authenticity
- Real-time IoT Monitoring: Sensor data integration for verification
- Automated Validation: IoT-triggered credit issuance
- Enhanced Compliance: Real-world data validation for selling and retirement
- React.js with Vite for fast development and builds
- React Router DOM for seamless navigation
- Tailwind CSS for responsive, modern styling
- ShadCN UI for consistent, accessible components
- Elysia Framework for robust server-side logic
- PostgreSQL for reliable data persistence and request tracking
- RESTful APIs for seamless frontend-backend communication
- Solidity Smart Contracts for automated, trustless operations
- Ethereum-compatible networks for broad ecosystem support
- Sepolia Testnet for development and testing
Our core smart contract handles the complete lifecycle of green hydrogen credits:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract HydrogenCredit {
struct Credit {
string id;
address issuer;
address holder;
uint256 amount;
uint256 timestamp;
bool retired;
}
Credit[] public credits;
mapping(string => uint256) public creditIdToIndex; // Map string ID to array index
mapping(string => bool) public creditExists; // Check if ID already exists
event CreditIssued(
string indexed id,
address indexed issuer,
uint256 amount
);
event CreditTransferred(
string indexed id,
address indexed from,
address indexed to
);
event CreditRetired(string indexed id, address indexed holder);
function issueCredit(string memory id, address to, uint256 amount) public {
require(!creditExists[id], 'Credit ID already exists');
credits.push(
Credit({
id: id,
issuer: msg.sender,
holder: to,
amount: amount,
timestamp: block.timestamp,
retired: false
})
);
// Map the string ID to array index
creditIdToIndex[id] = credits.length - 1;
creditExists[id] = true;
emit CreditIssued(id, msg.sender, amount);
}
function transferCredit(string memory creditId, address to) public {
require(creditExists[creditId], "Credit doesn't exist");
uint256 index = creditIdToIndex[creditId];
require(credits[index].holder == msg.sender, 'Not your credit');
require(!credits[index].retired, 'Credit already retired');
credits[index].holder = to;
emit CreditTransferred(creditId, msg.sender, to);
}
function retireCredit(string memory creditId) public {
require(creditExists[creditId], "Credit doesn't exist");
uint256 index = creditIdToIndex[creditId];
require(credits[index].holder == msg.sender, 'Not your credit');
require(!credits[index].retired, 'Already retired');
credits[index].retired = true;
emit CreditRetired(creditId, msg.sender);
}
function getCredit(
string memory creditId
) public view returns (Credit memory) {
require(creditExists[creditId], "Credit doesn't exist");
uint256 index = creditIdToIndex[creditId];
return credits[index];
}
function getAllCredits() public view returns (Credit[] memory) {
return credits;
}
}- Unique Credit IDs: Prevents duplicate credit creation
- Full Lifecycle Management: Issue, transfer, and retire credits
- Ownership Verification: Only credit holders can transfer or retire
- Immutable Records: All transactions permanently recorded on blockchain
- Event Logging: Complete audit trail through blockchain events
-
Install MetaMask
# Download MetaMask browser extension from metamask.io # Create a new wallet and securely store your seed phrase
-
Create Local Ethereum Account
# In MetaMask: # 1. Click on account avatar # 2. Select "Create Account" # 3. Name your account (e.g., "HydroChain Dev")
-
Configure Sepolia Testnet
# Add Sepolia network to MetaMask: # Network Name: Sepolia # RPC URL: https://sepolia.infura.io/v3/YOUR-PROJECT-ID # Chain ID: 11155111 # Currency Symbol: ETH # Block Explorer: https://sepolia.etherscan.io
-
Get Test ETH
# Visit Sepolia faucet: https://sepoliafaucet.com/ # Enter your wallet address # Receive free Sepolia ETH for testing
-
Deploy Smart Contract
# Using Hardhat or Remix IDE: # 1. Compile the HydrogenCredit.sol contract # 2. Connect MetaMask to deployment environment # 3. Deploy to Sepolia testnet using test ETH # 4. Copy contract address for frontend integration
-
Smart Contract Integration
// Frontend integration with Web3 import Web3 from 'web3'; // Connect to deployed contract const web3 = new Web3(window.ethereum); const contract = new web3.eth.Contract(ABI, CONTRACT_ADDRESS); // Issue new credit await contract.methods.issueCredit(creditId, recipientAddress, amount) .send({ from: userAddress }); // Transfer credit await contract.methods.transferCredit(creditId, recipientAddress) .send({ from: userAddress }); // Retire credit await contract.methods.retireCredit(creditId) .send({ from: userAddress });
- Node.js (v16 or higher)
- PostgreSQL database
- MetaMask browser extension
- Sepolia testnet ETH
-
Clone the repository
git clone https://github.com/your-org/hydrochain.git cd hydrochain -
Install frontend dependencies
cd frontend npm install -
Install backend dependencies
cd backend npm install -
Set up environment variables
cp .env.example .env # Configure your database and blockchain settings SEPOLIA_RPC_URL=your-sepolia-rpc-url CONTRACT_ADDRESS=your-deployed-contract-address -
Deploy smart contracts
cd contracts npx hardhat compile npx hardhat deploy --network sepolia -
Run the application
# Start backend cd backend && npm start # Start frontend (new terminal) cd frontend && npm run dev
- Connect MetaMask wallet
- Request credit issuance through plant dashboard
- Wait for governing authority approval
- Receive credits in blockchain wallet
- Browse available credits in marketplace
- Initiate purchase through smart contract
- Complete transaction using Sepolia ETH
- Credits automatically transferred to wallet
- Review credit issuance requests
- Verify compliance documentation
- Approve/reject through governance interface
- Monitor all transactions on blockchain
We welcome contributions to HydroChain! Please read our contributing guidelines and submit pull requests for any improvements.
Built for HackOut'25 at Dhirubhai Ambani University Gandhinagar
Addressing the first problem statement: Blockchain-Based Green Hydrogen Credit System