A decentralized, mobile-first voting application built for the Base network and optimized for Farcaster Frames.
This Mini App allows users to create polls, cast votes on-chain, and view real-time results in a seamless, native-like interface. Built with OnchainKit, Next.js, and Wagmi.
- Create Polls: Users can launch new polls with a title and description directly on-chain.
- Vote On-Chain: Secure, immutable voting (Yes/No) recorded on the Base Sepolia network.
- Real-Time Results: Live progress bars showing community sentiment.
- Smart Wallet Integration: Seamless onboarding and interaction using Coinbase Smart Wallet.
- Mobile-First UX: Tabbed navigation and responsive design tailored for Farcaster mobile users.
- Duplicate Vote Prevention: Smart contract logic ensures one vote per FID (Farcaster ID).
- Framework: Next.js 14 (App Router)
- Blockchain SDK: OnchainKit & Wagmi
- Styling: Tailwind CSS & Lucide React
- Network: Base Sepolia Testnet
- Smart Contract: Solidity (Custom Voting Contract)
- Connect: Users connect their wallet (automatically handled via OnchainKit/MiniKit in Farcaster).
- Read: The app fetches the list of active polls and the user's voting status directly from the smart contract using
useReadContract. - Interact:
- Creating: Submits a
createPolltransaction to the blockchain. - Voting: Submits a
votetransaction. The UI updates optimistically or upon transaction confirmation.
- Creating: Submits a
- Verify: All data is stored on-chain, ensuring transparency and immutability.
git clone <your-repo-url>
cd mini-app-quickstart-templatenpm installCreate a .env.local file in the root directory:
NEXT_PUBLIC_ONCHAINKIT_API_KEY=your_cdp_api_keyGet your API Key from the Coinbase Developer Platform.
npm run devOpen http://localhost:3000 to view it in the browser.
The application interacts with a SimpleVoting contract deployed on Base Sepolia.
- Contract Address:
0x8269db0F48590229a1314906B8725F03F0A91bdC(Checklib/contract.tsfor the latest) - Key Functions:
createPoll(string title, string description, uint256 creatorFid)vote(uint256 pollId, bool voteYes, uint256 voterFid)getAllPolls()getUserVotedStatus(uint256 voterFid)
| Poll List | Create Poll |
|---|---|
| List of active polls with results | Form to create a new on-chain poll |
Built with 💙 on Base