Skip to content

Repository files navigation

Note

This project is a prototype built for demonstration purposes.

  • Contains hardcoded configurations (e.g., database path)
  • Uses local TCP communication without encryption
  • Not production-ready
  • Intended to demonstrate Shamir Secret Sharing in a voting system

Future improvements include security enhancements, database abstraction, and deployment-ready architecture.

Privacy-Preserving Voting System

A small local demo of a privacy-preserving voting system that uses a 2-of-3 Shamir Secret Sharing scheme to split votes into shares stored on three tally servers. Includes a Tkinter-based Voter GUI and Admin GUI, plus simple local TCP services for registrar and tally servers.

Requirements

  • Python 3.8 or newer (3.10+ recommended)
  • No external pip packages required — uses Python standard library modules (tkinter, sqlite3, socket, threading, json, secrets, hashlib, etc.)

Files of interest

  • voter_gui.py — Voter-facing Tkinter GUI
  • admin_gui.py — Admin console GUI
  • voting_coordinator.py — Orchestrates splitting votes & contacting servers
  • registrar.py — Registrar service (token issuance/validation)
  • tally_server.py — Tally server (stores shares)
  • database.py — SQLite database wrapper and schema
  • shamir_secret_sharing.py — Shamir sharing & reconstruction
  • main.py / start.py — Two startup options (multi-process vs threaded)
  • DOCUMENTATION.txt — Detailed project documentation

Quick start (local testing)

Option 1: Threaded servers + GUI (recommended for local testing and packaging):

python .\start.py

Runs registrar and tally servers in background threads within the same process using ThreadedVotingSystem. Ideal for local testing and packaging as a single Windows EXE.

Option 2: Multi-process launcher (opens servers in separate consoles):

python .\main.py

Starts each server in a separate console window using subprocess. Useful for Windows development when you want to see individual server logs.

Option 3: Run components individually for debugging:

python .\registrar.py
python .\tally_server.py 1
python .\admin_gui.py
python .\voter_gui.py

Configuration & Data

  • Database: SQLite file voting_system.db is created in the working directory on first run.
  • Default admin: username=admin, password=admin123 (created on first run; password stored as PBKDF2 hash).
  • Default candidates: Three default candidates are seeded on first run.
  • Field constraints: Voter names, candidate names, and usernames are limited to 16 characters.
  • Password hashing: Admin passwords are stored using PBKDF2-SHA256 with automatic migration of any existing plaintext passwords.
  • GUI styling: Both voter and admin GUIs use a custom professional blue color palette.

Dependencies

  • No external dependencies: Project uses only Python standard library modules.
  • Optional libraries: See requirements.txt for optional password hashing libraries (bcrypt, argon2-cffi) if stronger hashing is desired.

Security & Production Notes

  • This is a prototype/demo project. NOT production ready.
  • For production, implement: TLS encryption, mutual authentication, stronger credential schemes, and encrypted database fields.
  • Currently all servers run on localhost with no network authentication.

Contributing & Tests

  • This is a student/demo project. To contribute, add unit tests for shamir_secret_sharing.py, database.py, and voting_coordinator.py.

About

Prototype voting system using Shamir Secret Sharing

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages