Coder Social home page Coder Social logo

tassiluca / chainvote Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 30.59 MB

Distributed Systems + Application and Web Services final project @ UniBo

Shell 6.48% Dockerfile 0.25% JavaScript 0.19% TypeScript 37.66% CSS 0.03% Java 40.39% HTML 0.06% Vue 14.76% SCSS 0.18%

chainvote's Introduction

Distributed Systems + Applications and Web Services Final Project @ UniBo

Abstract | Requirements | Startup | Docs | Develop | Troubleshooting | Authors

Abstract

Electronic voting systems based on blockchain technology have emerged as a potential solution to enhance the security and transparency of traditional voting methods. In this system, voters cast their votes electronically, and the results are stored on a decentralized blockchain ledger, which ensures the integrity of the vote by preventing any tampering or manipulation. This system provides a transparent and immutable record of votes, which can be accessed by anyone in the network, thus increasing trust in the electoral process. Nevertheless, the use of blockchain technology in electronic voting systems holds promise for creating a more secure, transparent, and democratic electoral process.

The project consists of the implementation of a small-scale distributed electronic voting system based on blockchain technology. Specifically, the goal is to create a distributed architecture that exposes a uniform API allowing users to interact with the system using a web application.

Warning: This repository is part of an academic project developed for the course in Distributed Systems and Application and Web Services @ UniBo. It is intended for educational purposes and may not be suitable for production use.

Requirements

  • Unix system (either Linux or MacOS)
  • Docker
    • on Mac OS make sure the file sharing implementation for the container is set to osfx (Legacy) (in Settings -> General)
  • Java 11 or higher
  • Node.js 18 or higher
  • npm

Startup


Important

For security reasons the password for using the mailer is not stored in the repository, but it is passed to the container using a docker secret. Before starting up the system, it’s necessary to create a password file, at the position defined in the secrets section of the docker-compose.yaml file:

secrets:
  google_api_secret:
    file: ~/secrets/api-pass.txt

It is also possible to specify the mail address that will be used to send the emails by changing the MAIL ADDRESS environment variable on the api-server service:

environment:
  ...
  - [email protected]
  ...

To bring up the blockchain network, deploy the smart contracts on top of the peers, start the API services and the frontend web app you can use the services.sh script on the root of the project.

To bring up all the system's services:

./services up

Since the first time it will pull Hyperledger Fabric binaries and docker images to create blockchain artifacts and start API services, it will take a while to bring up the entire system.


While it reaches the API server creation phase, the script will execute the npm login command. We've preconfigured some default credentials for this purpose; these should be used when login request is prompted:

  • username: user
  • password: password

During the startup phase of the API layer, the script will require the sudo privileges in order to ensure that the verdaccio, cache and dbdata folders have write and read permissions, which are needed on Linux environment.


The full working system consists of 33 containers: one for each peer and chaincode deployed on it, five containers for the API services and one for the frontend web app.

To bring them down without cleaning the blockchain artifacts (it will speed up the creation of the network next times):

./services down

To clean network artifacts:

./services clean

For more details have a look at the project documentation.

Documentation

Develop

To clone the project:

git clone --recurse-submodules <URL> <DESTINATION>

If the repository has been cloned plainly, then submodules can be initialized manually:

git submodule update --init --recursive

Troubleshooting

