Lesson 5 -> Ganache Deploy "TypeError: unknown network" #5550
-
I'm having a problem deploying my deploy.js when connecting to Ganache. I tried both GUI and Terminal versions of Ganache; in both I've encountered the same problem. I'm using Gitbash instead of WSL. My node is v18.15.0. My Code: const ethers = require("ethers");
const fs = require("fs-extra");
async function main() {
const provider = new ethers.JsonRpcApiProvider("http://127.0.0.1:8545");
const wallet = new ethers.Wallet(
"e055466bf937491a0f4ed9eaab77fe7534b7b60f0e200fdb17289edb5c71ccca",
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 ...");
const contract = await contractFactory.deploy();
console.log(contract);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
The Error:
|
Beta Was this translation helpful? Give feedback.
Answered by
ShamsAli-fathi
May 26, 2023
Replies: 1 comment
-
Made a rookie mistake, JsonRpcApiProvide is wrong. JsonRpcProvide is the right one |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
alymurtazamemon
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Made a rookie mistake, JsonRpcApiProvide is wrong. JsonRpcProvide is the right one