VotingChain is a decentralized voting system based on Ethereum blockchain. It is designed to provide a secure, transparent, and tamper-proof voting system for various scenarios. MIT License.
This project also comes with a fully decentralized version. It is available at branch
master-fd.
- Candidate Based Voting: Voters can vote for their favorite candidates who have been registered in the vote session.
- RawText Based Voting: Voters can vote for their favorite raw text options.
- Multiple Voting Sessions: The system supports multiple voting sessions, each with its own candidates and options.
- Secure and Transparent: The voting results are stored on the Ethereum blockchain, which is secure and tamper-proof.
- ERC-721 Based Voting Token: Using ERC-721 tokens to represent the voting rights of voters.
- Multi-user Support: The system supports multiple users, each with their own Ethereum account.
- Fully Operational Backend: The backend is implemented in Golang and MySQL, which can handle large amounts of data.
![]() |
![]() |
![]() |
![]() |
You need to have the following tools installed on your machine:
- Node.js (Preferred version: 18.20.7)
- npm (Preferred version: 10.8.2)
- golang (Preferred version: 1.23.7)
- MySQL
- [email protected]
To test the project, you are recommended to install the following tools:
- Ganache
- MetaMask
Prepare your MySQL database, and create a new Schema to get ready for auto-migrated tables.
git clone https://github.com/AdemJensen/VotingChain
cd backend
make all
make reset_config
cd ../frontend
npm installThe make all in backend directory will build both golang server and Solidity smart contract source code.
In this section, we will introduce how to run the project on Ganache.
- Create a new test network, get its
RPC Host(Usuallyhttp://127.0.0.1:7545) andChain ID(Usually1337, note that it is notNetwork ID). - Edit
backend/config.json, modify the following entries:db.*,blockchain.rpcHost,blockchain.chainID. If you want to modify the generated root user's email, you can also editdb.rootUserEmail. - Run command to start:
cd backend
go run main.go
# on another shell
cd frontend
npm run devYou should see the backend and frontend up and running. If so, open your browser, and access http://localhost:5173/init.
Follow the instructions on the webpage, link to your Ethereum account and migrate DB tables.
If you encounter the following error when deploying the contract:
Error: Returned error: VM Exception while processing transaction: invalid opcode
Please make sure you are using [email protected] to compile the contract:
npm install -g [email protected]If you are using MacOS, please do not use the solc installed by brew, it will cause the invalid opcode in the
compiled artifact, making it impossible to deploy in Ganache.




