Skip to content

18121A05L2/aicerts-solana-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AICerts β€” Solana-Based Credential Issuance Platform

A decentralized credential management system built on Solana blockchain that enables secure issuance, storage, and verification of digital certificates.

πŸ“‹ Table of Contents

🎯 Overview

AICerts is a hybrid on-chain/off-chain credential issuance platform that leverages Solana's blockchain for immutable proof storage while maintaining cost efficiency by storing detailed metadata off-chain in MongoDB.

Live Website: https://frontend-aicerts-solana-project.vercel.app/

Smart Contract Address: EtcxZLVKnZBwHsMgFt8kuAZ3eenMgcZi5YWSNGmJYxDA

πŸ— Architecture

Hybrid Design Philosophy

On-Chain Storage (Solana PDA)

  • Credential hash (32 bytes)
  • Owner public key
  • Credential ID (PDA public key)

Off-Chain Storage (MongoDB)

  • Complete metadata JSON
  • Template ID
  • Logo & signature (base64/URL)
  • Transaction signature
  • Issuer public key
  • Issue date & expiry
  • Shareable link

Why Hybrid?

  • βœ… Cost-effective (on-chain storage is expensive)
  • βœ… Immutable proof on blockchain
  • βœ… Flexible metadata management
  • βœ… Efficient verification via hash comparison

System Flow

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Issuer Dashboard    β”‚
β”‚ (Create Templates)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
            β”‚ POST Template
            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Backend (Express + Mongo) β”‚
β”‚ Store Templates/Metadata  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
            β”‚ Issue Credential
            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Backend Solana Service    β”‚
β”‚ β€’ Hash metadata           β”‚
β”‚ β€’ Derive PDA              β”‚
β”‚ β€’ Submit transaction      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚
           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Solana Blockchain   β”‚
β”‚ Store hash + owner   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚
           β”‚ Verification
           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Recipient View UI   β”‚
β”‚ Verify credentials   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ›  Tech Stack

Layer Technology
Frontend React + Vite + TypeScript
Backend Node.js + Express.js
Database MongoDB (Mongoose)
Blockchain Solana + Anchor Framework
Hashing SHA-256 (js-sha256)
Wallet Integration Phantom / Solana Web3.js
Smart Contract Deployment Solana Devnet
Application Deployment Vercel

FrontEnd ( React + TypeScript)

  cd frontend
  npm install
  npm run dev

solana ( Anchor Framework )

  • Init :: anchor init solana

  • To Build :: anchor build

  • IDL (Interface Description Language) - target/idl/solana.json

backend (Node.js + Express + MongoDB)

  • INIT :: npx express-generator-typescript backend

  • TO run Locally ::

cd backend
npm install
npm run dev:hot
  • APIS

    • /api/templates - POST call to create a template
    • /api/templates - GET call to get all the available templates
    • /api/credentials - POST call to store metadata
    • /api/credentials - GET call to fetch all the credentials issued
    • /api/credentials/by-name - POST call to fetch credentials based on Recipient Name
    • /api/credentials/verify/:credentialId - GET call to verify the certificateId/credentialId issued on solana

πŸ“ Project Structure

aicerts-solana-project/
β”‚
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ controllers/      # Request handlers
β”‚   β”‚   β”œβ”€β”€ models/            # MongoDB schemas
β”‚   β”‚   β”œβ”€β”€ routes/            # API routes
β”‚   β”‚   β”œβ”€β”€ services/          # Business logic
β”‚   β”œβ”€β”€ .env
β”‚   └── package.json
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/        # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ pages/             # Application pages
β”‚   β”‚   β”œβ”€β”€ idl/solana.json    # Program interface
β”‚   β”‚   └── utils/             # Helper functions
β”‚   └── package.json
β”‚
└── programs/
    └── solana/
        β”œβ”€β”€ src/lib.rs         # Solana program code
        β”œβ”€β”€ Cargo.toml
        └── Anchor.toml

πŸš€ Getting Started

Prerequisites

  • Node.js (v16 or higher)
  • Solana CLI
  • Anchor Framework
  • MongoDB
  • Phantom Wallet

Frontend Setup

cd frontend
npm install
npm run dev

The application will be available at http://localhost:5173

Backend Setup

cd backend
npm install
npm run dev:hot

The API server will start on the configured port.

Solana Program

cd programs/solana
anchor build

The compiled IDL will be available at target/idl/solana.json

Features

1. Issuer Dashboard

Route: /createTemplate

Create custom certificate templates with:

  • Dynamic field management (add/edit/delete)
  • Logo and signature upload
  • Real-time certificate preview
  • Template persistence to MongoDB

Issuer Dashboard

2. Issue Credential Screen

Route: /issueCredential

Issue credentials with the following workflow:

  • Select from existing templates
  • Fill credential-specific fields
  • Connect issuer wallet
  • Backend generates metadata hash
  • PDA derived using: [metadata_hash + issuer_pubkey]
  • Hash and owner stored on-chain
  • Complete metadata stored off-chain

Issue Credential

3. Recipient View

Route: /recipientView

Recipients can:

  • View all issued credentials
  • Display certificates in styled format
  • Generate shareable credential links

Recipient View

4. Verification Flow

Route: /verification

Verify credentials through:

  1. Enter credential ID
  2. Fetch PDA account from blockchain
  3. Retrieve stored metadata from backend
  4. Compare hashes
  5. Display result: VALID or INVALID

Verification

πŸ“‘ API Documentation

Templates

Create Template

POST /api/templates
Content-Type: application/json

{
  "name": "Template Name",
  "fields": [...],
  "logo": "base64_string",
  "signature": "base64_string"
}

Get All Templates

GET /api/templates

Credentials

Store Credential Metadata

POST /api/credentials
Content-Type: application/json

{
  "templateId": "...",
  "metadata": {...},
  "issuerPublicKey": "...",
  "txSignature": "..."
}

Get All Credentials

GET /api/credentials

Get Credentials by Recipient Name

POST /api/credentials/by-name
Content-Type: application/json

{
  "recipientName": "John Doe"
}

Verify Credential

GET /api/credentials/verify/:credentialId

⚑ Solana Program

Program Details

Program ID: EtcxZLVKnZBwHsMgFt8kuAZ3eenMgcZi5YWSNGmJYxDA

Instruction: createCredential

Purpose: Store credential hash and owner in a Program Derived Address (PDA)

PDA Generation

Seeds: ["credential", owner_pubkey, credential_hash]

Stored Fields:

pub struct Credential {
    pub credential_hash: [u8; 32],
    pub owner: Pubkey,
}

Returned Value: PDA public key serves as the credentialId

Frontend-Blockchain Interaction

Issuance Flow (Backend)

  1. Receive metadata JSON
  2. Generate hash: sha256(JSON.stringify(metadata))
  3. Derive PDA using seeds
  4. Call createCredential instruction
  5. Store metadata in MongoDB
  6. Return credentialId to frontend

Verification Flow (Frontend)

  1. Fetch metadata from backend API
  2. Fetch PDA account from Solana
  3. Hash the retrieved metadata
  4. Compare with account.credentialHash
  5. Result: VALID (if equal) or INVALID (if different)

πŸŽ₯ Demo

Watch the full platform demonstration: Demo Video

πŸ“ Additional Resources

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“„ License

This project is open source and available under the MIT License.


Built with ❀️ using Solana, React, and Node.js

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published