Newbie to Ethereum NFT contract deployment here. So please bear with my questions. I am trying to deploy a ERC-721 contract to ETH Mainnet and I have 0.285 ETH in my wallet. But I am still getting insufficient funds error. The contract is not very complicated and we were able to deploy same 3 months ago.

Am I making any rookie mistake in setting these values in my truffle_config?

Error: "Migrations" could not deploy due to insufficient funds

  • Account: 0x714D..........
  • Balance: 285585911447858493 wei
  • Message: insufficient funds for gas * price + value -- Reason given: Custom error (could not decode).

Command: truffle deploy --network mainnet


mainnet: {
  provider: () => new HDWalletProvider(mnemonic, `https://mainnet.infura.io/v3/${INFURA_APP_KEY}`),
  network_id: 1,
  confirmations: 2,   
  timeoutBlocks: 200,  
  gasPrice: 22000000000, //22 gwei
  gas: 59000000000,//59 gwei,


1 Answer 1


The gas limit you are using is too much. If you calculate the amount of ETH needed is around 1200ETH. EG

Deployment Fee (DF) = gasLimit * gasPrice + value
DF = 59000000000 * 22000000000 + 0
Total ETH = DF/1e18 = 1298 ETH

The gas limit should not be in gwei. Try using less gasLimit like 300000 or 500000 then

DF = 400000 * 22000000000 = 0.0088 ETH
  • Hello @Safi, Thank you for your reply. The current gas price was 43 GWEI and my transaction keeps running out of gas even if I set a gas price above the current price such as code' mainnet: { provider: () => new HDWalletProvider(mnemonic, mainnet.infura.io/v3/${INFURA_APP_KEY}), network_id: 1, confirmations: 2, timeoutBlocks: 200, gasPrice: 45000000000, gas: 2000000, //maxFeePerGas: 21000, //maxPriorityFeePerGas: 1000, }, code` ---------------------------------- Please help.
    – j7coder
    Commented Feb 15, 2023 at 18:38
  • try increase gas: 3000000 this will cost you approx. 0.13 ETH. This is too high to deploy a contract. Why don't you try remix.ethereum.org to deploy?
    – Safi
    Commented Feb 15, 2023 at 19:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.