Ethers.js- Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.7.1) #2790
Answered
by
alymurtazamemon
vampireyogi
asked this question in
Q&A
-
const ethers = require("ethers");
const fs = require("fs");
async function main() {
//http://127.0.0.1:7545
const provider = new ethers.providers.JsonRpcProvider(
"http://127.0.0.1:7545"
);
const wallet = new ethers.Wallet(
"bc25181d11cf862593330d78ea716a9cbf9c1c63232f21f733ec8bbbf34b41c1",
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);
}); |
Beta Was this translation helpful? Give feedback.
Answered by
alymurtazamemon
Sep 22, 2022
Replies: 2 comments 1 reply
-
@vampireyogi |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
alymurtazamemon
-
@vampireyogi : And also correct this line as well! From this : There is a typo, It should be |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@vampireyogi
ethers.wallet
here W should be Capitalethers.Wallet