Skip to content

jvcByte/certificate-verification-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

18 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Blockchain-Based Certificate Verification System

A complete prototype system for issuing, managing, and verifying academic certificates using blockchain technology and IPFS.

🎯 Features

Admin (University)

  • Issue certificates with PDF upload
  • Store certificate files on IPFS
  • Store certificate hash on Ethereum blockchain
  • Revoke certificates

Student

  • View certificate metadata
  • Access IPFS certificate files
  • Generate QR codes for verification
  • Share verification links

Verifier (Employer/Institution)

  • Upload certificate file or enter hash
  • Verify certificate validity via blockchain
  • View certificate status (valid/revoked)

πŸ›  Tech Stack

  • Frontend + Backend: Next.js 14 (App Router), TypeScript
  • Web3: wagmi, viem
  • Smart Contracts: Solidity 0.8.20
  • Contract Tooling: Foundry (forge + cast)
  • Blockchain: Ethereum Sepolia Testnet
  • File Storage: IPFS via Pinata API
  • Wallet: MetaMask
  • Hashing: SHA256 via viem

πŸ“ Project Structure

certificate-verification-system/
β”œβ”€β”€ contracts/              # Foundry smart contract project
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   └── CertificateRegistry.sol
β”‚   β”œβ”€β”€ script/
β”‚   β”‚   └── Deploy.s.sol
β”‚   β”œβ”€β”€ test/
β”‚   β”‚   └── CertificateRegistry.t.sol
β”‚   └── foundry.toml
└── frontend/              # Next.js application
    β”œβ”€β”€ app/
    β”‚   β”œβ”€β”€ admin/
    β”‚   β”‚   β”œβ”€β”€ issue/
    β”‚   β”‚   └── revoke/
    β”‚   β”œβ”€β”€ student/
    β”‚   β”œβ”€β”€ verify/
    β”‚   └── api/upload/
    β”œβ”€β”€ components/
    └── lib/

πŸš€ Getting Started

Prerequisites

1. Smart Contract Deployment

Step 1: Navigate to contracts directory

cd certificate-verification-system/contracts

Step 2: Install dependencies

forge install

Step 3: Run tests

forge test

Step 4: Create .env file

cp .env.example .env

Edit .env and add:

PRIVATE_KEY=your_metamask_private_key
BASE_SEPOLIA_RPC_URL=https://base-sepolia.infura.io/v3/YOUR_INFURA_KEY
ETHERSCAN_API_KEY=your_etherscan_api_key

Step 5: Deploy to Sepolia

source .env
forge script script/Deploy.s.sol --rpc-url $BASE_SEPOLIA_RPC_URL --broadcast --verify

Save the deployed contract address!

2. Frontend Setup

Step 1: Navigate to frontend directory

cd ../frontend

Step 2: Install dependencies

npm install

Step 3: Create .env.local file

cp .env.example .env.local

Edit .env.local and add:

NEXT_PUBLIC_CONTRACT_ADDRESS=0x... # From deployment
NEXT_PUBLIC_BASE_SEPOLIA_RPC_URL=https://base-sepolia.infura.io/v3/YOUR_INFURA_KEY
PINATA_JWT=your_pinata_jwt_token

Step 4: Run development server

npm run dev

Open http://localhost:3000

πŸ“ Usage Guide

Issuing a Certificate

  1. Navigate to "Issue Certificate" page
  2. Connect MetaMask wallet (must be admin address)
  3. Enter student ID
  4. Upload certificate PDF
  5. Click "Issue Certificate"
  6. Approve transaction in MetaMask
  7. Wait for confirmation
  8. Save the certificate hash for future reference

Revoking a Certificate

  1. Navigate to "Revoke Certificate" page
  2. Connect MetaMask wallet (must be admin address)
  3. Enter certificate hash
  4. Click "Revoke Certificate"
  5. Approve transaction in MetaMask

Viewing Certificate (Student)

  1. Navigate to "Student View" page
  2. Enter certificate hash
  3. View certificate details
  4. Generate QR code for sharing
  5. Copy verification link

Verifying a Certificate

  1. Navigate to "Verify Certificate" page
  2. Either:
    • Upload the certificate PDF file, OR
    • Enter the certificate hash
  3. Click "Verify Certificate"
  4. View verification result:
    • βœ“ VALID - Certificate is authentic
    • ❌ REVOKED - Certificate was revoked
    • ❌ NOT FOUND - Certificate doesn't exist

πŸ” Security Notes

  • Only the admin (contract deployer) can issue and revoke certificates
  • Certificate hashes are computed using keccak256
  • All transactions are recorded on the blockchain
  • IPFS ensures decentralized file storage

πŸ§ͺ Testing

Smart Contract Tests

cd contracts
forge test -vvv

Test Coverage

forge coverage

πŸ“Š Smart Contract Functions

issueCertificate

function issueCertificate(
    bytes32 certHash,
    string memory studentId,
    string memory ipfsHash
) external onlyAdmin

revokeCertificate

function revokeCertificate(bytes32 certHash) external onlyAdmin

verifyCertificate

function verifyCertificate(bytes32 certHash)
    external view
    returns (
        bool exists,
        bool revoked,
        string memory ipfsHash,
        string memory studentId,
        uint256 issuedAt
    )

🌐 Certificate Verification Flow

  1. Issuance:

    • Admin uploads PDF β†’ IPFS
    • System computes file hash
    • Smart contract stores: hash + studentId + IPFS CID
    • Event emitted on blockchain
  2. Verification:

    • Verifier uploads file OR enters hash
    • System queries blockchain
    • Returns: exists, revoked status, metadata
    • Display result to verifier

πŸ”— Useful Links

πŸ“„ License

MIT License - This is a prototype for educational purposes.

πŸŽ“ Thesis Notes

This system demonstrates:

  • Blockchain immutability for certificate records
  • Decentralized storage with IPFS
  • Smart contract access control
  • Web3 integration with modern frontend
  • Cryptographic verification
  • Event-driven architecture

πŸ› Troubleshooting

MetaMask Connection Issues

  • Ensure you're on Sepolia network
  • Check that you have test ETH

Transaction Failures

  • Verify you're using the admin wallet
  • Check gas settings
  • Ensure contract address is correct

IPFS Upload Failures

  • Verify Pinata JWT token
  • Check file size limits
  • Ensure API endpoint is accessible

πŸ‘¨β€πŸ’» Development

Built with ❀️ for university thesis project.

About

A complete prototype system for issuing, managing, and verifying academic certificates using blockchain technology and IPFS.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors