Skip to content

Latest commit

Β 

History

History
682 lines (541 loc) Β· 20.5 KB

File metadata and controls

682 lines (541 loc) Β· 20.5 KB

πŸŽ“ Hashure - Blockchain-Powered Credential Verification

A decentralized platform for issuing, storing, and verifying academic credentials on the Polygon blockchain

Live Demo β€’ Report Bug β€’ Request Feature


πŸ“Έ Screenshot

Hashure Platform Screenshot

πŸ“‹ Table of Contents


🌟 Overview

Hashure is a blockchain-powered platform that revolutionizes academic credential verification. Built on the Polygon network, it enables universities to issue tamper-proof certificates, allows students to own and share their achievements securely, and provides recruiters with instant, fraud-proof verification.

The Problem

  • πŸ• Traditional credential verification takes days or weeks
  • πŸ”“ Academic fraud and fake certificates are widespread
  • πŸ’° Manual verification processes are expensive and inefficient
  • πŸ“„ Students don't truly own their academic achievements
  • 🌍 Cross-border credential verification is complex

The Solution

Hashure leverages blockchain technology to create an immutable, decentralized system where:

  • βœ… Credentials are hashed and stored on the Polygon blockchain
  • ⚑ Verification happens in seconds, not days
  • πŸ”’ Tamper-proof security ensures authenticity
  • πŸ‘€ Students maintain complete ownership of their credentials
  • 🌐 Global recognition across institutions and borders

✨ Features

For Universities πŸ›οΈ

  • Issue Credentials: Upload and issue certificates with blockchain verification
  • Manage Students: Track all issued credentials in a centralized dashboard
  • Instant Publishing: Credentials are hashed and stored on-chain immediately
  • Authentication System: Secure login with JWT tokens

For Students πŸŽ“

  • Digital Vault: Store all credentials in one secure location
  • QR Code Sharing: Generate shareable QR codes for instant verification
  • Selective Sharing: Choose what information to share and with whom
  • Download Options: Export credentials as PDFs or images
  • Real-time Updates: See verification status and blockchain confirmations

For Recruiters/Verifiers πŸ”

  • Instant Verification: Validate credentials in seconds via QR scan or upload
  • Blockchain Proof: See transaction hashes and on-chain verification
  • Fraud Prevention: Tamper-proof system prevents fake credentials
  • No Registration Required: Public verification page for anyone

Technical Features βš™οΈ

  • Blockchain Integration: Polygon (Amoy testnet) for low-cost, fast transactions
  • Smart Hashing: SHA-256 cryptographic hashing for credential integrity
  • RESTful API: Complete backend API with Hono.js
  • Modern UI: Beautiful, responsive design with Tailwind CSS
  • Animation Effects: Smooth transitions using Framer Motion
  • QR Code Generation: Easy sharing and verification
  • File Upload: Support for PDF, image, and document formats

πŸ› οΈ Tech Stack

Frontend

  • Framework: Next.js 15 - React framework with App Router
  • Language: JavaScript (JSX)
  • Styling: Tailwind CSS 4 - Utility-first CSS framework
  • UI Components:
    • Radix UI - Accessible component primitives
    • Custom magic UI components (animated effects)
    • Lucide Icons - Beautiful icon library
  • Animations:
  • Notifications: Sonner - Toast notifications
  • QR Codes: QR code generation for credential sharing

Backend

  • Framework: Hono.js - Ultrafast web framework
  • Runtime: Node.js
  • Database: MongoDB with Mongoose ODM
  • Authentication: JWT (JSON Web Tokens)
  • File Upload: Multipart form data handling
  • Static Files: Serve uploaded credentials

Blockchain

  • Network: Polygon Amoy Testnet
  • Library: ethers.js v6 - Ethereum interaction library
  • Smart Contracts: Hardhat development environment
  • Hashing: SHA-256 cryptographic hashing
  • Storage Method: Transaction data field storage

DevOps

  • Package Manager: npm
  • Linting: ESLint
  • Build Tool: Next.js Turbopack
  • Version Control: Git

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         Frontend (Next.js)                       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”‚
β”‚  β”‚   Student    β”‚  β”‚  University  β”‚  β”‚   Validate   β”‚          β”‚
β”‚  β”‚  Dashboard   β”‚  β”‚  Dashboard   β”‚  β”‚     Page     β”‚          β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                  β”‚ API Calls (REST)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         Backend (Hono.js)                        β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  Routes: /api/student | /api/university | /api/credentialsβ”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”‚
β”‚  β”‚ Auth Middle- β”‚  β”‚   Models     β”‚  β”‚   Blockchain β”‚          β”‚
β”‚  β”‚    ware      β”‚  β”‚  (Mongoose)  β”‚  β”‚   Service    β”‚          β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                  β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚                   β”‚                   β”‚
         β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
         β”‚ MongoDB β”‚      β”‚   Polygon   β”‚   β”‚  File Storage  β”‚
         β”‚Database β”‚      β”‚  Blockchain β”‚   β”‚  (uploads/)    β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Data Flow

  1. Credential Issuance:

    University β†’ Upload Certificate β†’ Backend validates
    β†’ Generate SHA-256 hash β†’ Store in MongoDB
    β†’ Send hash to Polygon blockchain β†’ Return transaction hash
    β†’ Student receives credential
    
  2. Credential Verification:

    Verifier β†’ Upload/Scan Credential β†’ Backend retrieves hash
    β†’ Query blockchain for matching transaction
    β†’ Return verification status + blockchain proof
    

πŸš€ Getting Started

Prerequisites

  • Node.js >= 18.0.0
  • npm or yarn or pnpm
  • MongoDB (local or Atlas)
  • Polygon Amoy Testnet account with test MATIC

Installation

  1. Clone the repository

    git clone https://github.com/SiddDevZ/hashure-hackathon.git
    cd hashure-hackathon
  2. Install frontend dependencies

    npm install
  3. Install backend dependencies

    cd Backend
    npm install
    cd ..

Environment Variables

Backend (.env in Backend/ directory)

# Database
DATABASE_URL=mongodb://localhost:27017/hashure
# or MongoDB Atlas
# DATABASE_URL=mongodb+srv://username:password@cluster.mongodb.net/hashure

# Blockchain
POLYGON_AMOY_RPC_URL=https://rpc-amoy.polygon.technology/
PRIVATE_KEY=your_wallet_private_key_without_0x

# JWT Secret
JWT_SECRET=your_super_secret_jwt_key_here

# Server
PORT=3001

Frontend (update config.json in root directory)

{
  "backend_url": "http://localhost:3001",
  "frontend_url": "http://localhost:3000"
}

Running the Application

Development Mode

  1. Start the backend server

    cd Backend
    npm start

    Backend will run on http://localhost:3001

  2. Start the frontend (in a new terminal)

npm run dev

Frontend will run on http://localhost:3000

Production Build

  1. Build the frontend

    npm run build
    npm start
  2. Run the backend

    cd Backend
    npm start

πŸ“ Project Structure

hashure-hackathon/
β”œβ”€β”€ app/                          # Next.js App Router
β”‚   β”œβ”€β”€ layout.jsx               # Root layout
β”‚   β”œβ”€β”€ page.jsx                 # Landing page
β”‚   β”œβ”€β”€ globals.css              # Global styles
β”‚   β”œβ”€β”€ student/                 # Student routes
β”‚   β”‚   β”œβ”€β”€ login/              # Student login
β”‚   β”‚   β”œβ”€β”€ register/           # Student registration
β”‚   β”‚   └── dashboard/          # Student dashboard
β”‚   β”œβ”€β”€ university/             # University routes
β”‚   β”‚   β”œβ”€β”€ login/              # University login
β”‚   β”‚   β”œβ”€β”€ register/           # University registration
β”‚   β”‚   └── dashboard/          # University dashboard (issue credentials)
β”‚   └── validate/               # Public verification page
β”œβ”€β”€ components/                  # React components
β”‚   β”œβ”€β”€ Navbar.jsx              # Navigation bar
β”‚   β”œβ”€β”€ Footer.jsx              # Footer
β”‚   β”œβ”€β”€ Reviews.jsx             # Reviews section
β”‚   β”œβ”€β”€ FaqSection.jsx          # FAQ component
β”‚   β”œβ”€β”€ SmoothScrolling.jsx     # Smooth scroll wrapper
β”‚   β”œβ”€β”€ magicui/                # Animated UI components
β”‚   └── ui/                     # Reusable UI components
β”œβ”€β”€ lib/                        # Utilities
β”‚   β”œβ”€β”€ config.js               # Configuration loader
β”‚   └── utils.js                # Helper functions
β”œβ”€β”€ Backend/                    # Backend server
β”‚   β”œβ”€β”€ server.js              # Main server file (Hono.js)
β”‚   β”œβ”€β”€ models/                # MongoDB models
β”‚   β”‚   β”œβ”€β”€ Student.js         # Student schema
β”‚   β”‚   β”œβ”€β”€ University.js      # University schema
β”‚   β”‚   └── Credential.js      # Credential schema
β”‚   β”œβ”€β”€ routes/                # API routes
β”‚   β”‚   β”œβ”€β”€ studentAuth.js     # Student authentication
β”‚   β”‚   β”œβ”€β”€ universityAuth.js  # University authentication
β”‚   β”‚   └── credentialRoutes.js # Credential CRUD operations
β”‚   β”œβ”€β”€ middleware/            # Custom middleware
β”‚   β”‚   β”œβ”€β”€ studentAuthMiddleware.js
β”‚   β”‚   └── universityAuthMiddleware.js
β”‚   β”œβ”€β”€ utils/                 # Backend utilities
β”‚   β”‚   β”œβ”€β”€ blockchain.js      # Blockchain service (ethers.js)
β”‚   β”‚   └── tokenGenerator.js  # JWT token generation
β”‚   β”œβ”€β”€ uploads/               # Uploaded credential files
β”‚   └── package.json           # Backend dependencies
β”œβ”€β”€ scripts/                   # Utility scripts
β”‚   └── deploy.js             # Hardhat deployment script
β”œβ”€β”€ public/                    # Static assets
β”‚   β”œβ”€β”€ universities/          # University logos
β”‚   └── *.svg                 # Icons and images
β”œβ”€β”€ hardhat.config.js         # Hardhat configuration
β”œβ”€β”€ config.json               # App configuration (URLs)
β”œβ”€β”€ components.json           # shadcn/ui configuration
β”œβ”€β”€ tailwind.config.ts        # Tailwind CSS configuration
β”œβ”€β”€ next.config.mjs           # Next.js configuration
β”œβ”€β”€ package.json              # Frontend dependencies
└── README.md                 # This file

πŸ’‘ How It Works

1. University Issues Credential

sequenceDiagram
    University->>Backend: Upload certificate + student info
    Backend->>Backend: Generate SHA-256 hash
    Backend->>MongoDB: Store credential metadata
    Backend->>Polygon: Send transaction with hash
    Polygon-->>Backend: Transaction hash
    Backend-->>University: Credential issued βœ…
    Backend->>Student: Credential available in dashboard
Loading

2. Student Views & Shares Credential

  • Student logs in and sees all their credentials
  • Can generate QR code with credential slug
  • Can download credential as PDF/image
  • Shares QR code or link with recruiters

3. Recruiter Verifies Credential

sequenceDiagram
    Recruiter->>Frontend: Scan QR / Upload file
    Frontend->>Backend: Send credential identifier
    Backend->>MongoDB: Fetch credential metadata
    Backend->>Polygon: Search blockchain for hash
    Polygon-->>Backend: Transaction found/not found
    Backend-->>Frontend: Verification result + proof
    Frontend-->>Recruiter: Show verification status βœ… or ❌
Loading

Blockchain Storage Method

Hashure stores credential hashes in the transaction data field of Polygon transactions:

// Format: PROOFLY:hash:slug
data: ethers.toUtf8Bytes(`PROOFLY:${credentialHash}:${slug}`)

This approach:

  • βœ… Doesn't require smart contract deployment
  • βœ… Low gas fees (~$0.001 per transaction)
  • βœ… Immutable and tamper-proof
  • βœ… Publicly verifiable on blockchain explorers

πŸ“š API Documentation

Base URL

Production: https://api.siddz.com/hashure
Development: http://localhost:3001

Authentication

All authenticated routes require a JWT token in the Authorization header:

Authorization: Bearer <token>

Endpoints

Student Authentication

Register Student

POST /api/student/register
Content-Type: application/json

{
  "name": "John Doe",
  "email": "john@example.com",
  "password": "securepassword",
  "rollNumber": "2021CS001"
}

Response: { "token": "jwt_token", "student": {...} }

