Autollet

A decentralized voting dApp using MultiBaas for simplified blockchain interactions via REST APIs.

Autollet

Created At

ETHGlobal Buenos Aires

Project Description

AIWallet Voting dApp is a decentralized voting application that lets users cast and manage votes on blockchain via a web interface. Built as a frontend-only dApp using MultiBaas as middleware to simplify blockchain interactions. Core Functionality: The app presents voting options (currently configured for 5 choices). Users connect a Web3 wallet (MetaMask, WalletConnect, etc.) via RainbowKit, view real-time vote counts, and cast votes by signing transactions. Users can change their vote or clear it, with all changes recorded on-chain.

How it's Made

Architecture Overview: This is a frontend-only decentralized voting app that uses MultiBaas (Curvegrid) as a middleware layer to simplify blockchain interactions. The app has two parts: a Hardhat project for smart contract deployment and a Next.js frontend for user interaction. Technologies & Stack: Frontend: Next.js 14 with TypeScript, React 18, Tailwind CSS Blockchain: Solidity 0.8.24, Hardhat with MultiBaas plugin Wallet Integration: RainbowKit + Wagmi + Viem State Management: React hooks (useState, useEffect, useCallback) and TanStack Query Partner Technology: MultiBaas SDK for blockchain abstraction How They're Pieced Together: Smart contract deployment: Hardhat compiles SimpleVoting.sol and uses the MultiBaas plugin to deploy and register it with MultiBaas, which manages the contract ABI and address mapping. Frontend architecture: A custom useMultiBaas hook wraps the MultiBaas SDK to provide typed functions (getVotes, castVote, clearVote, etc.). The hook uses React's useMemo and useCallback to optimize API client instances and prevent unnecessary re-renders. Transaction flow: When a user votes, the frontend calls MultiBaas via REST API to get a formatted, unsigned transaction. The transaction is passed to Wagmi, which prompts the user's wallet (via RainbowKit) to sign. After signing, Wagmi broadcasts it to the network. State synchronization: The app polls MultiBaas for vote counts and user vote status, updating the UI reactively using useEffect hooks that trigger on wallet connection and transaction receipts.

background image mobile

Join the mailing list

Get the latest news and updates

Autollet | ETHGlobal