I trying to deploy my contract but I cant. After deployed in ropsten and development, for some reason I can't deploy to mainnet.

Truffle v5.3.3 (core: 5.3.3)


enter image description here


enter image description here


compilers: {
    solc: {
      version: "0.8.0",
      // docker: true,
      settings: {
       optimizer: {
         enabled: true,
         runs: 1000

mainnet config

mainnet: {
        provider: () => new HDWalletProvider(mnemonic, `https://mainnet.infura.io/v3/xxxxx`),
        network_id: 1,
        gas: 5000000,
        gasPrice: 5e9,
        // confirmations: 2,
        from: 'xxx',
        // timeoutBlocks: 200,
        skipDryRun: true

My question is: how much gas do I need to put and how many blocks will be counted to deploy? At 57 the truffles broke, how much do you need to deploy?


I deploy to ropsten and works. But mainnet not.

enter image description here

  • Just deploy to a test chain (i.e local ganache) and check the report for "gas used" the OP_CODES have the same cost anyway, so you should set gas to that value or higher. For gas price, you can check it here (etherscan.io/gastracker) and choose the priority level that suits you best.
    – hroussille
    Commented Oct 28, 2021 at 21:36
  • I edit question to show you ropsten works. I need to change "gas" or "gasPrice"?
    – GIA
    Commented Oct 28, 2021 at 21:57

1 Answer 1


You need your gasPrice to be much higher. 1 Gwei is 1e9, and these days 60-100 gwei are "normal" gas prices. Often even more is needed. See here for current gas prices.

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.