I can't deploy my smart contract with ganache #5149
-
Can someone please tell me what is wrong with my code? I am trying to deploy my smart contract using ganache but it keeps giving me a network error. My code below const ethers = require("ethers");
const fs = require("fs-extra");
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(
"b325addc3cb1a868d23a28d98d36e8a9a4618fa81e91834d64d7053854dbae2e",
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);
}); The error i am getting on the console
|
Beta Was this translation helpful? Give feedback.
Answered by
alymurtazamemon
Mar 22, 2023
Replies: 1 comment 1 reply
-
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
CoderB01
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@CoderB01 Check it out this discussion #286