You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error: cannot estimate gas; transaction may fail or may require manual gas limit (error={"reason":"cannot estimate gas; transaction may fail or may require manual gas limit","code":"UNPREDICTABLE_GAS_LIMIT","error":
reason: 'cannot estimate gas; transaction may fail or may require manual gas limit',
code: 'UNPREDICTABLE_GAS_LIMIT'
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Error which am receiving is too big. It includes
Error: cannot estimate gas; transaction may fail or may require manual gas limit (error={"reason":"cannot estimate gas; transaction may fail or may require manual gas limit","code":"UNPREDICTABLE_GAS_LIMIT","error":
reason: 'cannot estimate gas; transaction may fail or may require manual gas limit',
code: 'UNPREDICTABLE_GAS_LIMIT'
reason: 'processing response error',
code: 'SERVER_ERROR',
body: '{"jsonrpc":"2.0","id":49,"error":{"code":-32000,"message":"gas required exceeds allowance (0)"}}',
error: [Error],
requestMethod: 'POST',
url: 'https://eth-sepolia.g.alchemy.com/v2/inlhxdDcq4eucJwQRMyD_Ye0K5UdBN4Q'
},
method: 'estimateGas',
transaction: {
from: '0xC3811Db7f44F6FC49fc176c70e4dEC3279746041',
maxPriorityFeePerGas: [BigNumber],
maxFeePerGas: [BigNumber],
from: '0xC3811Db7f44F6FC49fc176c70e4dEC3279746041',
type: 2,
maxFeePerGas: BigNumber { _hex: '0x9502f924', _isBigNumber: true },
maxPriorityFeePerGas: BigNumber { _hex: '0x9502f900', _isBigNumber: true },
nonce: Promise { 0 },
gasLimit: Promise { [Circular *1] },
chainId: Promise { 11155111 }
code:const ethers = require("ethers");
const fs = require("fs-extra");
require("dotenv").config();
async function main() {
console.log(process.env.PRIVATE_KEY);
const provider = new ethers.providers.JsonRpcProvider(process.env.RPC_URL);
//const wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider);
const encryptedJson = fs.readFileSync(
"/media/kalki/030ABB616FC574C0/visualstudio/learnBlockchain/encrypted.json",
"utf8",
);
let wallet = new ethers.Wallet.fromEncryptedJsonSync(
encryptedJson,
process.env.PRIVATE_KEY_PASSWORD,
);
wallet = await wallet.connect(provider);
const abiPath =
"/media/kalki/030ABB616FC574C0/visualstudio/learnBlockchain/simpleStorage_sol_SimpleStorage.abi";
const binaryPath =
"/media/kalki/030ABB616FC574C0/visualstudio/learnBlockchain/simpleStorage_sol_SimpleStorage.bin";
const abi = fs.readFileSync(abiPath, "utf8");
const binary = fs.readFileSync(binaryPath, "utf8");
const contractFactory = new ethers.ContractFactory(abi, binary, wallet);
console.log("Deploying, please wait...");
const contract = await contractFactory.deploy();
const deploymentReceipt = await contract.deployTransaction.wait(1);
console.log(
Contract deployed to ${contract.address}
);let currentFavoriteNumber = await contract.retrieve();
console.log(
Current Favorite NumbAer: ${currentFavoriteNumber}
);console.log("Updating favorite number...");
let transactionResponse = await contract.store(7);
let transactionReceipt = await transactionResponse.wait(1);
currentFavoriteNumber = await contract.retrieve();
console.log(
New Favorite Number: ${currentFavoriteNumber}
);}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
I am using alchemy for rpc url and my fake metamask account has
0.9593SepoliaETH and 40 links
Beta Was this translation helpful? Give feedback.
All reactions