Skip to content

Harshk133/blockchain-mini-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŽ“ Blockchain Certificate Verifier

A decentralized, tamper-proof certificate verification system built on Ethereum. Institutions can issue certificates on-chain, and anyone can verify their authenticity instantly β€” no central authority required.

License: MIT Solidity React Truffle

https://github.com/user/CertificateVerifier/assets/123456789/abc123-def456-ghi789

✨ Features:

  • πŸ”’ Tamper-proof certificate issuance & verification
  • πŸ“„ Professional PDF certificate generation
  • ☁️ IPFS storage via Pinata for decentralized file hosting
  • πŸ“± QR codes for mobile verification
  • 🌐 Works on Ethereum (local testnet or Sepolia)
  • πŸ’» Responsive React.js frontend
  • πŸ§ͺ Tested with Ganache & Truffle

πŸš€ Live Demo

While this is a local dApp, you can run it on your machine in <5 minutes!
(Future: Deployed version coming soon on Sepolia + Vercel)


πŸ› οΈ Tech Stack

  • Smart Contract: Solidity 0.8.18 (Truffle)
  • Frontend: React.js + Web3.js
  • Backend: Express.js + Puppeteer (PDF generation)
  • Storage: IPFS via Pinata API
  • Blockchain: Ethereum (Ganache for local testing)
  • Tools: Truffle, Ganache, MetaMask

πŸ“¦ Installation

Prerequisites

1. Clone the repo

git clone https://github.com/your-username/CertificateVerifier.git
cd CertificateVerifier

2. Install dependencies

# Install Truffle globally (if not already)
npm install -g truffle

# Install project dependencies
npm install

# Install React frontend dependencies
cd client
npm install
cd ..

3. Configure Pinata API Credentials

  1. Go to Pinata and create a free account

  2. Navigate to API Keys section

  3. Click New Key and create an API key with pinning permissions

  4. Copy your API Key and Secret

  5. Create a .env file in the project root:

# Copy the example file
copy .env.example .env    # Windows
cp .env.example .env      # macOS/Linux
  1. Edit .env and add your Pinata credentials:
PINATA_API_KEY=your_actual_api_key_here
PINATA_SECRET=your_actual_secret_key_here
PORT=3001
FRONTEND_URL=http://localhost:5173

⚠️ Important: Never commit your .env file to version control!

4. Start Ganache CLI

npx ganache

πŸ‘‰ Note: This starts a local blockchain on http://127.0.0.1:8545 (Chain ID: 1337)

Deployment


1. Deploy smart contract

truffle migrate --reset --network development

2. Update frontend with contract ABI

# Windows (PowerShell)
Copy-Item build/contracts/CertificateVerifier.json client/src/contracts/

# macOS/Linux
cp build/contracts/CertificateVerifier.json client/src/contracts/

▢️ Run the Application

Terminal 1 - Start Backend Server:

node server.js

You should see:

πŸš€ Backend server running on http://localhost:3001
βœ… Pinata API Key loaded: xxxxx...
βœ… Pinata Secret loaded

Terminal 2 - Start Frontend:

cd client
npm run dev

3. Configure MetaMask

  1. Add Custom Network

    Network Name: Ganache CLI

    RPC URL: http://127.0.0.1:8545

    Chain ID: 1337

  2. Import account using the first private key from Ganache CLI output

4. Open in browser

πŸ‘‰ Go to http://localhost:5173

Usage

Issue a Certificate

  1. Fill in Student Name, Course, and Email
  2. Click "Issue Certificate"
  3. Wait for PDF generation (takes ~5-10 seconds)
  4. Confirm transaction in MetaMask
  5. Download the PDF certificate from IPFS link

Verify a Certificate

  1. Enter the same Email and Course
  2. Click "Verify"
  3. See certificate details with IPFS link
  4. Scan QR code to verify on mobile

βœ… All certificates are:

  • Stored immutably on the blockchain
  • Backed by PDF files on IPFS
  • Verifiable via QR codes

πŸ”§ Troubleshooting

Backend Server Issues

Error: "PINATA_API_KEY is missing"

  • Make sure you created a .env file in the project root
  • Verify your Pinata credentials are correct
  • Restart the server after adding credentials

Error: "ECONNREFUSED"

  • Ensure the backend server is running on port 3001
  • Check if another process is using port 3001

PDF Generation Issues

Error: "PDF generation failed"

  • Puppeteer requires Chrome/Chromium to be installed
  • On Windows, it should install automatically with npm install
  • On Linux, you may need to install dependencies:
    sudo apt-get install -y chromium-browser

IPFS Upload Issues

Error: "Authentication failed"

  • Double-check your Pinata API credentials
  • Ensure there are no extra spaces in your .env file
  • Try regenerating your API key on Pinata

Error: "Rate limit exceeded"

  • Free Pinata accounts have rate limits
  • Wait a few minutes before trying again
  • Consider upgrading your Pinata plan for production use

MetaMask Issues

Transaction Fails

  • Ensure you have enough ETH in your Ganache account
  • Check that you're connected to the correct network (Ganache)
  • Try resetting your MetaMask account (Settings β†’ Advanced β†’ Reset Account)

πŸ“ Project Structure

CertificateVerifier/
β”œβ”€β”€ contracts/              # Solidity smart contracts
β”‚   └── CertificateVerifier.sol
β”œβ”€β”€ migrations/             # Truffle deployment scripts
β”œβ”€β”€ client/                 # React frontend
β”‚   └── src/
β”‚       β”œβ”€β”€ App.jsx        # Main application component
β”‚       └── contracts/     # Contract ABIs
β”œβ”€β”€ server.js              # Express backend (PDF + IPFS)
β”œβ”€β”€ .env                   # Environment variables (not in git)
β”œβ”€β”€ .env.example           # Example environment file
β”œβ”€β”€ package.json           # Backend dependencies
└── truffle-config.js      # Truffle configuration

πŸš€ Future Enhancements

  • Deploy to Sepolia testnet
  • Batch certificate issuance
  • Email notifications with certificate links
  • Certificate revocation system
  • Multiple certificate templates
  • Admin dashboard for institutions
  • Certificate analytics

πŸ“ License

MIT License - feel free to use this project for learning or production!!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors