abderox / e-certificate-signature-algorand

In this project we are aiming to put into action an e-certificate signature storage and validation dApp for education purpose.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Contributors Stargazers Issues MIT License


Logo Logo

E-CERTIFICATE

This project is a proof of concept for a digital certificate system using Algorand blockchain.
Explore the website »

Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Project Structure
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

Product Name Screen Shot Product Name Screen Shot 2

Our project is a proof of concept for a digital certificate system using Algorand blockchain. The main goal of this project is to provide a secure and reliable way to issue and verify digital certificates. The project is composed of two parts: the website and the blockchain. The website is used to issue and verify certificates. The blockchain is used to store the certificates and to verify the authenticity of the certificates.And this solution is unique because of several reasons:

Here's why:

  • We are trying to think outside the box by innovating a brand new E-Certificate solution, which will replace both automatic signature and traditional signature to introduce blockchain and web 3.0 in this product.

  • We are trying to solve the problem of certificate forgery by using blockchain technology.

  • In terms of performance and ease, adopting this solution will help university staff reduce the time spent signing and reviewing diplomas generated for thousands of students each year.


We are thriving to see the next generation of our major IRISI, for computer science and networking, to finish this piece of art with more features and a better user experience. And why not witnessing someday our University being the first to use this technology in the Kingdom of Morocco.

(back to top)

Built With

Here are the main technologies used in this project:

  • React
  • Material-ui
  • redux

  • Node.js
  • Express
  • MySQL

  • Algorand

  • npm
  • yarn

(back to top)

Getting Started

In this section, we will explain how to setup the project locally.

Prerequisites

You should have installed nodejs and npm on your machine. You can download them from here, and the versions used in this project are > 14.0 and > 8.0 respectively. or yarn

  • node

    node -v
  • npm

    npm -v
  • yarn

    yarn -v

The next thing to make sure you have is mysql or postgres installed in your machine . postgres v14 or mysql > 5

Installation

Below you will be instructed how to setup the project locally.Our project is divided into three parts

  • Frontend
  • Backend
  • Local-server

  1. Create a folder locally named e-certificate-fstg

  2. Clone the repo for frontend

    git clone https://github.com/abderox/e-certificate-signature-algorand
  3. Install NPM packages (If you are facing issues with npm , use yarn)

    npm install

    or

    yarn install
  4. Go to utils/global-constants.js and uncomment this line to work locally .

    //const BASE_URL_API = "http://127.0.0.1:7000/api";
    const BASE_URL_API = "https://thawing-lake-25095.herokuapp.com/api";
  5. Now clone the backend repository

    git clone https://github.com/kaoutar-ou/e-certificate-signature-algorand-backend
    - Note : the branch named mysql contains the backend project , the branch renowned local-server , contains the code for retrieving the mac address from your laptop (We will explain that later)
  6. Install NPM packages (ensure you are in the mysql branch)

    npm install

    or

    yarn install
  7. Go to config/db.js and change the database credentials to your local database credentials.

  8. copy .env.example to .env and change the database credentials to your local database credentials.

  9. Go to app.js and change force:false to force:true

    sequelize.authenticate().then(() => {
        console.log('Connected to database');
        sequelize.sync({ force: true }).then(() => {
        console.log('Database synchronized');
        initial();
        }
        );
        }).catch((error) => {
        console.error('Unable to connect to the database', error);
        });
    ! Note : this step is important because it will create the tables in your database . Do it once and make sure the tables have been created in your database . After that change force:true to force:false.  
    - In order to avoid dropping the tables each time you run the project
  10. Now switch to local-server (We prefer to open in a separate project , it should be running all the time )

+ Note : We prefer to use PM2 , so it could be running even after booting your laptop.
 
  
  • If you are good with node command go ahead
    node index.js

Example Usage


  • Install PM2

    npm install pm2 -g
  • Start the local-server

    pm2 start index.js
  • Check the logs

    pm2 logs
  • Stop the local-server

    pm2 stop index.js
  1. Database configuration

If you are using MySQL

  • Run mysql server in your XAMPP or WOMP server
  • Go to phpmyadmin
  • Create a database named what you have have called it in the .env file .

If you are using Postgres

  • Go to pgadmin
  • Create a database named what you have have called it in the .env file .
  1. Now you can run the project locally by running the following commands in three different terminals:

Run node backend server

    
    npm run start
     

Run react frontend server

    npm start

