LESSON 5: 'Error: insufficient funds for intrinsic transaction cost ' #5752
-
I tried my level best to deploy the following code in VSCode but in spite of trying countless times to troubleshoot it won't work. Trying tweaking with the GAS parameters, manually connecting Metamask to Alchemy ETH Sepolia TESTNET, sufficient funds in wallet, nothing helped. I have run out of options as of now. Assistance of any sort would be highly regarded. @alymurtazamemon @PatrickAlphaC `const ethers = require("ethers"); async function main() { console.log("Deploying, please wait ..."); const gasPrice = ethers.utils.parseUnits(config.gasPrice, "wei"); const gasParameters = { const contract = await factory.deploy(gasParameters); console.log("Contract deployed:", contract.address); // Interact with the deployed contract const transactionResponse = await contract.store("7"); const updatedFavoriteNumber = await contract.retrieve(); main()
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
I ran your code without
|
Beta Was this translation helpful? Give feedback.
-
@COSMICnoob80 Is this resolved? |
Beta Was this translation helpful? Give feedback.
-
I have the same issue as you. After ensuring that my account is connected to the Sepolia network and there are funds in my account, I resolved the problem by running the encryptKey.js program again. It turned out that the private key had changed, but the encrypted code derived from the previous private key was not updated, causing the program to connect to a non-existent empty wallet every time. I hope my solution can help you as well. |
Beta Was this translation helpful? Give feedback.
I tried the following code snippet in which the gas parameters were amended, and it worked for me, thanks a lot for reaching out:
`async function main() {
const provider = new ethers.providers.JsonRpcProvider(process.env.RPC_URL);
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY, 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...");
// Set gasPrice and gasLimit here
const gasPrice = ethers.utils.parseUnits("10", "gwei"); // Adjust the gas price accordi…