{"id":19756110,"url":"https://github.com/kushshriv/decentralised-voting-system-solidity-js","last_synced_at":"2026-04-16T05:03:27.281Z","repository":{"id":252932807,"uuid":"841947499","full_name":"KushShriv/Decentralised-Voting-System-Solidity-JS","owner":"KushShriv","description":"A Decentralised Voting System using Solidity and JavaScript","archived":false,"fork":false,"pushed_at":"2024-08-14T11:52:23.000Z","size":278,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-10T22:36:04.449Z","etag":null,"topics":["python","solidity"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KushShriv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-13T11:14:01.000Z","updated_at":"2024-08-19T07:20:29.000Z","dependencies_parsed_at":"2024-08-13T14:37:11.419Z","dependency_job_id":null,"html_url":"https://github.com/KushShriv/Decentralised-Voting-System-Solidity-JS","commit_stats":null,"previous_names":["kushshriv/decentralised-voting-system-solidity-js"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KushShriv%2FDecentralised-Voting-System-Solidity-JS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KushShriv%2FDecentralised-Voting-System-Solidity-JS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KushShriv%2FDecentralised-Voting-System-Solidity-JS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KushShriv%2FDecentralised-Voting-System-Solidity-JS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KushShriv","download_url":"https://codeload.github.com/KushShriv/Decentralised-Voting-System-Solidity-JS/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241086641,"owners_count":19907313,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","solidity"],"created_at":"2024-11-12T03:14:45.079Z","updated_at":"2026-04-16T05:03:27.238Z","avatar_url":"https://github.com/KushShriv.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Decentralised-Voting-System-Using-Ethereum-Blockchain\r\n\r\n\u003e The Decentralised Voting System utilizing Ethereum Blockchain offers a secure and transparent method for conducting elections. \u003cbr\u003e\r\n\u003e By harnessing Ethereum's blockchain technology, this system guarantees tamper-resistant voting records, allowing users to vote remotely while preserving their anonymity and preventing fraudulent activities. \u003cbr\u003e\r\n\u003e Discover this cutting-edge project for reliable and decentralized voting procedures.\r\n\r\n## Features\r\n-  Utilizes Ethereum blockchain for tamper-proof and transparent voting records.\r\n-  Implements JWT for secure voter authentication and authorization.\r\n-  Intuitive UI for voters to cast votes and view candidate information.\r\n-  Admin panel to manage candidates, set voting dates, and monitor results.\r\n-  Removes the need for intermediaries, ensuring a trustless voting process.\r\n\r\n## Requirements\r\n- Node.js 18.14.0\r\n- Metamask\r\n- Python 3.9\r\n- FastAPI\r\n- MySQL Database (running at port 3306)\r\n\r\n\r\n## Installation\r\n\r\n1. Open a terminal.\r\n\r\n2. Clone the repository by using the command\r\n```\r\ngit clone https://github.com/KushShriv/Decentralised-Voting-System-Solana-JS.git\r\n```\r\n\r\n3. Download and install [Ganache](https://trufflesuite.com/ganache/).\r\n\r\n4. Create a workspace named \u003cb\u003edevelopement\u003c/b\u003e, in the truffle projects section add `truffle-config.js` by clicking `Add Project` button.\r\n\r\n5. Download [Metamask](https://metamask.io/download/) extension for the browser.\r\n\r\n6. Now create wallet (if you don't have one), then import accounts from ganache.\r\n\r\n7. Add network to the metamask. \u003cbr\u003e( Network name - Localhost 7575, RPC URL - http://localhost:7545, Chain ID - 1337, Symbol - ETH)\r\n\r\n8. Open MySQL and create database named `voter_db`.\r\n\u003e  NOTE: Don't use Xampp\r\n\r\n9. In the database created, create new table named `voters` in the given format and add some values.\r\n``` SQL\r\nCREATE TABLE voters (\r\nvoter_id VARCHAR(36) PRIMARY KEY NOT NULL,\r\nrole ENUM('admin', 'user') NOT NULL,\r\npassword VARCHAR(255) NOT NULL\r\n);\r\n```\r\n```\r\n+----------+------+----------+\r\n| voter_id | role | password |\r\n+-----------------------------\r\n|          |      |          |\r\n+----------+------+----------+\r\n```\r\n10. Set up a `Database_API/.env` file with the following environment variables for the database apis to work properly\r\n```\r\nMYSQL_USER=\"yourUser\"\r\nMYSQL_PASSWORD=\"yourPassword\"\r\nMYSQL_HOST=\"localhost\"\r\nMYSQL_DB=\"voter_db\"\r\nSECRET_KEY= \"yourSecretKey\"\r\n```\r\n\u003e Set up a `.env` file in the root directory with just the secret key too\r\n\r\n11. Install truffle globally\r\n``` \r\nnpm install -g truffle\r\n```\r\n\r\n12. Go to the root directory of repo and install node modules\r\n```\r\nnpm install\r\n```\r\n\r\n13. Install python dependencies\r\n```\r\npip install fastapi mysql-connector-python pydantic python-dotenv uvicorn uvicorn[standard] PyJWT\r\n```\r\n\r\n## Usage\r\n\r\n\u003e Note: Update the database credentials in the `./Database_API/.env` file.\r\n\r\n1. Open terminal at the project directory\r\n\r\n2. Open Ganache and it's `development` workspace.\r\n\r\n3. Open terminal in project's root directory and run the command\r\n```\r\ntruffle console\r\n```\r\n\r\n4. Compile the smart contracts with command\r\n```\r\ncompile\r\n```\r\n\r\n5. Bundle app.js with browserify\r\n```    \r\nbrowserify ./src/js/app.js -o ./src/dist/app.bundle.js\r\n```\r\n\r\n6. Start the node server server\r\n``` \r\nnode index.js\r\n```\r\n\r\n7. Navigate to `Database_API` folder in another terminal\r\n ```   \r\ncd Database_API\r\n```\r\n\r\n8. Start the database server by following command\r\n```\r\nuvicorn main:app --reload --host 127.0.0.1\r\n```\r\n\r\n9. In a new terminal migrate the truffle contract to local blockchain\r\n``` \r\ntruffle migrate\r\n```\r\n\r\nYou're all set! The Voting app should be up and running now at http://localhost:8080/.\r\n\r\n## Directory Structure\r\n```\r\nblockchain-voting-dapp            # Root directory of the project.\r\n├── build                         # Directory containing compiled contract artifacts.\r\n|   └── contracts                 \r\n|       ├── Migrations.json       \r\n|       └── Voting.json           \r\n├── contracts                     # Directory containing smart contract source code.\r\n|   ├── 2_deploy_contracts.js     \r\n|   ├── Migrations.sol            \r\n|   └── Voting.sol                \r\n├── Database_API                  # API code for database communication.\r\n|   └── main.py                   \r\n├── migrations                    # Ethereum contract deployment scripts.\r\n|   └── 1_initial_migration.js    \r\n├── node_modules                  # Node.js modules and dependencies.\r\n├── public                        # Public assets like favicon.\r\n|   └── favicon.ico               \r\n├── src                           \r\n|   ├── assets                    # Project images.\r\n|   |   └── eth5.jpg              \r\n|   ├── css                       # CSS stylesheets.\r\n|   |   ├── admin.css             \r\n|   |   ├── index.css             \r\n|   |   └── login.css             \r\n|   ├── dist                      # Compiled JavaScript bundles.\r\n|   |   ├── app.bundle.js         \r\n|   |   └── login.bundle.js       \r\n|   ├── html                      # HTML templates.\r\n|   |   ├── admin.html            \r\n|   |   ├── index.html            \r\n|   |   └── login.html            \r\n|   └── js                        # JavaScript logic files.\r\n|       ├── app.js                \r\n|       └── login.js              \r\n├── index.js                      # Main entry point for Node.js application.\r\n├── package.json                  # Node.js package configuration.\r\n├── package-lock.json             # Lockfile for package dependencies.\r\n├── README.md                     # Project documentation.\r\n└── truffle-config.js             # Truffle configuration file.\r\n```\r\n\r\n\u003e Inspired By [Decentralised Voting System - Krish Depani](https://github.com/Krish-Depani/Decentralized-Voting-System)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkushshriv%2Fdecentralised-voting-system-solidity-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkushshriv%2Fdecentralised-voting-system-solidity-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkushshriv%2Fdecentralised-voting-system-solidity-js/lists"}