Decentralized, transparent, and secure voting system on the Ethereum blockchain
Election DApp is a decentralized application for conducting transparent and immutable digital elections. Using Ethereum blockchain technology, the system ensures:
- 🔒 Security: Encrypted and immutable votes
- 🌐 Transparency: Results auditable by anyone
- 🚫 Anti-fraud: Impossible to alter or duplicate votes
- ⚡ Real-time: Instantly updated results
| Category | Technologies |
|---|---|
| Frontend | Next.js 16, React 19, TypeScript |
| Styling | Tailwind CSS 4, shadcn/ui, Lucide Icons |
| Web3 | Wagmi 2, Viem 2, TanStack Query |
| Smart Contract | Solidity, Foundry |
| Blockchain | Ethereum (Sepolia Testnet) |
- Node.js 18+
- Web3 Wallet (MetaMask recommended)
- ETH on Sepolia Testnet (for testing)
git clone https://github.com/joliv3ira/election-dapp.git
cd election-dappnpm install
# or
yarn install
# or
pnpm installCreate a .env.local file in the project root:
NEXT_PUBLIC_SEPOLIA_RPC=https://sepolia.infura.io/v3/YOUR_INFURA_PROJECT
NEXT_PUBLIC_CONTRACT_ADDRESS=0x... # Deployed contract addressnpm run devAccess http://localhost:3000 🎉
# Navigate to contracts directory
cd voting-contracts
# Build contracts
forge build
# Deploy to Sepolia
forge create src/Voting.sol:Voting \
--rpc-url sepolia \
--private-key YOUR_PRIVATE_KEY- Wallet connection (MetaMask, WalletConnect, etc.)
- Candidate registration and viewing
- Secure blockchain voting
- Voter eligibility verification
- Real-time results
- Candidate ranking
- Transaction history
- Responsive interface (mobile-first)
election-dapp/
├── app/ # App Router (Next.js 16)
│ ├── layout.tsx # Main layout
│ └── page.tsx # Home page
├── components/ # React components
│ ├── ui/ # shadcn/ui components
│ └── ... # Project components
├── hooks/ # Custom hooks
│ └── useVote.ts # Web3 voting hook
├── lib/ # Configurations and utilities
│ ├── wagmi.ts # Wagmi configuration
│ └── utils.ts # Utility functions
├── types/ # TypeScript definitions
├── voting-contracts/ # Smart Contracts (Foundry)
│ └── src/Voting.sol # Voting contract
└── README.md
- Connect your wallet - Click "Connect Wallet" and authorize in MetaMask
- Choose a candidate - Browse the list and select your candidate
- Confirm your vote - Review the information and confirm
- Approve the transaction - Confirm in MetaMask (0.025 ETH + gas)
- Done! - Your vote has been permanently recorded on the blockchain
⚠️ Important: Votes are irreversible and permanently recorded on the blockchain. Vote responsibly!
Contributions are welcome! Feel free to:
- Fork the project
- Create a branch for your feature (
git checkout -b feature/new-feature) - Commit your changes (
git commit -m 'Add: new feature') - Push to the branch (
git push origin feature/new-feature) - Open a Pull Request
This project is under the MIT license. See the LICENSE file for more details.
Made with ❤️ by Jorge Oliveira