Skip to content

Hyperledger Fabric + Next js , a transparent way to register, check and vote on politic transactions

License

Notifications You must be signed in to change notification settings

SergioRCarvalho/PoliticaTransparente

Repository files navigation

PoliticaTransparente

The objective is to create a web application where we will have several users, these users can be anonymous in case they are not registered, citizen in case the user proceeds to register, if the user is created by the administrator, then the user is accredited which guarantees other privileges and finally the administrator for managing members. If the user has an account on the Platform, he can view the relationships and cast votes, otherwise he will only be able to view, if the user has privileges (is accredited), he can insert relationships.

Administrator

  1. Create users (administrator, politician and accredited user type);
  2. Consult users;
  3. Edit users;
  4. Delete users;
  5. Consult records;

Anonymous (unregistered citizen)

  1. Create account;
  2. Consult records.

Accredited user

  1. Register Entities (Politicians, Companies, …);
  2. Record relationships between entities (reasons, events, contract values, …);
  3. Consult relationships;
  4. Insert votes in the lists made (do not allow voting for the same).

Registered citizen

  1. Delete account (deactivate);
  2. Consult your own data;
  3. Edit your own data;
  4. Consult relationships;
  5. Insert votes in the relationships made.

Website:

Tools references:

The React Framework for Production, Vercel: https://nextjs.org/ A JavaScript library for building user interfaces, React: https://reactjs.org/ Simple, unobtrusive authentication for Node.js, Passaport.js: https://www.passportjs.org/ MongoDB is a document database designed for ease of development and scaling, MongoDB: https://www.mongodb.com/

Architecture

image

On Chain and Off Chain data

Imagem7

Security

Screenshot_2

Hyperledger Fabric Network Configuration

Hyperledger Fabric network:

References:

Creating a Hyperledger Fabric network from scratch — Part IV SDK and Rest API, Iván Alberquilla : https://medium.com/coinmonks/creating-a-hyperledger-fabric-network-from-scratch-part-iv-sdk-and-rest-api-29594e89fefa Hyperledger Fabric SDK for Node.js, Hyperledger: https://github.com/hyperledger/fabric-sdk-node  Configuração multi-organizacional microfab, IBM-Blockchain: https://github.com/IBM-Blockchain/microfab

Screenshot_3

hla

To configure our network, we enter the project directory through WSL and execute the following code.

export MICROFAB_CONFIG='{"port": 8080,"endorsing_organizations":[{"name": "Admin"},{"name": "Credenciado"},{"name": "Cidadao"},{"name": "Anonimo"}],"channels":[{"name":"mychannel","endorsing_organizations":["Admin","Credenciado","Cidadao","Anonimo"]}]}'

And then we create the image in Docker

docker run -e MICROFAB_CONFIG -p 8080:8080 ibmcom/ibp-microfab:0.0.11

The smart contracts can be fund on contract folder

Check the references above.

To run the next project:

Install project:

install nvm sudo apt install curl curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash

install node v12.13.1 install node v12.22.0 at least(need to run project) nvm install v12.13.1 nvm install v12.22.0

git clone https://github.com/SergioRCarvalho/PoliticaTransparente.git

open project

nvm use v12.13.0 npm install

now you can run project: npm use v12.22.0 next dev

Interfaces

Home page

Imagem8

Login

Imagem9

Recover password

Imagem10

Citizen registration

Imagem11

List of created relations

Imagem12

Vote registration, to cancel the vote the user needs to click again on the button

Imagem13

Search box with autocomplete

Imagem14

Relation details

Imagem15

Relation Comments

Imagem16

User profile part 1

Imagem17

User profile part 2

Imagem18

In case a user tries to vote without having an account

Imagem19

If a user tries to comment without having an account

Imagem20

If the user is accredited, he can add relationships from the FAB

Imagem21

In case the relationship belongs to the user accredited by editing or removing

Imagem22

Edit Relation

Imagem23

Remove Relation

Imagem24

Administrator page

Imagem25

User activity graphs

Imagem26

About

Hyperledger Fabric + Next js , a transparent way to register, check and vote on politic transactions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published