MyToken Dapp is a decentralized application (DApp) that demonstrates the creation, minting, and transferring of an ERC20 token. The project includes both a backend (smart contract) written in Solidity and a frontend built with React and Material-UI. This DApp allows users to mint new tokens, transfer tokens to other addresses, and view transaction history and balances.
- Mint Tokens: Users can mint new tokens to their address.
- Transfer Tokens: Users can transfer tokens to another address.
- View Balance: Users can view their token balance.
- View Recipient Balance: Users can check the token balance of another address.
- Transaction History: Users can view the history of minting and transferring transactions.
- Solidity: For writing the smart contract.
- Hardhat: For compiling, deploying, and testing the smart contract.
- React: For building the frontend.
- Material-UI: For styling the frontend components.
- Ethers.js: For interacting with the Ethereum blockchain.
- Infura: For connecting to the Ethereum network.
Before you begin, ensure you have met the following requirements:
- Node.js and npm installed.
- A MetaMask wallet installed in your browser.
- An Infura account for connecting to the Ethereum network.
Follow these steps to set up and run the project locally.
git clone https://github.com/YOUR_GITHUB_USERNAME/MyTokenDapp.git
cd MyTokenDappNavigate to the project directory and install the necessary dependencies:
npm installSet the following environment variables in your terminal before running the Hardhat scripts:
export INFURA_API_KEY=YOUR_INFURA_PROJECT_ID
export SEPOLIA_PRIVATE_KEY=YOUR_PRIVATE_KEYUse Hardhat to compile the smart contract:
npx hardhat compileDeploy the smart contract to the desired network:
npx hardhat run scripts/deployer.js --network sepoliaNote: Replace sepolia with your desired network if necessary.
Start the frontend development server:
npm startOpen your browser and navigate to http://localhost:3000 to interact with the DApp.
- Mint Tokens: Enter the amount to mint and click "Mint".
- Transfer Tokens: Enter the recipient address and amount to transfer, then click "Transfer".
- Check Recipient Balance: Enter the recipient address and click "Check Recipient Balance".
- View Transaction History: View the list of minting and transferring transactions.
contracts/: Contains the Solidity smart contractMyToken.sol.scripts/: Contains the deployment scriptdeployer.js.src/: Contains the React frontend code.App.js: The main React component.MyToken.json: ABI of the deployed smart contract.
This project is licensed under the MIT License.
If you have any questions or feedback, feel free to reach out.