trufflesuite / truffle-hdwallet-provider

HD Wallet-enabled Web3 provider
MIT License
400 stars 167 forks source link

Using HDWalletProvider with infura to ropsten hangs at end #42

Closed michaeljohnbennett closed 6 years ago

michaeljohnbennett commented 6 years ago

After looking through a number of posts and issues I have to post a question here.

I can manage to deploy my contracts, finally after a lot of config but if the provider is instantiated it will time out the truffle migrate or truffle compile calls for some reason.

It seems isolated to infura calls within HDWalletProvider.

truffle.js:

require('babel-register');
require('babel-polyfill');

let ROPSTEN_MNEMONIC ="xxxxxx";
let INFURA_API_KEY = "xxxxx";
var HDWalletProvider = require("truffle-hdwallet-provider");

module.exports = {
    // See <http://truffleframework.com/docs/advanced/configuration>
    // to customize your Truffle configuration!
    networks: {
        ropsten: {
            provider: function () {
                return new HDWalletProvider(ROPSTEN_MNEMONIC,
                    "https://ropsten.infura.io/" + INFURA_API_KEY, 0);
            },
            network_id: '3',
            gas: 4712388,
            gasPrice: 80000000000 // 80 Gwei
        },
        development: {
            // GANACHE-cli settings
            host: "localhost",
            port: 8545,
            network_id: "*", // Match any network id
            gas: 4500000,
            gasPrice: 80000000000 // 80 Gwei
        },
    }
};

so when it runs with truffle migrate --network ropsten I can see it get through to ropsten but it will just hang on command line afterwards.

Similarly before I wrapped the call in a function to lazily instantiate it even truffle compile would hang at the end.

I think there is a timeout not kicking in or your not handling a promise somewhere in the case of infura API properly. It's very hard to ascertain what exactly as I can't really debug it or see any meaninful logs from a hanging program. It just sits there until you ctrl+c.

Is there anything I can do to debug this further?

Packages of interest:

0.0.5 truffle-hdwallet-provider
4.1.8 truffle
michaeljohnbennett commented 6 years ago

moving to truffle 4.1.11 fixes the issue

gititGoro commented 5 years ago

I have the exact same problem. Truffle v5.0.3

jaypersanchez commented 4 years ago

I have the same problem with Truffle 5.1.13. I am on Solidity 0.4.26 but I have the ">" pragma and my Node is 10.19.0 with Web3.js 1.2.1. Is there no solution to this problem?