Login Student

POST /api/student/login
Content-Type: application/json

{
  "email": "john@example.com",
  "password": "securepassword"
}

Response: { "token": "jwt_token", "student": {...} }

Verify Token

POST /api/student/verify
Content-Type: application/json

{
  "token": "jwt_token"
}

Response: { "valid": true, "student": {...} }

University Authentication

Register University

POST /api/university/register
Content-Type: application/json

{
  "name": "Stanford University",
  "email": "admin@stanford.edu",
  "password": "securepassword"
}

Response: { "token": "jwt_token", "university": {...} }

Login University

POST /api/university/login
Content-Type: application/json

{
  "email": "admin@stanford.edu",
  "password": "securepassword"
}

Response: { "token": "jwt_token", "university": {...} }

Credentials

Issue Credential

POST /api/credentials/issue
Authorization: Bearer <university_token>
Content-Type: multipart/form-data

Fields:
- studentEmail: string
- credentialType: string
- file: File (PDF/Image)

Response: {
  "message": "Credential issued successfully",
  "credential": {...},
  "transactionHash": "0x..."
}

Get Student Credentials

GET /api/credentials/student
Authorization: Bearer <student_token>

Response: [
  {
    "id": "...",
    "credentialType": "Degree",
    "university": {...},
    "slug": "abc123",
    "fileUrl": "...",
    "blockchainHash": "0x...",
    "issuedAt": "..."
  }
]

Verify Credential

GET /api/credentials/verify/:slug

Response: {
  "valid": true,
  "credential": {...},
  "blockchainVerified": true,
  "transactionHash": "0x..."
}

Get University Issued Credentials

GET /api/credentials/university
Authorization: Bearer <university_token>

Response: [...]

🌐 Deployment

Frontend (Vercel)

  1. Push to GitHub
  2. Connect to Vercel
    • Import repository
    • Framework: Next.js
    • Build command: npm run build
    • Output directory: .next
  3. Add Environment Variables
    • Update config.json with production URLs
  4. Deploy πŸš€

Backend (VPS/Cloud)

  1. Setup server (Ubuntu recommended)

    sudo apt update
    sudo apt install nodejs npm nginx
  2. Clone and install

    git clone <repo>
    cd Backend
    npm install
  3. Configure environment

    nano .env
    # Add production environment variables
  4. Setup PM2 (process manager)

    sudo npm install -g pm2
    pm2 start server.js --name hashure-backend
    pm2 startup
    pm2 save
  5. Configure Nginx (reverse proxy)

    server {
        listen 80;
        server_name api.yourdomain.com;
        
        location / {
            proxy_pass http://localhost:3001;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection 'upgrade';
            proxy_set_header Host $host;
            proxy_cache_bypass $http_upgrade;
        }
    }
  6. SSL Certificate

    sudo apt install certbot python3-certbot-nginx
    sudo certbot --nginx -d api.yourdomain.com

🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch
    git checkout -b feature/AmazingFeature
  3. Commit your changes
    git commit -m 'Add some AmazingFeature'
  4. Push to the branch
    git push origin feature/AmazingFeature
  5. Open a Pull Request

Development Guidelines

  • Follow the existing code style
  • Write meaningful commit messages
  • Add comments for complex logic
  • Test your changes thoroughly
  • Update documentation if needed

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgments

  • Polygon for providing a fast and affordable blockchain infrastructure
  • Next.js team for an amazing React framework
  • Hono.js for a lightweight and fast backend framework
  • Radix UI for accessible component primitives
  • Tailwind CSS for utility-first styling
  • All open-source contributors who made this possible

πŸ“ž Contact

Developer: Siddharth
Project Link: https://hashure.siddz.com
GitHub: https://github.com/SiddDevZ/hashure-hackathon


🎯 Future Roadmap

  • Implement smart contracts for credential registry
  • Add support for multiple blockchain networks
  • Integrate IPFS for decentralized file storage
  • Add credential templates for different certificate types
  • Implement batch credential issuance
  • Add analytics dashboard for universities
  • Support for NFT-based credentials
  • Mobile app (React Native)
  • Integration with LinkedIn and other platforms
  • Multi-language support
  • Advanced permission management

Built with ❀️ by Siddharth

⭐ Star this repo if you find it helpful!