block-chain-based-certificate-verification

ClearCert — Certificate Verification Starter

A local-first certificate registry starter built with Solidity, Hardhat, a separate Node.js HTTP API, ethers.js, and a plain HTML/CSS/JavaScript frontend. It demonstrates issuing and verifying tamper-evident certificate records without putting names, certificate numbers, or other personal details on-chain.

What it does

Requirements

Run locally

Install dependencies from this directory:

npm install
npm test
npm run test:backend

Open four terminals in this directory and leave each running:

Terminal 1 — start the local Hardhat chain

npm run node

Terminal 2 — deploy the registry

npm run deploy:local

The deployment script writes the address and chain ID to frontend/deployment.json (this generated local file is git-ignored).

Terminal 3 — start the backend API

npm run backend

The API listens on http://127.0.0.1:3001. It reads the deployed contract address from frontend/deployment.json. Optional backend environment variables are RPC_URL, CONTRACT_ADDRESS, CHAIN_ID, API_HOST, and API_PORT. If you change the API port, set API_URL for Vite to the matching backend URL.

Open http://127.0.0.1:3001 to view the backend registry dashboard. It lists public record references, issuer addresses, issue times, and revocation status; private certificate details are not stored on-chain.

Terminal 4 — start the frontend

npm run frontend

Open http://127.0.0.1:5173. In MetaMask, add or select the local network with RPC URL http://127.0.0.1:8545, chain ID 31337, and currency symbol ETH. For local development only, import one of the test accounts and private keys printed by npm run node into MetaMask. Those keys are public test keys; never fund or reuse them on a real network.

The deployer account is the initial owner and issuer. To issue from another account, connect as the owner, expand Issuer administration, and approve the issuer wallet address. Then connect as that approved issuer and submit the issuance form. Issuance transactions are signed in the browser wallet; the API never receives issuer private keys. Public verification goes through the backend API and does not require a wallet connection, but both the API and local node must be running.

Tests and build

npm test
npm run test:backend
npm run compile
npm run build:frontend

The contract tests live in test/CertificateRegistry.js; backend validation and digest tests live in backend/certificate.test.js.

Privacy and security limits

This code is an educational starter, not a production-ready credential platform.