Blockchain-Based-Voting-System
Prerequisites
MySQL
Nodejs
React
npm
Ganache
Setting up the Environment
a) Frontend & Backend Setup
Change directory to frontend
Run
npm i to install dependencies.Change directory to backend
Run
npm i to install dependencies.b) Contract Setup
Navigate to the backend directory
Run command
npx truffle migrate.In case, the command doesn't work, you will need to install
truffle explicitly using the command npm install -g truffle. You might need to initialize it also if the error occurs in the following steps using command truffle init.Once the command runs, you will see Blocks and Transactions in Ganache.
Type command
npm run typeorm migration:runc) Ganache Setup
Open a new workspace in Ganache
Name the project as
bbvs and Add Project using the file in backend\truffle-config.jsStart Project.
d) MySQL Setup
Open a terminal in the project directory and start mysql using command
sudo mysql.Type command
create user bbvs@localhost identified with mysql_native_password by 'Password00$$';. Make sure the Password is the same as the one in backend/ormconfig.json.Type command
grant all privileges on *.* to bbvs@localhost;Type command
select user from mysql.user to confirm.Type command
create database bbvs;.Type command
use bbvs;.Type command
show databases; to confirm.e) Adding the .env file
Create a file in the backend directory named as
.env and add the following code: ` ACCESS_TOKEN_SECRET=976a66a5bd23b2050019f380c4decbbefdf8ff91cf502c68a3fe1ced91d7448cc54ce6c847657d53294e40889cef5bd996ec5b0fefc1f56270e06990657eeb6eREFRESH_TOKEN_SECRET=5f567afa6406225c4a759daae77e07146eca5df8149353a844fa9ab67fba22780cb4baa5ea508214934531a6f35e67e96f16a0328559111c597856c660f177c2 `
e) Running the Project
Navigate to the backend directory and type
npm start.Navigate to the frontend directory and type
npm startThe project is running successfully.
0 likes · 35 views · Aug 6, 2024
Contribute to AdeenaLathiya/Blockchain-Based-Voting-System development by creating an account on GitHub.
Featured onBest Ganache freelancers to hire in 2026