ethers-simple-storage-fcc
ethers-simple-storage-fcc copied to clipboard
issue: i am having an issue while deploying the contract to local ganache
hi` all, at 7:08 hrs when I am trying to deploy my contract to local ganache it gets stuck there as my promise is not getting resolved
const ethers = require("ethers");
const fs = require("fs-extra");
async function main() {
//RPC SERVER
//HTTP://127.0.0.1:8545
const provider = new ethers.providers.JsonRpcProvider(
"HTTP://172.22.192.1:7545"
);
const wallet = new ethers.Wallet(
"76fe5a715ceefaaa33f4bc5732d89f0b6057a76605d478e199b865fb162c7729",
provider
);
const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");
const binary = fs.readFileSync(
"./SimpleStorage_sol_SimpleStorage.bin",
"utf8"
);
const contractFactory = new ethers.ContractFactory(abi, binary, wallet);
console.log("deploying please wait");
const contract = await contractFactory.deploy();
console.log(contract);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
here I'm copying my bash terminal:
ritesh@LAPTOP-TI9KIBT3:~/hardhatfcc/ethers-simple-storage$ node deploy.js
deploying please wait
after 10 mins console gave me output for network not found. i have already changed my server to vEthernetWSL
ritesh@LAPTOP-TI9KIBT3:~/hardhatfcc/ethers-simple-storage$ node deploy.js
deploying please wait
Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.6.8)
at Logger.makeError (/home/ritesh/hardhatfcc/ethers-simple-storage/node_modules/@ethersproject/logger/lib/index.js:233:21)
at Logger.throwError (/home/ritesh/hardhatfcc/ethers-simple-storage/node_modules/@ethersproject/logger/lib/index.js:242:20)
at JsonRpcProvider.<anonymous> (/home/ritesh/hardhatfcc/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:561:54)
at step (/home/ritesh/hardhatfcc/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:48:23)
at Object.throw (/home/ritesh/hardhatfcc/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:29:53)
at rejected (/home/ritesh/hardhatfcc/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:21:65) {
reason: 'could not detect network',
code: 'NETWORK_ERROR',
event: 'noNetwork'
}
ritesh@LAPTOP-TI9KIBT3:~/hardhatfcc/ethers-simple-storage$
yeah I'm getting the same error. I also tried vEthernet wsl and all interfaces option as well
Try the solution by Izmanovich from the other topic: https://github.com/PatrickAlphaC/ethers-simple-storage-fcc/issues/17
yeah I'm getting the same error. I also tried vEthernet wsl and all interfaces option as well
Have you refreshed the RPC server and the private key after changing to vEthernet wsl? The address changes, when you modify it - at least that was the issue in my case.
yeah I'm getting the same error. I also tried vEthernet wsl and all interfaces option as well
I was unable to resolve it . but instead I tried with hardhat which Patrick told in one of the discussions. go check out discussions and there you will find how to start rpc with hardhat. #90 discussion.
@ritesh798 what you're referring to is it present in the video itself?
What if I leave this current state of not being able to deploy using node deploy.js , can I still continue with the video or will I face some issues?
@gabucino yeah I did that and it Didn't work. Can I move forward with that video or should I continue looking for a solution to this cause its been 2-3 days since I've been stuck on this..
@gabucino yeah I did that and it Didn't work. Can I move forward with that video or should I continue looking for a solution to this cause its been 2-3 days since I've been stuck on t
its not resolved inn video go to github discussions section there in discussion #90 Patrick gave full guide to start hardhat rpc. you just have to start hardhat rpc in terminal and keep that terminal alive . Add new terminal for deployment . you will get hardhar rpc endpoint and private key on terminal replace them with genache and it will run.
@ritesh798 thank you bro for this great help.
Just one more thing is this normal that confirmations are 0 when I deployed it using hardhat?
@gabucino yeah I did that and it Didn't work. Can I move forward with that video or should I continue looking for a solution to this cause its been 2-3 days since I've been stuck on this..
@yatinkhandelwal try this https://github.com/PatrickAlphaC/ethers-simple-storage-fcc/issues/18#issuecomment-1166598141
Hey @ritesh798 why are you using "HTTP://172.22.192.1:7545"
instead of http://127.0.0.1:7545
.
Once these things were updated, I was able to deploy .
https://github.com/smartcontractkit/full-blockchain-solidity-course-js/discussions/34#discussioncomment-2846436
yarn add ganache
i found a solution for me i was using WIFI, so i just changed the ganache server settings to Wi-Fi and it worked fine, :)
i found a solution for me i was using WIFI, so i just changed the ganache server settings to Wi-Fi and it worked fine, :)
this might work because I was using wifi too. thanks
if ur using wsl ubuntu on a windows system it wont work https://github.com/smartcontractkit/full-blockchain-solidity-course-js/blob/main/chronological-updates.md#using-the-wsl-endpoint just go to this link and try any one of these steps and u should be fine :)
Hey I had a similar issue but all I needed to do was add parameters for the gas limit and price for it to run
const contract = await contractFactory.deploy({ gasPrice: 100000000000, gasLimit: 1000000 })
facing similar issue.
Error: missing revert data
async function main() {
const provider = new ethers.JsonRpcProvider("http://127.0.0.1:7545");
const wallet = new ethers.Wallet(
"0x5bfeadde64c28e87cce05498213276a4b12686d44d14df4537ec4398dac9d1aa",
provider
);
const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");
const binary = fs.readFileSync(
"./SimpleStorage_sol_SimpleStorage.bin",
"utf8"
);
const contractFactory = new ethers.ContractFactory(abi, binary, wallet);
const contract = await contractFactory.deploy();
console.log("Contract deployed at:", contract);
}
Solution -> https://github.com/PatrickAlphaC/ethers-simple-storage-fcc/issues/85#issuecomment-1712202485