Skip to content

A decentralized voting dApp running on the Nuklai blockchain built with React + Firebase.

Notifications You must be signed in to change notification settings

Nuklai/nuklai-voting-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nuklai Voting dApp

A decentralized voting dApp running on the Nuklai blockchain built with React + Firebase, thanks to @nuklai-js-sdk & @hyperchain-js-sdk.

Tech Stack

  • ReactJS
  • Tailwind
  • Firebase Realtime Database
  • Nuklai SDK
  • HyperchainSDK

Setup

  1. Clone the repository
  2. Install dependencies:
   npm install
  1. Set up Firebase:

    • Create a Firebase project
    • Add your Firebase config to src/services/firebase.js
  2. Set up Nuklai SDK:

    • Make sure you have the correct NuklaiVM credentials in src/services/nuklaiService.js

Running the App

npm start

Building for Production

npm run build

Key Components

  • App.js: Main component.
  • Card.js: Voting interface.
  • Votes.js: Displays voting results.
  • firebase.js: Firebase config.
  • nuklaiService.js: Initializing the Nuklai SDK and balance related logic.
  • utils.js: Utility functions for vote processing via the NuklaiVM, Firebase storage logic.

Key Functions

  • getBalanceAndAddress: Retrieves the user's Nuklai address and balance from the NuklaiVM
  • signAndGetBalance: Processes the vote and updates Firebase.

Ext Libs

  • recharts: For the pie-chart.
  • react-hot-toast: For notifications.

Notes

This dApp is for demo purposes only. All votes are via the NuklaiVM Testnet.

Releases

No releases published

Packages

No packages published