How ganesh1583/piggybank-project works
Project type and purpose
• This is a full-stack Ethereum dApp (“piggybank-project”) comprising:
• An on-chain component (Solidity smart contract)
• Off-chain tooling for deployment and testing (Hardhat-based scripts)
• A single-page React/Vite frontend that interacts with the contract via Ethers.js and MetaMask
File structure
• Top-level directories:
• backend/ — Hardhat environment for compiling, testing, and deploying the EtherPiggyBank.sol contract
• frontend/ — Vite + React application that provides UI and Ethers.js integration
• Key backend subdirectories:
• contracts/ — contains EtherPiggyBank.sol
• scripts/ — deploy.js for deploying to Sepolia
• test/ — JavaScript tests against the contract
• hardhat.config.js — network configuration, compiler settings
• Key frontend subdirectories:
• src/ — React components (App.jsx, main.jsx), CSS, and an autogenerated ABI/address file (etherPiggyBank.js)
• public/index.html — single HTML entry point
• vite.config.js — build setup
README insights
• The README describes:
• Core functionality (deposit/withdraw Ether)
• Stack (Solidity, Hardhat, React, Vite, Ethers.js)
• Workflow (install, deploy to Sepolia, run frontend, MetaMask config)
• No external database: the blockchain itself is the persistent data store
• User’s Web Browser + MetaMask extension
• Frontend Application (React/Vite)
• Ethers.js library
• Ethereum Node or JSON-RPC provider (e.g., Infura/Alchemy or local Hardhat node)
• Smart Contract (EtherPiggyBank.sol) deployed on Sepolia Testnet
• Hardhat Toolkit (for compile, test, deploy) – optional to include dev pipeline
b. Relationships and interactions:
• Browser ←→ Frontend: HTTP(S) to load React assets
• Frontend ↔ Ethers.js: JavaScript API calls to prepare transactions/calls
• Ethers.js ↔ MetaMask: Request user signature for transactions
• MetaMask ↔ Ethereum Node (Sepolia): Broadcast signed TXs to network
• Ethereum Node ↔ Smart Contract: Execute deposit/withdraw calls and return transaction receipts/state
• Hardhat scripts → Ethereum Node: Deployment step (one-way)
c. Architectural patterns/design principles:
• Separation of concerns: UI layer vs. blockchain logic
• Client-side heavy: no centralized backend server, purely peer-to-peer with blockchain
• Modular contract and ABI generation for front-end integration
d. Key technologies/frameworks:
• Solidity (contract language)
• Hardhat (development, testing, deployment)
• React + Vite (frontend UI and bundler)
• Ethers.js (blockchain interaction library)
• MetaMask (user wallet for signing transactions)