Run local-server

    pm2 start index.js or  node index.js

(back to top)

Usage

If everything is working fine , you should be able to see the following page :

HOME PAGE

Home Page

The first time running the project , make sure your tables are created successfully.

! Note : This may not be the last version of our database , it is just to make things evident as clear as day. the screenshot below was taken from pgAdmin.

Home Page

(back to top)

Structure

Backend

structure backend

  • app.js : The main file of the project , it contains the main logic of the project , it is the entry point of the project.

  • config : Contains the database configuration file

  • .env : contains environment variables for from database configuration to blockchain configuration .

  • controllers : Contains the controllers of the project , each controller is responsible for a specific common tasks. for example

    • auth.controller.js : Contains the logic of the authentication process , it is responsible for the login and register process.
    • process.controller.js : Contains the logic of the certificate process , it is responsible for the creation and verification process.
    • blockchain.controller.js : Contains the logic of the blockchain process , it is responsible for the blockchain creation and verification process.
  • middlewares : Contains the middlewares of the project , each middleware is responsible for a specific task . For instance

    • auth.js : Contains the logic of the authentication process , it is responsible for the login and register process.
    • upload.js : contains the logic of excel files uploading .
  • models : Contains the models of the project , each model is responsible for a specific task . Fo example

    • User.js : Contains the logic of the user model .
    • Etudaint.js : Contains the logic of the Etudaint model .
    • University.js : Contains the logic of the University model .
  • routes : Contains the routes of the project , each route is responsible for a specific task . For example .

    • algo.js : Contains the logic of the blockchain process .
    • process.js : Contains the logic of the certificate process , it is responsible for the creation and verification process.
  • utils : Contains the utils of the project , each util is responsible for a specific task . For example

    • user.js : Contains commonly used methods , like password or email generation .

  • index.js : Contains the logic of the certificate process pure methods , like QR generation , certificate generation .
    • canvas : Contains the templates for certificates (currently we are using the certif_7.png and certif_8.png)
    • index.hbs : is the default html template engine we have created to inject data (student information) dynamically into the certificate.
      • hbs : stands for handlebars

  • index.js : Nothing biggy , Only to make sure the user roles are created before registering new users.

Frontend

structure frontend

    • src : Contains the source code of the project , it is the entry point of the project.

        • Nothing doggy , it Contains the logic of communication with the server using REST API , thanks to axios lirary.
        • Contains the logic of the hooks , each hook is responsible for a specific task . For example *For this project luckily , there is only one simple hook , No need to disturb yourself with this folder 😉
        • Contains the logic of the layout , each layout is responsible for a specific task . like sidebar , profile section , wallet section ...
        • Just to make things clear and neat . Using the same menu component , we can specify for each actor (user with roles) , the authorized features and functionalities he is able to see and use . For example 🔽

      the super admin can create both admins and students so ⬇️ menu


      the admin can only create students ⬇️ menu

        • In this folder we have specified for each actor , the authorized paths he could access , depending on his roles.
        • This is easy to manipulate and modify , You need just to understand a bit the architecture we been following.
        • In this project we have been manipulating the concept of centralized store for state management and we have chosen Redux
        • The actions.js file contains all the constants for the actions .
        • The files which end with ***Action.js contains the logic of the action.js.
        • The files which end with ***Reducer.js contains the logic of the reducer.
        • reducer.js combine all the reducers of the application
        • index.js for store creation .
        • contains the reusable components like loaders , accordions , cards ...
        • Contains boiler-plate functions and global constants ...
        • Contains the views (pages ) it is what the end user see, (combines all of the components , actions , assets .. etc)

  • package.json : contains the dependencies of the project.

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/Enhancement)
  3. Commit your Changes (git commit -m 'Add some Enhancements')
  4. Push to the Branch (git push origin feature/Enhancement)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

gmail

linkedin

github

Project Links:

(back to top)

Acknowledgments

We would like to thank our (teacher| client) Mr. Omar Bencharef for his support and guidance throughout the project.

We acknowledge these following (open-source| free) use technologies for their contributions to the open source community.

And not to mention the special thanks for the outstanding community stackoverflow for its survival tips and guidance throughout this project.

(back to top)

About

In this project we are aiming to put into action an e-certificate signature storage and validation dApp for education purpose.

License:MIT License


Languages

Language:JavaScript 97.5%Language:SCSS 1.6%Language:HTML 0.9%