kevin@portfolio:~$ cat projects/onchain-todo-dapp.md
# Web3 · Decentralized Application
On-Chain Todo List dApp
A todo list where each task lives in a Solidity smart contract and is managed from a React app through MetaMask.
Numbers
Problem
A course project asked for a decentralized application. The chosen idea was a todo list whose data lives in a smart contract and not in local storage.
How it works
Each todo belongs to a wallet and is stored in a Solidity contract. The React frontend uses ethers.js and MetaMask. Reads go straight to the chain without a prompt, and writes open a MetaMask request and then refresh the list after confirmation. The contract runs on a local Hardhat chain and on Sepolia.
› hover or tap a node for a one-line explanation
- User Opens the React app.
- React frontend Shows todos, filters and transaction status.
- ethers.js Builds a contract instance with a provider or a signer.
- MetaMask The user confirms each write.
- Hardhat local or Sepolia Runs the transaction.
- TodoList contract Stores todos per wallet and emits events.
- Event listener The frontend refreshes when events arrive.
Key decisions
- 01
Todos are stored on-chain, and only the owner can toggle, delete or reorder them.
- 02
Deadlines are stored as a timestamp and the UI shows when one has passed. The contract does not act on it, because a state change needs a transaction.
- 03
The public demo uses Sepolia, because outside users cannot reach a local chain.
- 04
Wallet state lives in one hook that follows MetaMask account and network changes. Unsupported networks block reads and writes with a message.
- 05
Reads use a provider and writes use a signer, and a write waits for the receipt before the list reloads.
- 06
The frontend listens to the contract events and reloads only when the event belongs to the connected wallet. Listeners are removed on cleanup.
Results
- Contract deployed to Sepolia and the frontend is live on Vercel.
- Features include wallet connect, add, complete, delete, drag-and-drop reorder, deadlines and transaction feedback.
- 26 contract tests cover create, complete, delete, reorder, per-user isolation and revert cases.