Skip to content

Latest commit

 

History

History
150 lines (98 loc) · 9.03 KB

README.md

File metadata and controls

150 lines (98 loc) · 9.03 KB

Quick intro

landCertificate is a Hyperledger blockchain admin/client land certficate requester application built on top of Hyperledger where clients request a land certificate to a land conserver(admin) who will deliver the certificate. Online mongoDB-atlas is used to store clients' resquests, which are displayed in the admin panel.

A blockchain network that let's land conservers add its certificates in the blockchain, which can help against land ownership issues and problems.

The network was built using Hyperledger Fabric V2.X.X and the test were made on Linux/Debian 10 Buster, WSL/Debian 10 Buster and WSL/Ubuntu machines but should work on any given OS.

The web app is built with NodeJS, ExpressJS, REST API and pug template engine as a render for the front-end.

Configuration and running

NB: Having docker installed in one's OS is a MUST.

TL;DR : if you are familiar with hyperlegder fabric and have everything needed for it to run set up, move to landcertificate-network/landcertificate-starter/ and run & execute the network.

If you have never dealth with Hyperledger Fabric before, then you might want to grab the version that suits well this project.
Download the sources of fabric-samples version-2.0.0 repository or grab them from my fabric-sample 2021's fork and do the following:

landCertificate is built on top of Hyperledger Linux foundation, thus it's a must to install and configure Hyperledger first.

Hyperledger installation and configuration

Prerequisites:

  • Install and configure Docker (tons of tutorial on the web, )
  • Install curl (sudo apt update && sudo apt upgrade then sudo apt install curl on linux machine)

Hyperledger:

landCertificate, installation and running

Now how so we start our HL network and get our web app running?

First and foremost, download or clone this repo.
Repo structure:

  • landcertificate-network/_ : contains our full blockchain application. It contains our config files, crypto materials, starter-app, chaincode ... etc.

As Hyperledger has changed fabric_samples folder content and structure, landcertificat-network/ has the necerssary binaries and tools- to build and run up our netwrork. Its content could also be found in the original fabric-samples version-2.0.0 repository or grab them from my fabric-sample 2021's fork

  • landcertificate-network/test-network/add_path_org1.sh : a custom script that adds peer cli, peer and fabric config related path with org1's environment variables.
    Copy this file (test-network/add_path_org1.sh) to fabric-samples/test-network.

  • landcertificate-network/chaincode/landcertificate/: contains our smart contract code (javascript/, java/) which will be packaged (chaincode), installed and committed to corresponding peers.
    Copy the folder chaincode/landcertificate/ to fabric-samples/chaincode_.
    Open terminal and run npm install to install packages.

  • landcertificate-network/certificate-starter/ : contains our client application and is the starting point of our application.

    • startBcLand.sh is the script that is going to start our network, bringing up HL docker images, creating channel, packaging, installing and deploying our chaincode.
      Note : We're deploying our chaincode by nitializing the ledger which consists of requesting and invoking a chaincode initialization function (initLedger).
      Check the flag cci in ./network.sh deployCC -ccn certificate -ccv 1 -cci initLedger
      If you don't want to initialize the ledger, remove -cci initLedger from startBCertificate.sh

    • networkDown.sh will bring down our network, thus stopping running docker containers.
      Note: If you're restarting the netowrk, you'll probably want to manually remove the chaincode docker volumes as they'll create conflict. (docker volumes prune would remove all your docker volumes)

    • javascript/ is where we're going to enroll ou admin, registrer our user (so he/she can run transactions against the network by invoking the chaincode) and querying the ledger to get added certificates as we've deployed our chaincode while initializing it.
      Run npm install before using any scripts.

    • java/ same as javascript/, contains our administration scripts. Not fully implemented and neither fully tested.

    • apiserver/ is our nodeJS application. It contains same administration scripts in javascript/ and more.
      Run npm install before using any enrolling admin, registering the user and invoking transactions.

    • Copy landcertificate-network/certificate-starter/ to fabric-samples/

Run & Execute Certificate

Now that we went through all the folder and script let's see how we to start the app step by step :

  • Make sure you are in landcertificate-network/landcertificate-starter run the following commands on your terminal:

Front-end views:

ADMIN's views

Certified lands

http://localhost:8080/api/admin/index

alt text

Adding new Land Certficate

http://localhost:8080/api/admin/addland

alt text

Client's views

Request a certificate form

http://localhost:8080/client/index

alt text

Form filled

alt text

Form submitted

alt text

Admin got the request

alt text

After validation, our land is certified in the blockchain alt text

Added certificate with it QR Code

alt text alt text

BLOCKCHAIN DIPLOMAS CERTIFICATE SYSTEM MANAGEMENT

If you find interest in this project.
You might also look at a similar project that automates the issuance, dispatch, and management of university's digital credentials (diplomas, skills, transcripts, degree certifications, etc) here.

Once again the main idea was to get familiar with how Hyperledger Fabric build and handles blockchain rahter than the user application and user experience.

Contributions, remarks & questions

Please contact me by email in case you've got questions, remarks, ... regarding the project.
Feel free to contribute by creating an issue and/or a pull request.
The main focus was on getting familiar with Hyperledger and its different ways of building blockchain solutions.

Author

AL-FAHAMI TOIHIR

Licence:

Shield: CC BY 4.0

This work is licensed under a Creative Commons Attribution 4.0 International License.

CC BY 4.0