Lesson 5: Error: missing revert data when deploying Solidity contract with ethers.js and Ganache #6220
Replies: 6 comments 9 replies
-
It should be |
Beta Was this translation helpful? Give feedback.
-
Please remove the ethers package from your node_modules. |
Beta Was this translation helpful? Give feedback.
-
hi @MahathirMohammadShuvo pragma solidity 0.8.19; {
"dependencies": {
"fs-extra": "^11.1.1",
"ethers": "^6.8.0",
"solc": "^0.8.19"
}
} I hope this helps |
Beta Was this translation helpful? Give feedback.
-
Has anyone been able to make this work with ethers ^6.8.0? I've tried the above suggestions but the error remains -- Error: missing revert data (action="estimateGas"... I also tried following the ethers 6.8.1 contract-deployment doc but remained no wiser after scratching my head for an hour or so. I have to admire Patrick's skill in converting documentation into working code. Edit: On further reflection and on discovering Truffle's sunsetting of Ganache's and their recommendation to migrate to Hardhat, I think I'll skip actually implementing the Ganache part of the course. |
Beta Was this translation helpful? Give feedback.
-
Check your ganache, you will see gas price and gas limit, copy them from the ganache app and enter them in your deploy method as below const main = async () => {
const provider = new ethers.providers.JsonRpcProvider(
"http://127.0.0.1:7545"
);
const wallet = new ethers.Wallet(
"0x98a70d1c37d4797a5259135df4006f57443009e3d56cc66d917625.............",
provider
);
// grab files and read from them
const ABI = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");
const BIN = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.bin", "utf8");
const factory = new ethers.ContractFactory(ABI, BIN, wallet);
console.log("deploying contract...");
await factory.deploy({ gasPrice: 20000000000, gasLimit: 6721975 });
};
And make sure to downgrade your solc version to 0.8.8 and solidity compiler to 0.8.7 to avoid further errors. |
Beta Was this translation helpful? Give feedback.
-
I need to know, is there any code snippet for solc that could work for future purposes |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm having an issue deploying a Solidity smart contract using ethers.js and Ganache. I have a simple contract called
SimpleStorage.sol
:I'm compiling the contract using the following command:
My deployment script
deploy.js
is as follows:When I run
node deploy.js
, I encounter the following error:I replaced actual contract data with
<data>
for readability. I've verified that my local development blockchain (Ganache) is running, and the wallet has sufficient ETH. I also ensured that the ABI and binary files are correctly generated and used in the deployment script.Any insights into what might be causing this error would be greatly appreciated. Thank you!
Node.js version: v18.16.0
ethers.js version: v6.8.0
solc version: v0.8.21
Ganache version: v2.7.1
Beta Was this translation helpful? Give feedback.
All reactions