Skip to content

Cupcake-Legend/voting-client-blockchain

Repository files navigation

Laravel Logo

Build Status Total Downloads Latest Stable Version License

🕸 Laravel App – README.md

# Blockchain Voting System – Laravel (Off-Chain Management)

This Laravel app handles the off-chain part of a blockchain voting system using Hyperledger Fabric. It manages users, TPS registration, and interfaces with the blockchain via REST.

## 📁 Features

- Admin panel to manage:
  - Users
  - TPS
- Voter dashboard:
  - View TPS assignment
  - Cast vote (one-time)
- Blockchain Integration via HTTP:
  - Register TPS and users
  - Record vote on blockchain
  - Sync vote result summary

## 🛠️ Setup

### 1. Clone the Repository

```bash
git clone <your-laravel-repo-url>
cd <your-laravel-folder>

2. Install Dependencies

composer install
npm install && npm run dev

3. Configure Environment

Copy .env.example to .env and update DB credentials.

cp .env.example .env
php artisan key:generate

4. Migrate & Seed

php artisan migrate
php artisan db:seed

This will also make HTTP requests to register TPS and users on the blockchain via:

  • /api/assets – for each TPS
  • /api/register – for each voter

5. Run the App

php artisan serve

App available at: http://localhost:8000

👥 User Roles

  • Admin: Can create TPS and assign voters
  • Voter: Can log in and cast vote once

🌐 Routes Overview

Route Role Description
/login All Login screen
/dashboard Voter Cast vote + see status
/users Admin Manage users
/tps Admin Manage TPS

📡 Blockchain Communication

Laravel uses Http::post() to call endpoints from Hyperledger REST API:

  • Cast vote
  • Register users
  • Send summarized vote results

See VoteController, UserSeeder, and TpsSeeder for usage.

📌 Notes

  • Users are manually seeded; there’s no public registration.
  • nik is used as blockchain user ID.
  • Votes are marked on both DB and blockchain for syncing.
  • No vote contents are stored, only participation and counts.

About

This Laravel-based client application serves as the front-end interface for interacting with the Blockchain-Based Voting API. It provides users with an intuitive and secure way to register as voters, view voting locations, and cast votes by communicating with the blockchain backend through RESTful API calls.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors