getting an error while running deploy.js #5310
-
-----------------------deploy.js---------------------------- //importing ethers
const ethers = require("ethers");
//to import binary code
const fs = require("fs-extra");
async function main(){
//we get tht adress by running ganache
//this is how our script conects to our blockchain
// let provider = new ethers.JsonRpcProvider(process.env.RPC_URL)
const provider = new ethers.JsonRpcProvider("http://127.0.0.1:8545");
//connecting wallet using private key
const wallet = new ethers.Wallet("0xb712913d263fada6beb75f0c9b69b20f00c1218772e4f2fd8fde196f7cabc4cf",provider);
//reading abi and binary
//sync coz we wanna wait untill this file to get done
const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");
const binary = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.bin","utf8");
//utf8 is encoding option don need to wroyy abt it now
const contractFactory = new ethers.ContractFactory(abi,binary, wallet);
console.log("deploying..pls wait..");
const contract = await contractFactory.deploy({gasPrice: 100000});
//used await coz we are telling contact to stop here for contact to deploy
const deploymentReceipt = await contract.deploymentTransaction.wait(1);
console.log(deploymentReceipt);
//receipt u get after waiting for block conformation
//respponse u get when u create a transaction
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1)
}) ---------------------------------------error------------------------------- deploying..pls wait..
Error: could not coalesce error (error={ "code": -32000, "data": { "hash": "0x6341cc3ac27a0cb26b6cc189fdc104e02d7e174d302eda7d7b113e6067db92fa", "message": "Transaction's maxFeePerGas (100000) is less than the block's baseFeePerGas (765625000) (vm hf=shanghai -> block -> tx)", "programCounter": 0, "reason": null, "result": "0x6341cc3ac27a0cb26b6cc189fdc104e02d7e174d302eda7d7b113e6067db92fa" }, "message": "VM Exception while processing transaction: Transaction's maxFeePerGas (100000) is less than the block's baseFeePerGas (765625000) (vm hf=shanghai -> block -> tx)", "name": "RuntimeError", "stack": "RuntimeError: VM Exception while processing transaction: Transaction's maxFeePerGas (100000) is less than the block's baseFeePerGas (765625000) (vm hf=shanghai -> block -> tx)\n at Miner.<anonymous> (/root/blockchain-hh/ethers-simple-storage/node_modules/ganache/dist/node/1.js:2:160708)\n at async Miner.<anonymous> (/root/blockchain-hh/ethers-simple-storage/node_modules/ganache/dist/node/1.js:2:159016)\n at async Miner.<anonymous> (/root/blockchain-hh/ethers-simple-storage/node_modules/ganache/dist/node/1.js:2:157666)\n at async Miner.mine (/root/blockchain-hh/ethers-simple-storage/node_modules/ganache/dist/node/1.js:2:162256)\n at async Blockchain.mine (/root/blockchain-hh/ethers-simple-storage/node_modules/ganache/dist/node/1.js:2:72019)\n at async Promise.all (index 0)\n at async TransactionPool.emit (/root/blockchain-hh/ethers-simple-storage/node_modules/emittery/index.js:303:3)" }, code=UNKNOWN_ERROR, version=6.3.0)
at makeError (/root/blockchain-hh/ethers-simple-storage/node_modules/ethers/lib.commonjs/utils/errors.js:121:21)
at JsonRpcProvider.getRpcError (/root/blockchain-hh/ethers-simple-storage/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.js:632:41)
at /root/blockchain-hh/ethers-simple-storage/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.js:251:52
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
code: 'UNKNOWN_ERROR',
error: {
message: "VM Exception while processing transaction: Transaction's maxFeePerGas (100000) is less than the block's baseFeePerGas (765625000) (vm hf=shanghai -> block -> tx)",
stack: "RuntimeError: VM Exception while processing transaction: Transaction's maxFeePerGas (100000) is less than the block's baseFeePerGas (765625000) (vm hf=shanghai -> block -> tx)\n" +
' at Miner.<anonymous> (/root/blockchain-hh/ethers-simple-storage/node_modules/ganache/dist/node/1.js:2:160708)\n' +
' at async Miner.<anonymous> (/root/blockchain-hh/ethers-simple-storage/node_modules/ganache/dist/node/1.js:2:159016)\n' +
' at async Miner.<anonymous> (/root/blockchain-hh/ethers-simple-storage/node_modules/ganache/dist/node/1.js:2:157666)\n' +
' at async Miner.mine (/root/blockchain-hh/ethers-simple-storage/node_modules/ganache/dist/node/1.js:2:162256)\n' +
' at async Blockchain.mine (/root/blockchain-hh/ethers-simple-storage/node_modules/ganache/dist/node/1.js:2:72019)\n' +
' at async Promise.all (index 0)\n' +
' at async TransactionPool.emit (/root/blockchain-hh/ethers-simple-storage/node_modules/emittery/index.js:303:3)',
code: -32000,
name: 'RuntimeError',
data: {
hash: '0x6341cc3ac27a0cb26b6cc189fdc104e02d7e174d302eda7d7b113e6067db92fa',
programCounter: 0,
result: '0x6341cc3ac27a0cb26b6cc189fdc104e02d7e174d302eda7d7b113e6067db92fa',
reason: null,
message: "Transaction's maxFeePerGas (100000) is less than the block's baseFeePerGas (765625000) (vm hf=shanghai -> block -> tx)"
}
}
}
someone please help me solve this error |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Instead of using ganache using an alternate of that Run "yarn hardhat node" then there you will find an RPC URL link copy that and paste in your script also copy private key from one of the accounts displayed there |
Beta Was this translation helpful? Give feedback.
-
@ybhumi remove node_modules folder and package-lock.json or yarn.lock file. Then install the dependencies again. |
Beta Was this translation helpful? Give feedback.
@ybhumi remove node_modules folder and package-lock.json or yarn.lock file. Then install the dependencies again.