Skip to content

Repository files navigation

Fault Tolerant e-Voting

e-voting system with fault tolerant architecture.

This repository is migrated from my private repository with some files removed.

System Architecture

system architecture

Prerequisite

  1. GNU Make
  2. Docker
  3. Docker Compose

Run Server

  1. Create .env file:

    $ make .env
  2. Set values in .env File.

  3. Build server image:

    $ make prod.server.image
  4. Run the server:

    $ make prod.server.up
  5. The gRPC server will listen on port SERVER_PORT of your host.

  6. You can stop the server by:

    $ make prod.server.down

Run Admin

  1. Run server.

  2. Run the admin shell to register/unregister users:

    $ make prod.admin.run

Run Client

  1. Create .env file:

    $ make .env
  2. Set values in .env File.

  3. Build client image:

    $ make prod.client.image
  4. Run the client:

    $ make prod.client.run

Values in .env File

For Server

  • SERVER_PORT: The host port which the server will listen on.
  • DB_DATABASE: Name of database to be used.
  • DB_USERNAME: Username of database.
  • DB_PASSWORD: Password of database.

For Client

  • CLIENT_SERVER_IP: The IP address where gRPC server is being hosted at.
  • CLIENT_SERVER_PORT: The port which gRPC server is listening on.

Available Commands

Admin

register-voter

shell:>register-voter -h
NAME
       register-voter - Register a new voter.

SYNOPSIS
       register-voter [-n String] [-g String] [-k String] --help

OPTIONS
       -n String
       name
       [Mandatory]

       -g String
       group
       [Mandatory]

       -k String
       ed25519 public key
       [Mandatory]

       --help or -h
       help for register-voter
       [Optional]

unregister-voter

shell:>unregister-voter -h
NAME
       unregister-voter - Unregister a voter with specific name.

SYNOPSIS
       unregister-voter [-n String] --help

OPTIONS
       -n String
       name
       [Mandatory]

       --help or -h
       help for unregister-voter
       [Optional]

Client

gen-key-pair

shell:>gen-key-pair -h
NAME
       gen-key-pair - Generate a key pair for authentication.

SYNOPSIS
       gen-key-pair --help

OPTIONS
       --help or -h
       help for gen-key-pair
       [Optional]

sign-in

shell:>sign-in -h
NAME
       sign-in - Sign in a voter to use commands that requires authentication.

SYNOPSIS
       sign-in [-n String] [-k String] --help

OPTIONS
       -n String
       voter name
       [Mandatory]

       -k String
       base64 encoded ed25519 secret key
       [Mandatory]

       --help or -h
       help for sign-in
       [Optional]

create-election

Require calling sign-in first.

shell:>create-election -h
NAME
       create-election - Create an election.

SYNOPSIS
       create-election [-n String] [-g String[]] [-c String[]] [-e Long] --help

OPTIONS
       -n String
       name of the election
       [Mandatory]

       -g String[]
       group names separated by commas
       [Mandatory]

       -c String[]
       choices separated by commas
       [Mandatory]

       -e Long
       end time in Unix time format
       [Mandatory]

       --help or -h
       help for create-election
       [Optional]

cast-vote

Require calling sign-in first.

shell:>cast-vote -h
NAME
       cast-vote - Create a vote.

SYNOPSIS
       cast-vote [-e String] [-c String] --help

OPTIONS
       -e String
       name of the election
       [Mandatory]

       -c String
       choice for the election
       [Mandatory]

       --help or -h
       help for cast-vote
       [Optional]

get-election-result

shell:>get-election-result -h
NAME
       get-election-result - Get result of a finished election.

SYNOPSIS
       get-election-result [-n String] --help

OPTIONS
       -n String
       name of the election
       [Mandatory]

       --help or -h
       help for get-election-result
       [Optional]

Dev Environment

Get Started

  1. Create .env file:

    $ make .env
  2. Set values in .env File.

  3. Start services:

    $ make up
  4. Enter shells:

    Server/Admin:

    $ make server.sh

    Client:

    $ make client.sh

Handy Scripts

See Makefile for available scripts.

References

About

e-voting system with fault tolerant architecture.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages