A decentralized voting system built on the Sui blockchain using Move smart contracts with a modern React TypeScript frontend.
project-Gawain/
βββ voting_system/ # Move smart contracts
β βββ sources/
β β βββ voting_system.move
β βββ Move.toml
βββ frontend/ # React TypeScript frontend
β βββ src/
β β βββ App.tsx
β β βββ App.css
β β βββ index.css
β β βββ main.tsx
β βββ package.json
β βββ index.html
βββ README.md
- Proposal Creation: Create voting proposals with title, description, and expiration
- Decentralized Voting: On-chain voting with transparent vote counting
- Vote Tracking: Prevents double voting and tracks all participants
- Time-bound Proposals: Proposals have expiration dates for time-limited voting
- Modern React UI: Built with React 19, TypeScript, and Vite
- Responsive Design: Mobile-friendly interface with dark/light mode support
- Real-time Updates: Live proposal status and vote count updates
- Move Language: Smart contract development
- Sui Blockchain: Layer 1 blockchain platform
- Move Framework: Standard libraries and utilities
- React 19: Modern React with hooks
- TypeScript: Type-safe JavaScript
- Vite: Fast build tool and dev server
- CSS3: Modern styling with CSS Grid and Flexbox
- Sui CLI - For Move contract development
- Node.js (v18 or higher) - For frontend development
- pnpm/npm/yarn - Package manager
git clone <repository-url>
cd project-Gawaincd voting_system
# Install Sui CLI if not already installed
curl -fLJO https://github.com/MystenLabs/sui/releases/download/mainnet-v1.14.2/sui-mainnet-v1.14.2-ubuntu-x86_64.tgz
# Build the Move contracts
sui move build
# Test the contracts
sui move test
# Publish to testnet (requires testnet setup)
sui client publish --gas-budget 100000000cd frontend
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run buildpublic struct Proposal has key {
id: UID,
title: String,
description: String,
voted_yes_count: u64,
voted_no_count: u64,
expiration: u64,
creator: address,
voters: vector<address>,
}Creates a new voting proposal.
Parameters:
title: String- Proposal titledescription: String- Detailed descriptionexpiration: u64- Expiration timestampctx: &mut TxContext- Transaction context
Usage:
create_proposal(
string::utf8(b"Proposal Title"),
string::utf8(b"Proposal Description"),
1234567890, // Expiration timestamp
ctx
);npm run dev- Start development servernpm run build- Build for productionnpm run lint- Run ESLintnpm run preview- Preview production build
Create a .env file in the frontend directory:
VITE_SUI_NETWORK=testnet
VITE_CONTRACT_ADDRESS=<your-contract-address>- Make changes to
voting_system/sources/voting_system.move - Build with
sui move build - Test with
sui move test - Deploy to testnet for integration testing
- Start the dev server with
npm run dev - Make changes to React components
- Test in browser with hot reload
- Build and deploy when ready
# Deploy to Sui testnet
sui client publish --gas-budget 100000000
# Note the package ID for frontend integration# Build optimized production bundle
npm run build
# Deploy to your preferred hosting service
# (Vercel, Netlify, AWS S3, etc.)- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request