Reputation: 1
I am new to deploying smart contracts with hardhat and am following a tutorial. However, after running const contract = await ethers.getContractAt("Decentratwitter","0x5FbDB2315678afecb367f032d93F642f64180aa3")
I get the following error. Any ideas on how to fix connection issues?
avinash@avinash-HP-Laptop-15-bw0xx:~$ cd twitter
avinash@avinash-HP-Laptop-15-bw0xx:~/twitter$ npx hardhat run scripts/deploy.js --network hardhat Decentratwitter deployed to: 0x5FbDB2315678afecb367f032d93F642f64180aa3 avinash@avinash-HP-Laptop-15-bw0xx:~/twitter$ npx hardhat console --network localhost Welcome to Node.js v14.19.3. Type ".help" for more information.
const contract = await ethers.getContractAt("Decentratwitter","0x5FbDB2315678afecb367f032d93F642f64180aa3") Uncaught HardhatError: HH108: Cannot connect to the network localhost. Please make sure your node is running, and check your internet connection and networks config at getContractAtFromArtifact (/home/avinash/twitter/node_modules/@nomiclabs/hardhat-ethers/src/internal/helpers.ts:337:19) at getContractFactoryByAbiAndBytecode (/home/avinash/twitter/node_modules/@nomiclabs/hardhat-ethers/src/internal/helpers.ts:280:21) at getSigners (/home/avinash/twitter/node_modules/@nomiclabs/hardhat-ethers/src/internal/helpers.ts:45:20) at EthersProviderWrapper.send (/home/avinash/twitter/node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20) at GanacheGasMultiplierProvider.request (/home/avinash/twitter/node_modules/hardhat/src/internal/core/providers/gas-providers.ts:306:23) at GanacheGasMultiplierProvider._isGanache (/home/avinash/twitter/node_modules/hardhat/src/internal/core/providers/gas-providers.ts:317:30) at HttpProvider.request (/home/avinash/twitter/node_modules/hardhat/src/internal/core/providers/http.ts:80:29) at processTicksAndRejections (internal/process/task_queues.js:95:5) at HttpProvider._fetchJsonRpcResponse (/home/avinash/twitter/node_modules/hardhat/src/internal/core/providers/http.ts:205:15)
Caused by: Error: connect ECONNREFUSED 127.0.0.1:8545
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1159:16)
at TCPConnectWrap.callbackTrampoline (internal/async_hooks.js:130:17)
Upvotes: 0
Views: 704
Reputation: 1
npx hardhat node
in your terminal. Leave the process running.npx hardhat run [script-name] --network localhost
Hope it helps!
Upvotes: 0