If you are encountering issues or observing unexpected behavior during the deployment, this troubleshooting guide is designed to assist you in identifying and resolving common problems.

  • Linux/MacOS: [common.tools.configtxgen] main -> Error on outputBlock: could not create bootstrapper: could not create channel group ...: open /Projects/distributed-systems/ds-project/chain-vote/blockchain/../.chainvote/blockchain/org0/orderer1/tls-msp/signcerts/cert.pem: no such file or directory

    A similar error occurs the next time a problem arises during the creation of channel artifacts because it tries to get some files inside the artifacts folder but, since the previous deployment failed, those files don't exist. Cleaning the artifacts with ./services clean should solve the problem.

  • MacOS: resource management

    On MacOS systems make sure to increase allocated resources in Docker Desktop, particularly for CPU and memory limit (8GBs are enough).

  • MacOS: Error response from daemon: cannot stop container: <container-id>: tried to kill container, but did not receive an exit event

    Sometimes happens that, when the services are torn down (with ./services down or ./services clean), one Hyperledger CA container remains hanging. Restarting Docker Desktop solves this issue.

  • MacOS: container peer1-org2 is unhealthy

    If, during the deployment of the network, the shown message (or a similar one) appears on a MacOS host, make sure the file-sharing implementation for the containers in Settings -> General is set to osxfs (Legacy).

  • MacOS/Linux: General build failure

    While the system is starting up docker will cache lots of data that is used in the various building phases. This could lead to a general build failure in future runs. Is possible to try these solutions for solving the problems:

    • docker builder clean to clean the docker cache;
    • Delete dangling images and volumes;
    • Restart docker engine;

Authors

  • Luca Tassinari
  • Luca Rubboli
  • Giovanni Antonioni

chainvote's People

Contributors

tassiluca avatar giovaz94 avatar luca1313 avatar renovate[bot] avatar

Stargazers

gitizenss avatar Mattia Matteini avatar  avatar ms.shim avatar

Watchers

 avatar  avatar

chainvote's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update danysk/action-checkout action to v0.2.17
  • chore(deps): update danysk/compile-and-publish-all-latex action to v2.0.26
  • chore(deps): update dependency @tsconfig/node18 to v18.2.4
  • chore(deps): update dependency @types/jquery to v3.5.30
  • chore(deps): update dependency @types/node to v18.19.33
  • chore(deps): update dependency @vue/test-utils to v2.4.6
  • chore(deps): update dependency axios to v1.6.8
  • chore(deps): update dependency font-awesome to v6.5.2
  • chore(deps): update dependency npm-run-all2 to v6.1.2
  • chore(deps): update dependency prettier to v3.2.5
  • fix(deps): update dependency bootstrap to v5.3.3
  • fix(deps): update dependency chart.js to v4.4.2
  • fix(deps): update dependency com.github.spotbugs:spotbugs-annotations to v4.8.5
  • fix(deps): update dependency org.assertj:assertj-core to v3.25.3
  • fix(deps): update dependency socket.io-client to v4.7.5
  • fix(deps): update dependency vee-validate to v4.12.8
  • fix(deps): update dependency vue to v3.4.27
  • fix(deps): update dependency vue-chartjs to v5.3.1
  • fix(deps): update dependency vue3-carousel to v0.3.3
  • fix(deps): update font awesome (@fortawesome/fontawesome-svg-core, @fortawesome/free-brands-svg-icons, @fortawesome/free-regular-svg-icons, @fortawesome/free-solid-svg-icons, @fortawesome/vue-fontawesome)
  • fix(deps): update junit5 monorepo to v5.10.2 (org.junit.jupiter:junit-jupiter-engine, org.junit.jupiter:junit-jupiter-api)
  • chore(deps): update dependency @rushstack/eslint-patch to v1.10.2
  • chore(deps): update dependency eslint to v8.57.0
  • chore(deps): update dependency eslint-plugin-vue to v9.26.0
  • chore(deps): update dependency gradle to v8.7
  • chore(deps): update dependency sass to v1.77.0
  • chore(deps): update dependency sass-loader to v14.2.1
  • chore(deps): update dependency typescript to ~5.4.0
  • chore(deps): update dependency vite to v5.2.11
  • chore(deps): update dependency vitest to v1.6.0
  • chore(deps): update gohugoio/hugo action to v0.125.7
  • chore(deps): update nginx docker tag to v1.26.0
  • chore(deps): update plugin java-qa to v1.50.0
  • fix(deps): update dependency com.google.guava:guava to v33.2.0-jre
  • fix(deps): update dependency org.mockito:mockito-core to v5.11.0
  • fix(deps): update dependency vue-router to v4.3.2
  • fix(deps): update dependency yup to v1.4.0
  • fix(deps): update log4j2 monorepo to v2.23.1 (org.apache.logging.log4j:log4j-slf4j-impl, org.apache.logging.log4j:log4j-core, org.apache.logging.log4j:log4j-api)
  • chore(deps): update dependency @vitejs/plugin-vue to v5
  • chore(deps): update dependency @vue/eslint-config-prettier to v9
  • chore(deps): update dependency @vue/eslint-config-typescript to v13
  • chore(deps): update dependency eslint to v9
  • chore(deps): update dependency jsdom to v24
  • chore(deps): update dependency supertest to v7
  • chore(deps): update dependency vue-tsc to v2
  • chore(deps): update peaceiris/actions-gh-pages action to v4
  • fix(deps): update dependency org.json:json to v20240303
  • 🔐 Create all rate-limited PRs at once 🔐

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

