0xdavinchee / ethhole-voting-dapp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


Ethhole Voting dApp

Create a dapp for voting where all of the votes and candidate registration happens on chain. Allow anyone to start an election with a registration period, voting period, and ending time. Allow anyone to sign up as a candidate during the registration period, and allow anyone to vote once during the voting period. Create a front end where voters can see the results and know how long is left in the election.

Assumptions:

  • One election can be running and started by anyone.
  • Anyone can sign up as a candidate.
  • Voters can only vote once.
  • Registration Starts immediately after an election is created.
  • Voting starts immediately following the registration period.
  • A new election can be started once this one has ended.

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. License
  5. Contact

About The Project

Built With

Getting Started

To get a local copy up and running follow these simple steps.

Installation

  1. Clone the repo
    git clone https://github.com/0xdavinchee/ethhole-voting-dapp.git
  2. Install NPM packages
    npm install
  3. Create a .env file and add the two following values:
  • INFURA_API_KEY: You can get this from https://infura.io by signing up for a free account.
  • RINKEBY_PRIVATE_KEY (if you want to deploy to testnet).

Usage

To compile: npx hardhat compile.

To run tests: npx hardhat test.

Run npx hardhat node to start up a local node.

Open up another terminal window and run npx hardhat deploy --network localhost to deploy your project to localhost. You can similarly deploy to other networks like so: npx hardhat deploy --network <NETWORK>

To set up the graph you need to initialize a graph project, you can follow follow the instructions here: https://medium.com/blockrocket/dapp-development-with-a-local-subgraph-ganache-setup-566a4d4cbb.

I currently first verify my contract on rinkeby and then use graph init to initialize the project using the deployed project so that the graph initializes the project with the correct ABI and some boilerplate code.

License

Distributed under the MIT License. See LICENSE for more information.

Contact

@0xdavinchee - 0xdavinchee@gmail.com

Project Link: https://github.com/0xdavinchee/ethhole-voting-dapp

About


Languages

Language:TypeScript 77.2%Language:Solidity 15.6%Language:HTML 4.0%Language:CSS 3.1%