A full-stack dApp for buying, transferring, and managing hydrogen credits on the Ethereum blockchain. The backend uses Solidity smart contracts with Hardhat, and the frontend is built with React + Vite.
blockchain/contracts/GreenHydrogenCredit.sol
— Main Solidity smart contract for hydrogen credits.blockchain/scripts/deploy.js
— Script to deploy the contract to the Sepolia testnet.blockchain/test/test.js
— Hardhat/Chai test suite for contract functionality.blockchain/hardhat.config.js
— Hardhat configuration (uses Sepolia testnet, Solidity 0.8.20).blockchain/artifacts/
andblockchain/cache/
— Build artifacts and cache (auto-generated by Hardhat).blockchain/package.json
— Blockchain project dependencies and scripts.frontend/
— React + Vite frontend for interacting with the smart contract.
- Node.js (v14 or higher recommended)
- pnpm (recommended for monorepo)
- Hardhat
- An Alchemy API key for Sepolia
- A Sepolia testnet account with ETH and private key
- Clone the repository:
git clone https://github.com/veer-mehta/h2cred.git cd h2cred
- Install dependencies (monorepo):
pnpm install
- Configure environment variables for blockchain:
Create a
.env
file in theblockchain/
directory with:ALCHEMY_URL=your_sepolia_alchemy_url PRIVATE_KEY=your_metamask_sepolia_private_key
Compile Contracts
cd blockchain
npx hardhat compile
Run Tests
cd blockchain
npx hardhat test
Deploy to Sepolia
cd blockchain
npx hardhat run scripts/deploy.js
Start the frontend
cd frontend
pnpm run dev
- Buy Credits: Users can buy hydrogen credits by sending ETH.
- Transfer Credits: Users can transfer credits to other addresses.
- Track Credits: The contract tracks credits per address.
- Modern React UI for buying, transferring, and tracking hydrogen credits
- Seller and buyer dashboards
- Connects to MetaMask for wallet interactions