byhub / demo-voting

Voting dApp demo for Oasis Sapphire

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Demo Voting App

This is a demo voting app running natively on Oasis Sapphire. The app is a fork of the OPL Secret Ballot.

Backend

This repo is set up for pnpm but other NodeJS package managers should work.

Install dependencies

pnpm install

Build smart contracts

pnpm build

Frontend

Install dependencies

pnpm install

Compile and Hot-Reload for Development

pnpm dev

Build assets for deployment

pnpm build

Local Development

We will use Hardhat and Hardhat-deploy to simplify development.

Start local Hardhat network

npx hardhat node

Deploy smart contracts locally

npx hardhat deploy-local --network localhost

We can now reference the deployed contracts in our frontend Vue app.

Modify the .env.development file with the appropriate addresses:

VITE_BALLOT_BOX_V1_ADDR=0x5FbDB2315678afecb367f032d93F642f64180aa3

and

VITE_DAO_V1_ADDR=0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512

Additionally, we will need a Pinata API key to access the pinning service with which we store our ballots as JSON.

VITE_PINATA_JWT=

Start Vue app

pnpm dev

Navigate to http://localhost:5173, and you should be able to create a new poll.

You can use one of the deployed test accounts and associated private key with MetaMask.

About

Voting dApp demo for Oasis Sapphire

License:Apache License 2.0


Languages

Language:JavaScript 42.5%Language:Vue 27.6%Language:TypeScript 19.1%Language:Solidity 9.9%Language:HTML 0.7%Language:CSS 0.1%