Skip to content

SouzaGabriel26/decentralized-student-identification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blockchain Student Identification, through smart contracts

This project implements a decentralized system for managing student identification cards using Ethereum smart contracts. The smart contract allows the owner (institution) to issue, invalidate, and extend student cards. It uses a mapping to associate each student’s public key with their identification card details, providing a secure, transparent, and immutable way to handle sensitive student data.

The student's card details are encrypted using the student's public key. This ensures that only the holder of the corresponding private key can decrypt and access the details, safeguarding the confidentiality of the information.

Content shortcuts

References

Stack

NextJS, @primer/react, ganache, prisma, Web3.js, Solidity.

Features (smart-contract based)

click to see smart-contract source code.

Issue Student Card:

  • The issueCard function allows the contract owner to issue a student card by providing a card hash, expiration date, and the student's public key. An event CardIssued is emitted once the card is successfully issued.

Get Student Card:

  • The getCard function allows anyone to retrieve the details of a student card using the student's public key. If no card is found, an error is thrown.

Invalidate Student Card:

  • The invalidateCard function marks a student card as invalid, preventing further use. This can only be done by the contract owner, and an event CardInvalidated is emitted.

Extend Card Expiration:

  • The extendCardExpiration function extends the expiration date of an existing student card, ensuring that the new expiration date is greater than the current one. An event CardExpirationExtended is emitted.

Demonstrations

Flowchart showing how the project is structured

User Registering

01-register-flow.webm

Admin rejecting user's request

02-admin-reject-user-flow.webm

Admin approving user's request

03-admin-approve-user-flow.webm

Admin extending user's card expiration time

04-admin-extend-expiration-time.webm

Admin invalidatin user's card

05-admin-invalidate-user-card.webm

User decrypting card

06-user-decrypting-card.webm

User forgot private key

07-user-forgot-private-key.webm

How to run

ATTENTION: To run this project locally, you must have docker installed on your machine.

First, create a .env file based on .env.example

cp .env.example .env

⚠️ To run the project with all the features, you would need a lambda function using the presigned urls strategy. And then add the function_url to LAMBDA_FUNCTION_URL env. If you really want to run the project, contact me.

The lambda function structure can be followed here.

If you are running the project for the first time, paste this command into your terminal:

pnpm project:setup
  • This command will:
    1. install project dependencies;
    2. compose up docker conteiner;
    3. wait for the conteiner up;
    4. run migrations.

To run the project, paste this command into your terminal:

pnpm dev:all
  • This command will:
    1. start ganache local server (concurrently in terminal)
    2. deploy the smart contract on ganache local server (it will save the contract address in a file)
    3. compose up docker conteiner;
    4. wait for conteiner;
    5. run the development server.

Author

About

Decentralized student ID system using Ethereum smart contracts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published