Skip to content

Commit 2a67b17

Browse files
committed
first commit
0 parents  commit 2a67b17

114 files changed

Lines changed: 8277 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SECRET_KEY="a97d284cd0875537b504839c44547df4835e8928444e940a18e2209c17d2e566fcd772397b4c221009881bfbefef8bf7d3cea30d327c7a71f61af89097eb3502"

.github/workflows/README.md

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
<p align="center">
2+
<a href="" rel="noopener">
3+
<img src="https://i.imgur.com/AZ2iWek.png" alt="Project logo"></a>
4+
</p>
5+
<h3 align="center">Decentralised Autonomous Organization for Local Governance</h3>
6+
7+
<div align="center">
8+
9+
[![Hackathon](https://img.shields.io/badge/hackathon-StatusCode1-orange.svg)](http://hackathon.url.com)
10+
[![Status](https://img.shields.io/badge/status-active-success.svg)]()
11+
[![GitHub Issues](https://img.shields.io/github/issues/AdityaSeth777/blockchain-voting.svg)](https://github.com/AdityaSeth777/blockchain-voting/issues)
12+
[![GitHub Pull Requests](https://img.shields.io/github/issues-pr/kylelobo/The-Documentation-Compendium.svg)](https://github.com/kylelobo/The-Documentation-Compendium/pulls)
13+
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.md)
14+
15+
</div>
16+
17+
---
18+
19+
<p align="center"> XYZ is our very own blockchain based platform that allows local bodies to participate in government policy-making using a Decentralised Autonomous Organization (DAO) with absolute transparency.
20+
<br>
21+
</p>
22+
23+
## 📝 Table of Contents
24+
25+
- [Problem Statement](#problem_statement)
26+
- [Idea / Solution](#idea)
27+
- [Dependencies / Limitations](#limitations)
28+
- [Future Scope](#future_scope)
29+
- [Setting up a local environment](#getting_started)
30+
- [Usage](#usage)
31+
- [Technology Stack](#tech_stack)
32+
- [Contributing](../CONTRIBUTING.md)
33+
- [Authors](#authors)
34+
- [Acknowledgments](#acknowledgments)
35+
36+
## 🧐 Problem Statement <a name = "problem_statement"></a>
37+
38+
Local government decision-making often lacks transparency and citizen participation, leading to inefficiencies and reduced public trust. A decentralized autonomous organization (DAO) based on blockchain technology can address these issues by providing a transparent and secure platform for local bodies to actively participate in and influence government decisions. This system ensures accountability, reduces corruption, and fosters a more inclusive and democratic decision-making process.
39+
40+
- In the ideal state, the decentralized autonomous organization (DAO) platform is fully operational and widely adopted by local government bodies. Citizens and representatives can easily access the platform to propose, discuss, and vote on various government decisions. The blockchain-based system ensures complete transparency, security, and immutability of records, fostering trust and accountability. All stakeholders, including local officials and community members, are actively engaged and informed, leading to more democratic, efficient, and fair decision-making processes. The platform's ease of use and accessibility empower citizens to have a meaningful impact on local governance, ultimately enhancing community well-being and public satisfaction.
41+
- In a mid-sized city, a DAO platform is launched to enhance transparency and citizen participation in local governance. Citizens and officials are educated and onboarded to use the secure, blockchain-based system. Community members propose, discuss, and vote on local issues like park development, ensuring transparent and tamper-proof decision-making. Continuous updates and public audits build trust and accountability, leading to increased civic engagement, efficient governance, and higher public satisfaction.
42+
43+
## 💡 Idea / Solution <a name = "idea"></a>
44+
45+
- To address potential issues with a blockchain-based DAO for local governance, user-friendly interfaces and comprehensive training can mitigate technical complexity, while robust security measures and scalable technologies ensure system integrity and performance. Awareness campaigns and engagement strategies boost user adoption, and legal compliance is secured through collaboration with experts and policymakers. Clear timelines and automated processes prevent decision-making delays, and privacy-preserving technologies protect user data. Engaging community leaders and demonstrating benefits can overcome resistance to change, while securing funding optimizes resource allocation. Finally, fair governance is ensured through equal representation, transparent processes, and effective dispute resolution mechanisms.
46+
47+
48+
## ⛓️ Dependencies / Limitations <a name = "limitations"></a>
49+
50+
- What are the dependencies of your project?
51+
- Describe each limitation in detailed but concise terms
52+
- Explain why each limitation exists
53+
- Provide the reasons why each limitation could not be overcome using the method(s) chosen to acquire.
54+
- Assess the impact of each limitation in relation to the overall findings and conclusions of your project, and if
55+
appropriate, describe how these limitations could point to the need for further research.
56+
57+
## 🚀 Future Scope <a name = "future_scope"></a>
58+
59+
Write about what you could not develop during the course of the Hackathon; and about what your project can achieve
60+
in the future.
61+
62+
## 🏁 Getting Started <a name = "getting_started"></a>
63+
64+
These instructions will get you a copy of the project up and running on your local machine for development
65+
and testing purposes. See [deployment](#deployment) for notes on how to deploy the project on a live system.
66+
67+
### Prerequisites
68+
69+
What things you need to install the software and how to install them.
70+
71+
```
72+
Give examples
73+
```
74+
75+
### Installing
76+
77+
A step by step series of examples that tell you how to get a development env running.
78+
79+
Say what the step will be
80+
81+
```
82+
Give the example
83+
```
84+
85+
And repeat
86+
87+
```
88+
until finished
89+
```
90+
91+
## 🎈 Usage <a name="usage"></a>
92+
93+
Add notes about how to use the system.
94+
95+
## ⛏️ Built With <a name = "tech_stack"></a>
96+
97+
- [MongoDB]https://img.shields.io/badge/:badgeContent?style=flat-square&logo=MongoDB&logoColor=rgba&logoSize=auto&color=hsl&link=https%3A%2F%2Fwww.mongodb.com
98+
- Database
99+
- [Express](https://expressjs.com/) - Server Framework
100+
- [VueJs](https://vuejs.org/) - Web Framework
101+
- [NodeJs](https://nodejs.org/en/) - Server Environment
102+
103+
<!--
104+
## ✍️ Authors <a name = "authors"></a>
105+
106+
- [@kylelobo](https://github.com/kylelobo) - Idea & Initial work
107+
108+
See also the list of [contributors](https://github.com/kylelobo/The-Documentation-Compendium/contributors)
109+
who participated in this project.
110+
111+
!-->
112+
## 🎉 Acknowledgments <a name = "acknowledgments"></a>
113+
114+
115+
- Hat tip to anyone whose code was used
116+
- Inspiration
117+
- References
118+
119+
120+
```bash
121+
npm install @auth0/auth0-react axios react-router-dom
122+
npm install mongoose express-session passport passport-auth0 body-parser axios dotenv
123+
```
124+
<!--
125+
├── decentralized-voting-app # Root directory of the project.
126+
├── build # Directory containing compiled contract artifacts.
127+
| └── contracts
128+
| ├── MigrationArtifact.json
129+
| └── VotingArtifact.json
130+
├── contracts # Directory containing smart contract source code.
131+
| ├── DeployContracts.js
132+
| ├── Migration.sol
133+
| └── Voting.sol
134+
├── database_api # API code for database communication.
135+
| └── api_main.py
136+
├── migrations # Ethereum contract deployment scripts.
137+
| └── InitialMigration.js
138+
├── node_modules # Node.js modules and dependencies.
139+
├── public # Public assets like favicon.
140+
| └── favicon.ico
141+
├── src
142+
| ├── assets # Project images.
143+
| | └── eth_background.jpg
144+
| ├── styles # CSS stylesheets.
145+
| | ├── admin_panel.css
146+
| | ├── main.css
147+
| | └── login_page.css
148+
| ├── dist # Compiled JavaScript bundles.
149+
| | ├── main_bundle.js
150+
| | └── login_bundle.js
151+
| ├── templates # HTML templates.
152+
| | ├── admin_panel.html
153+
| | ├── main_page.html
154+
| | └── login_page.html
155+
| └── scripts # JavaScript logic files.
156+
| ├── main_script.js
157+
| └── login_script.js
158+
├── app.js # Main entry point for Node.js application.
159+
├── package.json # Node.js package configuration.
160+
├── package-lock.json # Lockfile for package dependencies.
161+
├── README.md # Project documentation.
162+
└── truffle-config.js # Truffle configuration file.
163+
164+
165+
!-->
166+
167+
168+
├── blockchain-voting-dapp # Root directory of the project.
169+
├── build # Directory containing compiled contract artifacts.
170+
| └── contracts
171+
| ├── Migrations.json
172+
| └── Voting.json
173+
├── contracts # Directory containing smart contract source code.
174+
| ├── 2_deploy_contracts.js
175+
| ├── Migrations.sol
176+
| └── Voting.sol
177+
├── Database_API # API code for database communication.
178+
| └── main.py
179+
├── migrations # Ethereum contract deployment scripts.
180+
| └── 1_initial_migration.js
181+
├── node_modules # Node.js modules and dependencies.
182+
├── public # Public assets like favicon.
183+
| └── favicon.ico
184+
├── src
185+
| ├── assets # Project images.
186+
| | └── eth5.jpg
187+
| ├── css # CSS stylesheets.
188+
| | ├── admin.css
189+
| | ├── index.css
190+
| | └── login.css
191+
| ├── dist # Compiled JavaScript bundles.
192+
| | ├── app.bundle.js
193+
| | └── login.bundle.js
194+
| ├── html # HTML templates.
195+
| | ├── admin.html
196+
| | ├── index.html
197+
| | └── login.html
198+
| └── js # JavaScript logic files.
199+
| ├── app.js
200+
| └── login.js
201+
├── index.js # Main entry point for Node.js application.
202+
├── package.json # Node.js package configuration.
203+
├── package-lock.json # Lockfile for package dependencies.
204+
├── README.md # Project documentation.
205+
└── truffle-config.js # Truffle configuration file.

.github/workflows/greetings.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Greetings
2+
3+
on: [pull_request_target, issues]
4+
5+
jobs:
6+
greeting:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
issues: write
10+
pull-requests: write
11+
steps:
12+
- uses: actions/first-interaction@v1
13+
with:
14+
repo-token: ${{ secrets.GREETINGS_TOKEN }}
15+
issue-message: "Oh, so you have issues ? Nvm, we all have."
16+
pr-message: "Kaaj nei ?"

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
build
3+
package-lock.json
4+
old-project

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Krish Depani
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
## Features
2+
- Implements JWT for secure voter authentication and authorization.
3+
- Utilizes Ethereum blockchain for tamper-proof and transparent voting records.
4+
- Removes the need for intermediaries, ensuring a trustless voting process.
5+
- Admin panel to manage candidates, set voting dates, and monitor results.
6+
- Intuitive UI for voters to cast votes and view candidate information.
7+
8+
## Requirements
9+
- Node.js (version – 18.14.0)
10+
- Metamask
11+
- Python (version – 3.9)
12+
- FastAPI
13+
- MySQL Database (port – 3306)
14+
15+
## Installation
16+
17+
1. Open a terminal.
18+
19+
2. Clone the repository by using the command
20+
21+
git clone https://github.com/AdityaSeth777/blockchain-voting.git
22+
23+
3. Download and install [Ganache](https://trufflesuite.com/ganache/).
24+
25+
4. Create a workspace named <b>developement</b>, in the truffle projects section add `truffle-config.js` by clicking `ADD PROJECT` button.
26+
27+
5. Download [Metamask](https://metamask.io/download/) extension for the browser.
28+
29+
6. Now create wallet (if you don't have one), then import accounts from ganache.
30+
31+
7. Add network to the metamask. ( Network name - Localhost 7575, RPC URl - http://localhost:7545, Chain ID - 1337, Currency symbol - ETH)
32+
33+
8. Open MySQL and create database named <b>voter_db</b>. (DON'T USE XAMPP)
34+
35+
9. In the database created, create new table named <b>voters</b> in the given format and add some values.
36+
37+
CREATE TABLE voters (
38+
voter_id VARCHAR(36) PRIMARY KEY NOT NULL,
39+
role ENUM('admin', 'user') NOT NULL,
40+
password VARCHAR(255) NOT NULL
41+
);
42+
<br>
43+
44+
+--------------------------------------+-------+-----------+
45+
| voter_id | role | password |
46+
+--------------------------------------+-------+-----------+
47+
| | | |
48+
+--------------------------------------+-------+-----------+
49+
50+
12. Install truffle globally
51+
52+
npm install -g truffle
53+
54+
14. Go to the root directory of repo and install node modules
55+
56+
npm install
57+
58+
15. Install python dependencies
59+
60+
pip install fastapi mysql-connector-python pydantic python-dotenv uvicorn uvicorn[standard] PyJWT
61+
62+
## Usage
63+
64+
#### Note: Update the database credentials in the `./db/.env` file.
65+
66+
1. Open terminal at the project directory
67+
68+
2. Open Ganache and it's <b>development</b> workspace.
69+
70+
3. open terminal in project's root directory and run the command
71+
72+
truffle console
73+
then compile the smart contracts with command
74+
75+
compile
76+
exit the truffle console
77+
78+
5. Bundle app.js with browserify
79+
80+
browserify ./src/js/app.js -o ./src/dist/app.bundle.js
81+
82+
2. Start the node server server
83+
84+
node index.js
85+
86+
3. Navigate to `db` folder in another terminal
87+
88+
cd db
89+
then start the database server by following command
90+
91+
uvicorn main:app --reload --host 127.0.0.1
92+
93+
4. In a new terminal migrate the truffle contract to local blockchain
94+
95+
truffle migrate
96+
97+
You're all set! The Voting app should be up and running now at http://localhost:8080/.<br>

0 commit comments

Comments
 (0)