docker-compose
api-service/docker-compose.yaml
  • mongodb/mongodb-community-server 4.4.12-ubi8
  • verdaccio/verdaccio 5
  • redis 7.2-alpine
blockchain/docker-compose.yaml
  • couchdb 3.3.3
  • couchdb 3.3.3
  • couchdb 3.3.3
  • couchdb 3.3.3
  • couchdb 3.3.3
frontend/docker-compose.yml
dockerfile
api-service/api/Dockerfile
  • node 20-alpine
  • node 20-alpine
api-service/auth/Dockerfile
  • node 20-alpine
  • node 20-alpine
frontend/Dockerfile
  • node 21-alpine
  • nginx 1.25.3-alpine
github-actions
.github/workflows/build-and-deploy-smart-contracts.yml
  • actions/checkout v4
  • actions/setup-java v4
  • actions/checkout v4
.github/workflows/compile-report.yaml
  • DanySK/compile-and-publish-all-latex 2.0.6
.github/workflows/deploy-documentation.yml
  • danysk/action-checkout 0.2.14
  • actions/setup-java v4
  • gohugoio/hugo v0.122.0
  • Legion2/swagger-ui-action v1
  • Legion2/swagger-ui-action v1
  • peaceiris/actions-gh-pages v3
gradle
smart-contracts/settings.gradle.kts
smart-contracts/build.gradle.kts
smart-contracts/chaincode-commons/build.gradle.kts
smart-contracts/chaincode-elections/build.gradle.kts
smart-contracts/chaincode-votes/build.gradle.kts
smart-contracts/core/build.gradle.kts
smart-contracts/gradle/libs.versions.toml
  • org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim 2.5.0
  • com.owlike:genson 1.6
  • org.json:json 20231013
  • org.apache.commons:commons-lang3 3.14.0
  • com.google.guava:guava 33.0.0-jre
  • org.junit.jupiter:junit-jupiter-api 5.10.1
  • org.junit.jupiter:junit-jupiter-engine 5.10.1
  • org.assertj:assertj-core 3.25.2
  • org.mockito:mockito-core 5.10.0
  • com.github.spotbugs:spotbugs-annotations 4.8.3
  • org.apache.logging.log4j:log4j-api 2.22.1
  • org.apache.logging.log4j:log4j-core 2.22.1
  • org.apache.logging.log4j:log4j-slf4j-impl 2.22.1
  • org.danilopianini.gradle-java-qa 1.36.0
  • com.github.johnrengelman.shadow 8.1.1
smart-contracts/presentation/build.gradle.kts
gradle-wrapper
smart-contracts/gradle/wrapper/gradle-wrapper.properties
  • gradle 8.5
html
docs/presentation/layouts/partials/reveal-hugo/head.html
  • font-awesome 6.5.1
npm
api-service/api/package.json
  • @hyperledger/fabric-gateway ^1.3.1
  • accesscontrol ^2.2.1
  • bcrypt ^5.1.0
  • body-parser ^1.20.2
  • express ^4.18.2
  • express-validator ^7.0.1
  • http-status-codes ^2.2.0
  • luxon ^3.4.4
  • mongoose ^7.4.3
  • nodemailer ^6.9.8
  • redis ^4.6.8
  • socket.io ^4.7.4
  • @tsconfig/node16 ^1.0.3
  • @types/bcrypt ^5.0.0
  • @types/express ^4.17.17
  • @types/jest ^29.5.5
  • @types/luxon ^3.3.3
  • @types/node ^14.18.54
  • @typescript-eslint/eslint-plugin ^5.22.0
  • @typescript-eslint/parser ^5.22.0
  • eslint ^8.14.0
  • jest ^29.7.0
  • seedrandom ^3.0.5
  • supertest ^6.3.3
  • swagger-jsdoc ^6.2.8
  • ts-jest ^29.1.1
  • typescript ^5.2.2
