Voting Manager Tool is a comprehensive, blockchain-based voting management application. It leverages the power of Solidity smart contracts, a NestJS back-end service, a React front-end application, and GraphQL for efficient data handling. This combination of technologies provides a secure, efficient, and user-friendly platform for managing and participating in voting events.
The main technology stack used in this project includes:
- Solidity: For creating the smart contract that handles the voting mechanism.
- NestJS: For building the back-end service that listens to events emitted by the smart contract and syncs with our database.
- React: For developing the front-end application that displays the events from the smart contract to the users.
- GraphQL: Used in conjunction with TheGraph for efficient querying and indexing of blockchain data.
The smart contract, developed in Solidity and deployed on the Optimism Sepolia network, implements a voting mechanism. This contract allows for the creation of votes, casting of votes, and conclusion of voting. Additionally, it emits events for each of these actions.
The back-end service, integrated using a NestJS project, is responsible for listening to the events emitted by the smart contract. It has a cron job running periodically to listen for relevant blockchain events. When these events are heard, it syncs with our database, which feeds data to our front-end. It also provides RESTful APIs that serve the event data to the front-end.
The application integrates a subgraph using TheGraph for indexing blockchain data. This allows for efficient querying of blockchain events and data, enhancing the performance and user experience of the application.
The front-end application is responsible for displaying the events from the smart contract. This application has been modified to fetch event data from the back-end API instead of directly from the blockchain. The user interface is user-friendly and displays real-time updates.
Unit tests have been written for the smart contract and for the API endpoints. Comprehensive documentation is provided, including setup instructions for the smart contract, back-end service, and front-end application.
-
Clone the GitHub repository.
-
Navigate to the
neitec apifolder and create a.envfile with the following environment variables:GRAPHQL_API_URL="your subgraph api url" MONGODB_URI="your mongodb uri" -
Run
npm installto install all dependencies. -
Run
npm run startto start the back-end service. Once this is done, our backend will be running, listening to events on the blockchain and syncing our MongoDB database as necessary. -
Open another console, navigate to the
voting-appfolder. -
Run
npm installto install all dependencies. -
Run
npm run startto start the front-end application. -
Follow the setup and running instructions for the smart contract, back-end service, and front-end application provided in the documentation.
-
Ensure you have available balance on the Optimism Sepolia network. You can get test balance from this faucet: https://faucet.quicknode.com/optimism/sepolia
-
Connect to the Optimism Sepolia network through MetaMask. You can do it directly from this link: https://chainlist.org/chain/11155420
To contribute to this project, please fork the repository and propose your changes via a pull request.
This project is licensed under the terms of the MIT license.
