From a4317211d76e880a4840544603d9bf864daa4db0 Mon Sep 17 00:00:00 2001 From: ankitkr104 Date: Tue, 28 Jul 2026 20:52:03 +0530 Subject: [PATCH] docs: add local testing instructions for Web3 interactions --- CONTRIBUTING.md | 3 +++ README.md | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 258be46..b6a768d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -34,6 +34,9 @@ To get your local environment set up for development, follow these steps: The application should now be running locally at `http://localhost:3000`. +4. **Testing Web3 Interactions:** + If you are testing smart contract interactions (like wallet connections, balances, or transactions), be sure to run a local blockchain node and import the test private keys. See the **[Web3 Local Testing](README.md#web3-local-testing-hardhat--foundry)** section in the README for full details. + ## Coding Style We maintain a consistent codebase to make it easier for everyone to read and contribute. Please adhere to the following guidelines: diff --git a/README.md b/README.md index 4eef14a..78d8723 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,23 @@ Open: http://localhost:3000 ``` +### Web3 Local Testing (Hardhat / Foundry) + +When testing smart contract interactions locally, you need to run a local blockchain node (Anvil or Hardhat Node) alongside this Web UI. + +1. **Start the local blockchain** (in your smart contracts directory): + ```bash + # If using Foundry + anvil + + # Or if using Hardhat + npx hardhat node + ``` +2. **Fund your wallet**: The local node generates pre-funded test accounts with 10,000 ETH. Since your personal MetaMask address has 0 ETH on the local network, you must import one of the test private keys to interact with the dApp. + - Example private key: `0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80` + - In MetaMask: `Accounts` -> `Add account or hardware wallet` -> `Import account` -> Paste the private key. +3. Make sure MetaMask is connected to `Localhost 8545`. If your balance still shows 0 or transactions fail, try resetting the network cache in MetaMask (`Settings` -> `Advanced` -> `Clear activity tab data`). + ## Build & Deployment ### Production Build