This is written in the solidity language and tested using the Remix IDE. Implemented a blockchain-based election using smart contract.
This election has various features to conduct an election with utmost security. The features of this election are:
- Admin sets the duration for voting.
- Multiple elections can happen for different posts at the same time.
- Every candidate can contest/apply for the posts for different elections based on criteria given by admin.
- Voters can vote once in each election.
- Every user can view the candidate that has won the election after it has been concluded.
Functions used:
- candidate_apply(): Candidates have to apply using this external function with their address. This helps the candidate to give an entry for the post he is applying for. Further, he is also added to the list of candidates contesting for that particular post.
- add_organiser(): This function adds an organiser to the org_map using its address.
- assign_org(): The admin has the power to assign an organisation.
- accept_candidate(): The admin accepts the candidate after looking at his application.
- reject_candidate(): The admin rejects the candidate after looking at his application.
- vote(): Here, the voters have the ability to vote for a preferred candidate.
- post_winner(): Displays the winner of a post after election has been concluded.