Skip to content

PiggyBank

React + Solidity dApp to deposit and withdraw ETH on Sepolia with MetaMask integration, contract/wallet balance views, address lookup, and a ReentrancyGuard-protected smart contract.

SolidityReactEVM

Overview

PiggyBank is a simple, security-minded ETH vault on Sepolia: a Solidity smart contract that lets users deposit and withdraw ETH, plus a React frontend that makes the flow intuitive (connect wallet → deposit/withdraw → verify balances). The contract uses OpenZeppelin’s ReentrancyGuard to protect withdrawals.


What it demonstrates

  • Full dApp loop: wallet connect → contract calls → UI state updates
  • Practical ETH UX: deposit, withdraw, and balance visibility
  • Secure-by-default contract pattern (reentrancy protection)
  • Two-repo split (frontend vs contract) for clean separation of concerns

Key features

  • MetaMask wallet connection
  • Deposit and withdraw ETH
  • View wallet + contract balances
  • Check any address balance
  • ethers.js interactions
  • ReentrancyGuard-protected withdrawals

This deployment runs on Sepolia (testnet). Test ETH and onchain state there are for development only.


Live demo


Contract details

  • Network: Sepolia (Chain ID: 11155111)
  • Contract address: 0xc810bf49064D3eC2e1583a143948eD35f11d3E30

Quickstart (frontend)

Bash
git clone https://github.com/casaisdev/piggybank-dapp.git

See the README for setup and env vars.


Notes

  • The dApp is intentionally small and focused: deposit/withdraw + balance visibility.
  • Keep .env private (never commit keys / secrets).
  • Sepolia is a great place to test UX without risking real funds.

Next steps

If I were to evolve PiggyBank further:

  • Add per-user deposit history (indexer or event-based UI)
  • Add “withdraw partial amount” (instead of all-or-nothing)
  • Add better UX safety rails (confirm screens, warnings, tx simulation)
  • Add unit tests for contract edge cases + frontend interaction tests