This project is Connect to Metamask Wallet, allowing users to interact with a smart contract. Smart contract function provide to store added number on Ethereum network, after read network and show output like sum of number and multiple of number, other function store text message on Ethereum Network after read stored message on network and show output.
Let's get start the project, follow the instructions below line by line.
- Node.js and npm should be installed on your machine.
- MetaMask extension should be installed in your web browser.
- Clone the repository:
git clone https://github.com/BUDDY1609/MetaMask-Wallet-Project
- Change to the project directory:
cd MetaMask-Wallet-Project
- Install the dependencies:
npm install
Follow the steps below to execute the program:
- Open three separate terminals in VS Code.
- In the first terminal, type and run:
npm i
- In the second terminal, type and run:
remixd
- In the third terminal, type and run:
npx hardhat node
- Open Remix IDE in your browser https://remix.ethereum.org/ and connect to
localhost
. - Connect MetaMask to the Hardhat server:
- In the MetaMask extension, click on the network selection dropdown (top-left corner in metamask).
- Click on Add network button.
- Scroll and Click on Add a network manually.
- after add value in network name. (anything name)
- Enter
http://localhost:8545
as New RPC URL. - Enter
31337
as the Chain ID. - add Currency symbol (anything), And Save it.
- Import an account or create a new one in MetaMask and switch to it.
- Open the
contract.sol
file. - Change the environment to
hardhat network
. - Compile and deploy the smart contract.
- Copy the contract address and paste it into the
FrontendMetamask.jsx
file as the value of thecontractAddress
variable. - Run the development server:
npm run dev
- Go to http://localhost:5173/ in your web browser.
- Click on the "Connect to MetaMask" button.
- Enter a number in the input Number value and click on "Store Number". Wait For confirm transaction.
- Click on "Sum Of Number" or "Multiple Of Number" to get the result.
- Hiren Patel
This project is licensed under the MIT License - see the LICENSE file for details