- Only educator can register certificates and issue certificates.
- The certificate which is to be issued, must be registered first.
- No single user can register twice.
- No hash of a certificate can exist more than one
There are 3 types of actors the system provides support to:
- Educator: This is the certifying authority, which registers new certificates, then issues the desired student that certificate.
- Student: This is the recipient of the certificate. It first registers itself in the system. He request for a certificate after a course is finished and the stored on-chain
- Verifier: This can be any anonymous user, who wants to verify the student's certificate.
Events are the logs of all the transactions done in the blockchain. So for every function of the smart contract, we log its details in events. Our system tracks these events:
- LogNewHashStored: Ths event is triggered when a hashed is stored on-chain. It logs details of every hash added to an address registered.
-
Issuing: This is the process of receiving and generating certificate hash on the ui. Certificate will be received from the frontend, a unique hash (ie that represents the fingerprint of the certificate) will be generated by the hash-generator function
-
After hash generation, a call to a function on the smart contract to ensure this hash is stored on the blockchain will be made
-
When this occurs, the UI also sends an email to the student with a hash of the certificate.
-
Sharing: this is the process by which the student of a certificate shares that certificate with a third-party.Simple way to share is that once given a hash to the student, the student can send his or her certificate to their verifier via mail
-
Verification: this is the process by which a third-party verifies the authenticity of the certificate.
-
Once the verifier receives the student certificate, they upload it to the UI for verification. The frontend calls on a function in the smart contract in order to verify that the hash was authenticated by the university.
-
The true/false boolean result is then displayed on the frontend, in the verifying window
-
- Get certificate data and sub-functions
-
- Verify certificate data and sub-functions.
-
- Manage key and sub-functions
-
- Integration with e-learning platform
-
- Manage wallet and sub-functions
-
- Deployment to permanent web server I will provide.
- Truffle - ( development framework for dapps based on the Ethereum blockchain: https://truffleframework.com/),
- Ganache - ( A personal blockchain for Ethereum development that can be used to deploy contracts, develop applications, and run tests: https://truffleframework.com/ganache),
- Solidity - (contract-oriented programming language for writing smart contracts: https://solidity.readthedocs.io/en/v0.4.24/),
- Web3.js - (Ethereum JavaScript API: https://github.com/ethereum/web3.js/)
- Truffle Contract -(Better Ethereum contract abstraction, for Node and the browser):https://www.npmjs.com/package/@truffle/contract
- MetaMask - (A browser plugin which allows users to make transactions to Ethereum or other networks through browsers, eliminating the need for dedicated user interfaces for Ethereum or other networks: https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn?hl=en)
- OpenZeppelin Contracts - OpenZeppelin Contracts is a library for secure smart contract development: https://github.com/OpenZeppelin/openzeppelin-contracts
- NodeJS - (An open source and cross-platform runtime environment for executing JavaScript code outside of a browser: https://nodejs.org/en/),
- Angular - (TypeScript-based open-source web application framework led by the Angular Team at Google and by a community of individuals and corporations: https://angular.io/).
- Run the command
npm install -g truffle
- Git clone the E-cert-Dapp repo
- Cd into the directory and run
yarn install
- Run
yarn run compile
to compile the smart contract - Run
yarn run migrate
to migrate the contract.truffle deploy
is an alias fortruffle migrate
. They both do the same thing. - Run
yarn run console
to interact with the smart contract on the ganache ethereum blockchain
- Go to https://truffleframework.com/ganache and download a version dedicated to your operating system.
- Install by a double click, then run.
- Ganache runs with default values which should be the same or similar to these on-screen. The crucial part is a section defining RPC Server.
- Leave it running.
- To download Nodejs, navigate to navigate to https://nodejs.org/en/download/ and click the version that suits your machine
- After downloading it, click the installer to get it installed on your machine
- Verify installation by running the command on your CLI
node -v
- You can use npm or yarn for package management
- Open a terminal and run:
truffle test or yarn run test
- Open a terminal and run:
truffle run coverage or yarn run coverage
- Open a terminal and run:
truffle run migrate or yarn run migrate
- Open a terminal and run:
truffle run ropsten or yarn run ropsten
- Open a terminal and run:
truffle run ropsten or yarn run ropsten
- Use Solidity Visual Developer to generate the graph for the contract
- Use Solidity Visual Developer to generate the UML with PlantUML embedded
-
This is the main contract. The contract handles the generation and verification of certificates as shown below.
-
storeHash() — generates a certificate by calculating a hash of the student name and details. Can be called only by the owner. Emits a certificate generation event with the timestamp. The issuer puts the certificate on the blockchain by storing it in the global variable records by passing records[certificate] = msg.sender.
-
owningAuthority() — returns the address of issuer/authority.
-
verifyCertificateData() — calculates a hash of the student name and details, and checks if the contract is on the blockchain. Can be called by anyone.
Since CertificateRegistry inherits from Ownable, Ownable will be deployed together with CertificateRegistry.
-
run
yarn console
in your Truffle console, create an instance of the deployed contract -
Declare the contract owner:
let instance = await CertificateRegistry.deployed()
-
Declare the contract owner:
let owner = await instance.owningAuthority()
-
Issue the certificate:
let result = await instance.storeHash("0x94f3e4c13989c51472ce78354b5205c5411f82e83c745b6f675e0c9aeb8ab4d1", {from: owner})
-
Run result.logs to view the full certificate details.
-
Run the certificate verification:
let verify = await instance.verifyCertificateData("0x94f3e4c13989c51472ce78354b5205c5411f82e83c745b6f675e0c9aeb8ab4d1", {from: owner})