api-service/auth/package.json
  • bcrypt ^5.1.1
  • body-parser ^1.20.2
  • dotenv ^16.3.1
  • express ^4.18.2
  • express-validator ^7.0.1
  • http-status-codes ^2.2.0
  • jsonwebtoken ^9.0.1
  • mongoose ^7.4.4
  • redis ^4.6.8
  • @tsconfig/node14 ^1.0.3
  • @types/bcrypt ^5.0.0
  • @types/express ^4.17.17
  • @types/jest ^29.5.5
  • @types/node ^14.18.54
  • @typescript-eslint/eslint-plugin ^5.22.0
  • @typescript-eslint/parser ^5.22.0
  • eslint ^8.14.0
  • jest ^29.7.0
  • nodemon ^3.0.1
  • supertest ^6.3.3
  • swagger-jsdoc ^6.2.8
  • ts-jest ^29.1.1
api-service/common/package.json
  • @types/express ^4.17.17
  • bcrypt ^5.1.1
  • express-validator ^7.0.1
  • http-status-codes ^2.2.0
  • jsonwebtoken ^9.0.1
  • mongoose ^7.4.4
  • redis ^4.6.8
  • validator ^13.11.0
  • @types/jest ^29.5.4
  • express ^4.18.2
  • jest ^29.6.4
  • mongodb-memory-server ^8.15.1
  • ts-jest ^29.1.1
  • ts-node ^10.9.1
  • tsup ^7.2.0
  • typescript ^5.2.2
frontend/package.json
  • @fortawesome/fontawesome-svg-core ^6.5.1
  • @fortawesome/free-brands-svg-icons ^6.5.1
  • @fortawesome/free-regular-svg-icons ^6.5.1
  • @fortawesome/free-solid-svg-icons ^6.5.1
  • @fortawesome/vue-fontawesome ^3.0.5
  • @popperjs/core ^2.11.8
  • axios ^1.6.5
  • bootstrap ^5.3.2
  • bootstrap-icons ^1.11.3
  • bootstrap-vue ^2.23.1
  • chart.js ^4.4.1
  • jquery ^3.7.1
  • pinia ^2.1.7
  • socket.io-client ^4.7.4
  • tsc ^2.0.4
  • vee-validate ^4.12.4
  • vue ^3.4.15
  • vue-carousel ^0.18.0
  • vue-chartjs ^5.3.0
  • vue-router ^4.2.5
  • vue-slick-carousel ^1.0.5
  • vue-toast-notification ^3.1.2
  • vue3-carousel ^0.3.1
  • yup ^1.3.3
  • @rushstack/eslint-patch ^1.3.3
  • @tsconfig/node18 ^18.2.2
  • @types/bootstrap ^5.2.10
  • @types/jquery ^3.5.29
  • @types/jsdom ^21.1.6
  • @types/node ^18.19.8
  • @vitejs/plugin-vue ^4.5.2
  • @vue/eslint-config-prettier ^8.0.0
  • @vue/eslint-config-typescript ^12.0.0
  • @vue/test-utils ^2.4.3
  • @vue/tsconfig ^0.5.0
  • axios ^1.6.5
  • eslint ^8.49.0
  • eslint-plugin-vue ^9.17.0
  • jsdom ^23.0.1
  • npm-run-all2 ^6.1.1
  • prettier ^3.0.3
  • sass ^1.69.7
  • sass-loader ^14.0.0
  • ts-transformer-keys ^0.4.4
  • ttypescript ^1.5.15
  • typescript ~5.3.0
  • vite ^5.0.10
  • vitest ^1.0.4
  • vue-tsc ^1.8.25

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.