This project is a blockchain-based credential management system that uses ERC721 NFTs to represent academic certificates. The smart contract is implemented with Hardhat and OpenZeppelin libraries, and the frontend is built with Thirdweb for seamless interaction with the blockchain.
- Mint Academic Credentials: Institutions can mint NFTs representing academic credentials.
- Role-based Access Control: Granular permissions using OpenZeppelin's
AccessControl
. - Pause/Resume Contract: Ability to pause contract operations during emergencies.
- Expiration Tracking: Manage certificates with expiration dates.
- Frontend Integration: User-friendly interface powered by Thirdweb.
flowchart TD
A[admin]
B[moderator]
C[institute]
D[student]
E["Any account"]
subgraph Roles & Functionality
A --> F["Register Moderator
Revoke Moderator"]
B --> G["Register Institute
Revoke Institute"]
C --> H["Issue Credential
Revoke Credential
List all issued credentials"]
D --> I["View all owned credentials"]
D --> K["accept/reject document for verification"]
E --> J["verify credential
verify signature"]
E --> L["request document for verification"]
end
sequenceDiagram
autonumber
participant Client
participant GoGinAPI
participant Redis
participant PostgreSQL
Client->>GoGinAPI: GET /v1/auth/generate-nonce
GoGinAPI->>Redis: Store nonce with wallet address
Redis-->>GoGinAPI: Nonce stored
GoGinAPI-->>Client: Respond with nonce
Client->>Client: Sign nonce with Web3 wallet
Client->>GoGinAPI: Request with signed nonce in header
GoGinAPI->>Redis: Retrieve nonce for wallet
Redis-->>GoGinAPI: Return nonce
GoGinAPI->>GoGinAPI: Verify digital signature
alt Signature valid
GoGinAPI->>Redis: Create and store session
Redis-->>GoGinAPI: Session stored
GoGinAPI-->>Client: Respond with session ID
else Signature invalid
GoGinAPI-->>Client: Respond with error
end
Note over Client,GoGinAPI: User authenticated
alt Accessing /v1/requests/create or /v1/requests/respond
alt No valid session
Client->>GoGinAPI: GET /v1/auth/generate-nonce
GoGinAPI->>Redis: Store new nonce with wallet address
Redis-->>GoGinAPI: Nonce stored
GoGinAPI-->>Client: Respond with new nonce
Client->>Client: Sign new nonce with Web3 wallet
Client->>GoGinAPI: Request with newly signed nonce in header
GoGinAPI->>Redis: Retrieve new nonce for wallet
Redis-->>GoGinAPI: Return new nonce
GoGinAPI->>GoGinAPI: Verify new digital signature
GoGinAPI->>Redis: Create and store new session
Redis-->>GoGinAPI: New session stored
end
alt Accessing /v1/requests/create
Client->>GoGinAPI: POST /v1/requests/create
GoGinAPI->>PostgreSQL: Perform requested operation
PostgreSQL-->>GoGinAPI: Operation result
GoGinAPI-->>Client: Respond with result
else Accessing /v1/requests/respond
Client->>GoGinAPI: POST /v1/requests/respond
GoGinAPI->>PostgreSQL: Perform requested operation
PostgreSQL-->>GoGinAPI: Operation result
GoGinAPI-->>Client: Respond with result
end
else Accessing other routes
Client->>GoGinAPI: Request with session ID
GoGinAPI->>Redis: Verify session
Redis-->>GoGinAPI: Session valid
GoGinAPI->>PostgreSQL: Perform requested operation
PostgreSQL-->>GoGinAPI: Operation result
GoGinAPI-->>Client: Respond with result
end
Note over GoGinAPI,PostgreSQL: Handle automatic expiry
GoGinAPI->>PostgreSQL: Query expired requests periodically
PostgreSQL-->>GoGinAPI: Return expired requests
GoGinAPI->>PostgreSQL: Update expired requests to "revoked"
PostgreSQL-->>GoGinAPI: Update successful
- Node.js: Download here.
- Golang: For backend off-chain server
- Hardhat: For smart contract development.
- Thirdweb SDK: For frontend blockchain interactions.
Install dependencies:
npm install
-
Clone the repository:
git clone https://github.com/Saurav-Navdhare/NFT-CredentialManagementSystem cd NFT-CredentialManagementSystem
-
Install Hardhat:
npm install --save-dev hardhat
-
Compile the smart contract:
npx hardhat compile
-
Deploy the contract:
npx hardhat run scripts/deploy.js --network <network-name>
-
Verify the deployment:
npx hardhat verify <contract-address> --network <network-name>
-
Install the all dependencies:
npm install
-
Start the development server:
npm run start
-
Update the contract address in the frontend env file:
CONTRACT_DEPLOYED_ADDRESS= "<deployed-contract-address>";
- Connect as an authorized institution.
- Provide student details, expiration dates, and IPFS hash of credentials.
- Submit the transaction to mint a credential NFT.
- Connect as a student or verifier.
- View issued credentials along with their status (VALID, REVOKED).
- Networks: Configure networks in
hardhat.config.js
. - Environment Variables:
Create a
.env
file with:
VITE_PUBLIC_THIRDWEB_CLIENT_ID=
VITE_PINATA_API_KEY=
VITE_PINATA_API_KEY=
VITE_PINATA_JWT=
GANACHE_PRIVATE_KEY=
CARADONA_PRIVATE_KEY=
CONTRACT_DEPLOYED_ADDRESS=
- AccessControlUnauthorizedAccount: Ensure the correct role is assigned for the attempted action.
- Add email notifications for certificate expiration.
- Enable on-chain revocation alerts.
This project is licensed under the MIT License. See LICENSE
for details.
- OpenZeppelin for secure smart contract libraries.
- Thirdweb for easy blockchain integration.
- Hardhat for powerful development tools.