Skip to content

A full-stack dApp for buying, transferring, and managing hydrogen credits on the Sepolia Ethereum blockchain.

Notifications You must be signed in to change notification settings

veer-mehta/h2cred

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 

Repository files navigation

H2Cred

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.

Screenshots

Landing Page

Landing Page

Seller Dashboard

Seller Dashboard

Buyer Dashboard

Buyer Dashboard

Project Structure

  • 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/ and blockchain/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.

Prerequisites

  • 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

Setup

  1. Clone the repository:
    git clone https://github.com/veer-mehta/h2cred.git
    cd h2cred
  2. Install dependencies (monorepo):
    pnpm install
  3. Configure environment variables for blockchain: Create a .env file in the blockchain/ directory with:
    ALCHEMY_URL=your_sepolia_alchemy_url
    PRIVATE_KEY=your_metamask_sepolia_private_key

Usage

Blockchain (Hardhat)

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

Frontend (React + Vite)

Start the frontend

cd frontend
pnpm run dev

Contract Features

  • 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.

Frontend Features

  • Modern React UI for buying, transferring, and tracking hydrogen credits
  • Seller and buyer dashboards
  • Connects to MetaMask for wallet interactions

About

A full-stack dApp for buying, transferring, and managing hydrogen credits on the Sepolia Ethereum blockchain.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •