3

I am running my own Ethereum client node (Open Ethereum 3.0.1). I am using Truffle migrate to deploy my smart contract to MainNet. However, the contract deployment is taking too long. The result from the migration command is below:

kevins-mbp:AuthentoFile_Repo kevinm$ truffle migrate --network mainnet --reset

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.


Migrations dry-run (simulation)
===============================
> Network name:    'mainnet-fork'
> Network id:      1
> Block gas limit: 9990236 (0x98705c)

1_initial_migration.js
======================

   Deploying 'Migrations'
   ----------------------
   > block number:        10288818
   > block timestamp:     1592471208
   > account:             0xaAF66209133056F1f7285D6cDb61Cf21D135f300
   > balance:             0.1797474439
   > gas used:            210237 (0x3353d)
   > gas price:           2 gwei
   > value sent:          0 ETH
   > total cost:          0.000420474 ETH

   -------------------------------------
   > Total cost:         0.000420474 ETH

2_deploy_contracts.js
=====================

   Deploying 'AuthentoFile'
   ------------------------
   > block number:        10288820
   > block timestamp:     1592471211
   > account:             0xaAF66209133056F1f7285D6cDb61Cf21D135f300
   > balance:             0.1769681859
   > gas used:            1362266 (0x14c95a)
   > gas price:           2 gwei
   > value sent:          0 ETH
   > total cost:          0.002724532 ETH

   -------------------------------------
   > Total cost:         0.002724532 ETH

Summary
=======
> Total deployments:   2
> Final cost:          0.003145006 ETH


Starting migrations...
======================
> Network name:    'mainnet'
> Network id:      1
> Block gas limit: 9990236 (0x98705c)


1_initial_migration.js
======================

   Deploying 'Migrations'
   ----------------------
   > transaction hash:    0x77eac6bee9baeb315e7e52d31d13a9ab4241676c2ec2b4a5e7cf2071281ffe1a


Error:  *** Deployment Failed ***

"Migrations" -- Transaction was not mined within 50 blocks, please make sure your transaction was properly sent. Be aware that it might still be mined!.

    at /usr/local/lib/node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:364:1
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:85:5)

As you can see, the contract deployment was not completed. I ran this 2 times so now I have the following pending transactions (at least 8+ hours old). The tx hashes for these pending tx are:

  • 0xc0a28527f1fcebc0bdf9ae18479831eaf026b350420a3134bcd14b44f520b812
  • 0x77eac6bee9baeb315e7e52d31d13a9ab4241676c2ec2b4a5e7cf2071281ffe1a

Will these transactions ever get mined? On my Ethereum node I see these as Pending Transactions. My Ethereum client is not configured to do any mining, so I am assuming that a miner on the network will eventually try to mine these transactions?

Any help/insight would be very much appreciated.

3 Answers 3

3

It is a gas price issue.

According to EtherScan you are using:

0.00000002 Ether (20 Gwei)

According to EthGasStation.info this is below the safe low at the moment:

enter image description here

Unless you want to get involved in a difficult game on cancelling old transactions, I suggest you create a new Ethereum account and try to deploy the contracts from there with higher gas price.

2
  • Thanks. I will wait a few days to see if the pending transactions ever get mined. After that, I will try to increase the gas price accordingly. Do you really believe I need to create a new account? What will happen if I run the truffle migrate with the same account? Commented Jun 18, 2020 at 19:46
  • If the account has a transaction with lower nonce being mined, all the transaction with the higher nonce, or later transactions, are stuck as well. Commented Jun 19, 2020 at 7:40
1

Well, how about that! My contract deployment to Ethereum mainnet completed! It took over 10 hours to be mined. I guess it's all about the GasPrice.

https://etherscan.io/tx/0xc0a28527f1fcebc0bdf9ae18479831eaf026b350420a3134bcd14b44f520b812

0

I had the same issue with the deployment to polygon mainnet. I tried out a couple of recommendation found in the web like setting timeout to 100000 or rising timeoutBlocks to 20000. Nothing really helped or lead to other errors.

It is like Mikko postet. You have to supply the correct values for gas and gasPrice. For me this was (truffle.js)

        polygonmainnet: {
            provider: function () { return new HDWalletProvider(MNEMONIC, polygonRpcUrlMainnet) },
            network_id: 137,
            confirmations: 2,
            timeoutBlocks: 20000,
            timeout: 100000,
            gas: 20000000,
            gasPrice: 40000000000,
            skipDryRun: true,
            chainId: 137,
            from: "0x49......",
        },

To calculate the amount you have to use you have to get the gas price from https://polygonscan.com/gastracker

This page helps you with the calculation: https://eth-converter.com

The parameters in the truffle.js you have to specify in Wei. With the parameters above you have a maximum price of 0,8 Matic for the deployment of one contract (for my contract I actually payed 0.11622268 Matic + 0.00705008 Matic for the Truffle Migrations contract)

While testing with Mumbai I did not have this problem. But when I started to depoly to the Polygon Mainnet the problem described above arised.

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.