ethereumweb3jstruffleconsensys-truffle

How can I disable the 750 second timeout when migrating with truffle?


I'm trying to deploy my smart contract to the Ethereum Mainnet using truffle.js. When migrating with a low gas price, the transaction for deploying the contract sometimes takes longer than 750 seconds and causes truffle to timeout.

Is there some way to disable the 750 second timeout when deploying smart contracts (migrating) to the mainnet? I would like to deploy my contract with a low gas price to reduce the cost, and am ok with waiting a long time for the TX to be mined.

Also, if the timeout IS hit and the TX gets mined later, can I still generate the same exact artifact files for the TX? Thanks.


Solution

  • Is there some way to disable the 750 second timeout when deploying smart contracts (migrating) to the mainnet? I would like to deploy my contract with a low gas price to reduce the cost, and am ok with waiting a long time for the TX to be mined.

    No. Truffle uses web3 lib with default wait set to 50 blocks. (So it will wait 50 blocks for the tx to be mined before timing out). You can likely get away with increasing this a lot to acheieve what you want--see: https://www.trufflesuite.com/docs/truffle/reference/configuration

    However, when the gas price is set very low there is a possibility that it never gets picked up by miners on the network. So without a timeout the process could hang forever.

    Also, if the timeout IS hit and the TX gets mined later, can I still generate the same exact artifact files for the TX? Thanks.

    I'm not sure what you mean here. The artifact files are generated after a contract is compiled. Maybe you are referring to getting the transaction hash? It is always best to check a service like etherscan or trueblocks for the state of your transaction.