I am trying to migrate the contract to ROPSTEN network. It fails for the following reason. Please advice.
migrate command
$env:MNEMONIC=' XX XX XX';truffle migrate --reset --network ropsten
Error
Error: There was a timeout while attempting to connect to the network at undefined.
Check to see that your provider is valid.
If you have a slow internet connection, try configuring a longer timeout in your Truffle config. Use the networks[networkName].networkCheckTimeout property to do this.
at Timeout._onTimeout (C:\Users\skmsu\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\provider\index.js:57:1)
at listOnTimeout (internal/timers.js:557:17)
at processTimers (internal/timers.js:500:7)
truffle-config.js
require('dotenv').config();
const HDWalletProvider = require('truffle-hdwallet-provider');
console.log('ab - from powershell file process.env.MNEMONIC : '+
process.env.MNEMONIC);
const infuraProvider = network => providerWithMnemonic(
process.env.MNEMONIC || '',
`https://${network}.infura.io/${process.env.INFURA_API_KEY}`
);
const providerWithMnemonic = (mnemonic, rpcEndpoint) =>
new HDWalletProvider(mnemonic, rpcEndpoint);
module.exports = {
// See <http://truffleframework.com/docs/advanced/configuration>
// to customize your Truffle configuration!
networks: {
development: {
host: 'localhost',
port: 8545,
network_id: '*', // eslint-disable-line camelcase
} ,
mainnet: {
provider: infuraProvider('mainnet'),
gasPrice: 10000000000, // 10 Gwei
gas: 4000000,
network_id: '1'
},
ropsten: {
provider: infuraProvider('ropsten'),
gasPrice: 1000000000, // 1 Gwei
gas: 4000000,
network_id: '3'
}
},
solc: {
optimizer: {
enabled: true,
runs: 200
}
}
};