A modern, user-friendly frontend interface for interacting with blockchain smart contracts. This decentralized application (DApp) enables users to seamlessly connect their MetaMask wallet and interact with smart contracts deployed on Ethereum testnets.
This is a frontend-only repository for a blockchain-based decentralized application. The DApp provides an intuitive web interface that allows users to:
- Connect their crypto wallet (MetaMask)
- Interact with deployed smart contracts
- View real-time blockchain data
- Execute transactions on Ethereum testnets
Note: This project is built for educational purposes and operates exclusively on testnets (no real money involved).
- React.js - UI component library
- Vite - Fast build tool and dev server
- Tailwind CSS - Utility-first CSS framework
- ethers.js - Ethereum wallet implementation and contract interaction
- MetaMask - Browser wallet for authentication and transaction signing
- React Hooks - State management
- React Router - Client-side routing
- Axios - HTTP requests (if applicable)
- โ MetaMask Wallet Integration - Seamless wallet connection and disconnection
- โ Network Detection - Automatic testnet detection and switching
- โ Smart Contract Interaction - Read and write operations to deployed contracts
- โ Real-time Updates - Live blockchain data synchronization
- โ Transaction History - View past transactions
- โ Responsive Design - Mobile-friendly interface
- โ Error Handling - User-friendly error messages and notifications
- โ Loading States - Transaction pending indicators
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ React Application โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ UI Components (React) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Blockchain Service Layer โ โ
โ โ (ethers.js) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ MetaMask Provider โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Ethereum Testnet Network โ
โ (Smart Contracts) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Key Components:
- UI Layer: React components for user interaction
- Service Layer: Blockchain interaction logic using ethers.js
- Wallet Layer: MetaMask integration for transaction signing
- Smart Contract Layer: ABI-based contract communication
Before running this application, ensure you have the following installed:
- Node.js (v16.x or higher) - Download here
- npm or yarn - Package manager (comes with Node.js)
- MetaMask - Browser extension Install here
- MetaMask Wallet configured with a testnet
- Testnet ETH for gas fees (free from faucets)
- Sepolia: Sepolia Faucet
- Goerli: Goerli Faucet
- Basic understanding of blockchain and wallets
- Familiarity with React.js (helpful but not required)
Create a .env file in the root directory of the project:
# Contract Configuration
VITE_CONTRACT_ADDRESS=0xYourContractAddressHere
# Network Configuration
VITE_NETWORK_NAME=sepolia
VITE_CHAIN_ID=11155111
# RPC URL (optional - MetaMask provides this)
VITE_RPC_URL=https://sepolia.infura.io/v3/YOUR_INFURA_KEY
# Application Settings
VITE_APP_NAME=My DApp
VITE_APP_ENV=developmentImportant Notes:
- Replace placeholder values with your actual contract address
- Never commit
.envfiles to version control - Use
.env.examplefor documentation purposes
Follow these steps to set up the project locally:
git clone https://github.com/yourusername/dapp-frontend.git
cd dapp-frontendnpm install
# or
yarn install# Copy the example environment file
cp .env.example .env
# Edit .env file with your contract details
nano .env # or use your preferred editornpm run dev
# or
yarn devIf successful, you should see a message indicating the dev server is running (typically at http://localhost:5173).
npm run dev
# or
yarn dev- Opens at:
http://localhost:5173 - Hot reload enabled
- Development tools accessible
npm run build
# or
yarn buildnpm run preview
# or
yarn preview- Install the MetaMask browser extension
- Create a new wallet or import an existing one
- Save your seed phrase securely (never share it!)
- Open MetaMask
- Click the network dropdown (top center)
- Enable "Show test networks" in Settings โ Advanced
- Select Sepolia Test Network (or your preferred testnet)
- Copy your wallet address from MetaMask
- Visit a faucet:
- Sepolia: https://sepoliafaucet.com/
- Goerli: https://goerlifaucet.com/
- Paste your address and request testnet ETH
- Wait for confirmation (usually 1-2 minutes)
- Open the DApp in your browser
- Click "Connect Wallet" button
- Approve the connection in MetaMask popup
- Your wallet address should appear in the UI
- Ensure you're on the correct network
- Perform actions through the UI
- Confirm transactions in MetaMask
- Wait for transaction confirmation
Main landing page with wallet connection
Dashboard after successful wallet connection
Transaction confirmation interface
Note: Add your actual screenshots to the
/screenshotsdirectory
dapp-frontend/
โโโ public/ # Static assets
โ โโโ favicon.ico
โ โโโ assets/
โโโ src/
โ โโโ components/ # React components
โ โ โโโ Navbar.jsx
โ โ โโโ WalletConnect.jsx
โ โ โโโ ContractInteraction.jsx
โ โ โโโ TransactionList.jsx
โ โโโ services/ # Blockchain service layer
โ โ โโโ contract.js # Contract interaction logic
โ โ โโโ wallet.js # Wallet connection logic
โ โโโ utils/ # Utility functions
โ โ โโโ helpers.js
โ โ โโโ constants.js
โ โโโ hooks/ # Custom React hooks
โ โ โโโ useWallet.js
โ โ โโโ useContract.js
โ โโโ pages/ # Page components
โ โ โโโ Home.jsx
โ โ โโโ Dashboard.jsx
โ โโโ abi/ # Contract ABIs
โ โ โโโ contractABI.json
โ โโโ App.jsx # Root component
โ โโโ main.jsx # Entry point
โ โโโ index.css # Global styles
โโโ .env.example # Environment variables template
โโโ .gitignore
โโโ package.json
โโโ vite.config.js # Vite configuration
โโโ tailwind.config.js # Tailwind CSS configuration
โโโ README.md
Problem: MetaMask not detected
Solution:
1. Ensure MetaMask extension is installed
2. Refresh the page
3. Check if MetaMask is unlocked
4. Try a different browser
Problem: Wrong network connected
Solution:
1. Open MetaMask
2. Click network dropdown
3. Select the correct testnet (e.g., Sepolia)
4. Refresh the DApp
Problem: Transaction failed
Solution:
1. Check if you have enough testnet ETH
2. Verify gas price settings
3. Ensure you're on the correct network
4. Check contract address in .env file
Problem: "Error: could not detect network"
Solution:
1. Check your internet connection
2. Verify RPC URL in .env file
3. Try switching to a different RPC provider
4. Check if the testnet is operational
Problem: RPC rate limiting
Solution:
1. Use your own Infura/Alchemy API key
2. Add delays between requests
3. Implement request caching
Problem: "Module not found" errors
Solution:
1. Delete node_modules folder
2. Delete package-lock.json
3. Run: npm install
4. Restart dev server
Problem: Environment variables not loading
Solution:
1. Ensure .env file is in root directory
2. Variables must start with VITE_
3. Restart the dev server after changes
4. Check for typos in variable names
Problem: Contract functions not working
Solution:
1. Verify contract address in .env
2. Check if ABI file is up to date
3. Ensure contract is deployed on the connected network
4. Verify function signatures match the ABI
- Multi-wallet support (WalletConnect, Coinbase Wallet)
- Dark mode / Light mode toggle
- Transaction history with filtering
- ENS (Ethereum Name Service) integration
- Internationalization (i18n) support
- Advanced error logging and analytics
- Unit and integration tests
- Performance optimization with React.memo
- Web3 onboarding tutorial for new users
- Support for multiple networks (Polygon, Arbitrum)
- Gasless transactions using meta-transactions
- IPFS integration for decentralized storage
- Subgraph integration for better data querying
IMPORTANT: This project is for educational and testing purposes only.
- This DApp operates exclusively on Ethereum testnets
- No real money or mainnet assets are involved
- Testnet ETH has no monetary value
- Do not use this application with mainnet or real funds
- The developers are not responsible for any loss of funds
- Always verify smart contract addresses before interaction
- This is not financial advice
Security Notice:
- Never share your private keys or seed phrase
- Always verify transaction details before signing
- Use testnets for learning and development
- Conduct thorough security audits before mainnet deployment
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
For questions or feedback, please reach out:
- GitHub Issues: Report a bug
- Email: your.email@example.com
- Twitter: @yourhandle
- ethers.js documentation
- MetaMask documentation
- React documentation
- Tailwind CSS
- Ethereum development community
Built with โค๏ธ for the blockchain community
