Error deploying upgradeable contract on mainnet: PollingBlockTracker

Hi guys, I’m trying to deploy an upgradeable contract on Mainnet and i keep getting this error response:

> transaction hash:    0x326b38efb5660c0bc5bfea82febb12724c8732399e89a1890f726024725d081e
   ⠋ Blocks: 7            Seconds: 45Error: PollingBlockTracker - encountered an error while attempting to update latest block:
Error: getaddrinfo ENOTFOUND eth-mainnet.alchemyapi.io
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26)
    at PollingBlockTracker._performSync (/Users/apple/Downloads/ETH-GAS 2/node_modules/eth-block-tracker/src/polling.js:51:24)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

truffle-config.js

const HDWalletProvider = require('@truffle/hdwallet-provider');
const { alchemyApiKey, mnemonic } = require('./secret.json');

module.exports = {
  networks: {
    development: {
     host: "127.0.0.1",     // Localhost (default: none)
     port: 8545,            // Standard Ethereum port (default: none)
     network_id: "*",       // Any network (default: none)
    },

    live: {
      provider: () => new HDWalletProvider(mnemonic, `https://eth-mainnet.alchemyapi.io/v2/${alchemyApiKey}`),
      network_id: 1,       // Mainnet's id
      gas: 5500000, 
      confirmations: 2,    // # of confs to wait between deployments. (default: 0)
      timeoutBlocks: 200,  // # of blocks before a deployment times out  (minimum/default: 50)
      skipDryRun: true     // Skip dry run before migrations? (default: false for public nets )
    }
  },

  // Set default mocha options here, use special reporters etc.
  mocha: {
    // timeout: 100000
  },

  // Configure your compilers
  compilers: {
    solc: {
      version: "0.6.12",    // Fetch exact version from solc-bin (default: truffle's version)
      // docker: true,        // Use "0.5.1" you've installed locally with docker (default: false)
      // settings: {          // See the solidity docs for advice about optimization and evmVersion
      //  optimizer: {
      //    enabled: false,
      //    runs: 200
      //  },
      //  evmVersion: "byzantium"
      // }
    }
  }
};

I’ve deployed the contract on ropsten and Kovan network and it works perfectly but fails to deploy on mainnet

1 Like

Hi @DragonLord,

Getting your account from the transaction hash, there are two pending transactions from your account:

The current gas price is around 50 gwei, whilst your transactions are 20 gwei.

You will either need to wait for gas prices to drop otherwise you will need to clean these up, see: https://ethgasstation.info/blog/stuck-transaction-guide/

As an aside, I recommend using a different mnemonic for testnets and mainnet to reduce the risk of a mainnet mnemonic being compromised.

1 Like

Hi @abcoathup, Is there a way to set the gas price in truffle-config.js file?

1 Like

Hi @DragonLord,

Yes there is. Specify gasPrice in your network configuration.

See the Learn guides for an example:

Also see the Truffle documentation:

1 Like

Hi @DragonLord,

I assume that you were able to deploy after that. Did you need any more information?

1 Like

Hi @abcoathup, I was able to deploy the contract on mainnet thanks to the links you sent above.

1 Like

Hi @DragonLord,

Great to hear.

Etherscan supports proxies, so if you verify your implementation contract, then you can use Etherscan to read/write via the proxy.

1 Like