A full-stack Web3 application demonstrating interactions with ERC20, ERC721, and ERC1155 smart contracts on Ethereum. Built with Next.js 15, Hardhat, and Ethers.js.
- ERC20 Token: Fungible token with minting capabilities
- ERC721 NFT: Non-fungible token contract with URI storage
- ERC1155 Multi-Token: Multi-token standard supporting Gold, Silver, and Bronze tokens
- Wallet Integration: Connect with MetaMask or any Web3 wallet
- Modern UI: Beautiful, responsive Web3 interface with dark mode support
- Full Test Coverage: Comprehensive Hardhat tests for all contracts
- Easy Deployment: Ready-to-use deployment scripts
- Node.js 18+ and npm
- MetaMask browser extension (for wallet connection)
- Git
- Frontend: Next.js 15 (App Router), TypeScript, Tailwind CSS
- Blockchain: Solidity, Hardhat, Ethers.js v6
- Smart Contracts: OpenZeppelin Contracts (ERC20, ERC721, ERC1155)
- Clone the repository:
git clone <your-repo-url>
cd eth-project- Install dependencies:
npm install- Compile smart contracts:
npm run compileRun all tests:
npm testTest specific contracts:
npx hardhat test test/MyToken.test.ts
npx hardhat test test/MyNFT.test.ts
npx hardhat test test/MyMultiToken.test.tsIn one terminal, start a local blockchain:
npm run nodeThis starts a Hardhat node with 20 test accounts, each pre-funded with 10,000 ETH.
In another terminal, deploy all contracts to the local network:
npm run deploy:localImportant: Copy the contract addresses from the output. You'll need to update them in app/lib/contracts/addresses.ts.
Open app/lib/contracts/addresses.ts and update the addresses:
export const CONTRACT_ADDRESSES = {
MyToken: "0x...", // From deployment output
MyNFT: "0x...", // From deployment output
MyMultiToken: "0x...", // From deployment output
};-
Open MetaMask
-
Go to Settings β Networks β Add Network
-
Add the following details:
- Network Name: Hardhat Local
- RPC URL: http://127.0.0.1:8545
- Chain ID: 1337
- Currency Symbol: ETH
-
Import a test account:
- Copy a private key from the Hardhat node output
- In MetaMask: Account menu β Import Account β Paste private key
npm run devOpen http://localhost:3000 in your browser.
- Click "Connect Wallet" button
- Approve the connection in MetaMask
- View your contract data!
eth-project/
βββ app/ # Next.js frontend
β βββ components/ # React components
β βββ hooks/ # Custom hooks (useWallet)
β βββ lib/ # Utilities and contract helpers
β βββ page.tsx # Main page
βββ contracts/ # Solidity smart contracts
βββ scripts/ # Deployment scripts
βββ test/ # Hardhat tests
βββ hardhat.config.ts # Hardhat configuration
βββ WALKTHROUGH.md # Detailed codebase walkthrough
npm run dev- Start Next.js development servernpm run build- Build for productionnpm run start- Start production servernpm run lint- Run ESLint
npm run compile- Compile contractsnpm test- Run all testsnpm run node- Start local Hardhat nodenpm run deploy:local- Deploy to local networknpm run deploy:sepolia- Deploy to Sepolia testnetnpm run clean- Clean cache and artifacts
Create a .env file for testnet deployment:
SEPOLIA_RPC_URL=https://sepolia.infura.io/v3/YOUR_PROJECT_ID
PRIVATE_KEY=your_private_key_here
ETHERSCAN_API_KEY=your_etherscan_api_keyFor frontend contract addresses:
NEXT_PUBLIC_TOKEN_ADDRESS=0x...
NEXT_PUBLIC_NFT_ADDRESS=0x...
NEXT_PUBLIC_MULTITOKEN_ADDRESS=0x...- Name: MyToken
- Symbol: MTK
- Initial Supply: 1,000,000 tokens
- Decimals: 18
- Features: Minting (owner only), transfers
- Name: MyNFT
- Symbol: MNFT
- Features: Minting with URI, unique token IDs
- Token Types:
- GOLD (ID: 0)
- SILVER (ID: 1)
- BRONZE (ID: 2)
- Features: Batch minting, individual minting
- Uses OpenZeppelin's audited contract libraries
- Access control with
Ownablefor minting functions - Follows standard ERC token implementations
For a detailed walkthrough of the codebase, see WALKTHROUGH.md.
- Get test ETH from Sepolia Faucet
- Set up
.envfile with your credentials - Deploy:
npm run deploy:sepoliaDeploy to Vercel, Netlify, or any static hosting platform:
npm run buildContributions are welcome! Please feel free to submit a Pull Request.
MIT License - feel free to use this project for learning and development.
- Hardhat Documentation
- Ethers.js v6 Documentation
- OpenZeppelin Contracts
- Next.js Documentation
- ERC Standards
- Always test contracts locally before deploying to testnets
- Never commit private keys or
.envfiles - Use testnet ETH for testing (free from faucets)
- Check gas prices before mainnet deployments
Built with β€οΈ for the Web3 community