This project is a decentralized, blockchain-based digital identity and voting system designed to run on a Raspberry Pi 5. It features a self-hosted Ethereum node, smart contracts for digital identity and voting, and a modern, minimalist web interface. The system is ideal for small-scale elections, club/association voting, and digital identity management.
- Features
- Architecture
- Technologies
- Screenshots & Diagrams
- Getting Started
- Project Structure
- Blockchain Node Setup
- Smart Contracts
- Backend (API)
- Frontend (UI)
- Usage
- Development Notes
- License
- π Decentralized Digital Identity: Register and verify unique identities on-chain.
- π³οΈ Secure Voting: One-person, one-vote, with transparent on-chain results.
- β‘ Runs on Raspberry Pi 5: Lightweight, energy-efficient, and portable.
- π₯οΈ Modern Minimalist UI: Apple-style, responsive, and easy to use.
- π οΈ Open Source & Customizable: All code is MIT licensed and easy to extend.
- π Live Results: View real-time vote counts directly from the blockchain.
graph TD;
User["User<br/>(Web Browser)"] -- API Calls --> Backend["Backend<br/>(Node.js + Express)"]
Backend -- Web3.js --> Geth["Ethereum Node<br/>(Geth, PoA)"]
Geth -- Smart Contract Calls --> Contracts["Smart Contracts<br/>(Solidity)"]
Backend -- REST API --> Frontend["Frontend<br/>(React)"]
- Blockchain: Ethereum (Geth, Proof of Authority)
- Smart Contracts: Solidity
- Backend: Node.js, Express, Web3.js
- Frontend: React.js (Create React App)
- Dev Tools: Truffle, Homebrew (for Mac), npm
- Raspberry Pi 5 (or Mac/Linux PC)
- Raspberry Pi OS Lite 64-bit (or compatible Linux/MacOS)
- Node.js (>=18)
- npm
- Geth (Go Ethereum)
- Truffle
- Git
brew tap ethereum/ethereum
brew install ethereum
brew install node
npm install -g trufflesudo apt update && sudo apt upgrade -y
sudo apt install build-essential curl git npm -y
wget https://gethstore.blob.core.windows.net/builds/geth-linux-arm64-1.15.11-xxxx.tar.gz
# (Download and extract the latest ARM64 geth release)git clone <repo-url> blockchain-vote-pi
cd blockchain-vote-piblockchain-vote-pi/
β
βββ contracts/ # Solidity smart contracts
β βββ DigitalIdentity.sol
β βββ Voting.sol
β
βββ migrations/ # Truffle migration scripts
β βββ 1_deploy_contracts.js
β
βββ backend/ # Node.js/Express backend API
β βββ package.json
β βββ src/
β βββ index.js
β βββ web3.js
β βββ contract.js
β
βββ frontend/ # React frontend
β βββ package.json
β βββ src/
β βββ App.js
β
βββ genesis.json # Blockchain genesis file
βββ truffle-config.js # Truffle config
βββ docs/ # Documentation images/screenshots
βββ README.md
The genesis.json file defines a private PoA network.
geth init genesis.json --datadir ./mychain
geth --datadir ./mychain --networkid 2025 --http --http.api personal,eth,net,web3,miner,clique --allow-insecure-unlock --mineThese commands start your own private blockchain node.
- Users register with a name and national ID.
- Each address can register only once.
- Deployed with a list of candidates.
- Each address can vote only once.
- Votes are stored transparently on-chain.
npx truffle compile
npx truffle migrate --network developmentAfter deployment, update contract addresses in
backend/src/contract.js.
- REST API built with Express.js
- Connects to blockchain via Web3.js
- Main endpoints:
GET /health: API health checkPOST /register: Register identityPOST /vote: Cast a voteGET /results: Get voting results
cd backend
npm install
node src/index.js- Minimalist, Apple-style React interface
- Register identity, vote, and view results
- Communicates with backend API
cd frontend
npm install
npm startOpen your browser at
http://localhost:3000
- Register Identity: Enter your name and national ID to register.
- Vote: Select a candidate and cast your vote.
- View Results: See live vote counts for each candidate.
All actions are recorded on the blockchain for transparency.
- After deploying contracts, update their addresses and ABIs in
backend/src/contract.js. - The Geth node and backend must run on the same machine or be accessible via HTTP API.
- During development, frontend and backend run on separate ports; the frontend uses a
proxysetting for API calls. - The codebase uses short, readable variable names and is designed for clarity.
- PoA network and short block times are used for fast, low-resource operation on Raspberry Pi.
MIT

