I am trying to deploy a contract to Ropsten using Infura with the config file truffle.js
below. The deploy fails because the account listed in the error message has insufficient funds – however I do not recognise the account given. It does not appear in the top 15 accounts associated with my mnemonic (e.g. using MyEtherWallet). I am inserting my mnemonic in the format word word word word
.
The actual account 0 associated with my mnemonic has ample Ether from the faucet.
What am I doing wrong?
truffle.js
var HDWalletProvider = require("truffle-hdwallet-provider");
var mnemonic = "<MNEMONIC>";
var infuraAPIKey = "<INFURA-PROJECT-SECRET>";
const infuraUrl = 'https://mainnet.infura.io/'+infuraAPIKey;
const NonceSubprovider = require("web3-provider-engine/subproviders/nonce-tracker");
const createInfuraProvider = (mnemonic, infuraUrl) => {
let provider = new HDWalletProvider(mnemonic, infuraUrl);
provider.engine.addProvider(new NonceSubprovider());
return provider;
}
module.exports = {
networks: {
development: {
host: "localhost",
port: 7545,
network_id: "*" // Match any network id
},
rinkeby: {
host: "localhost",
provider: () => new HDWalletProvider(mnemonic, "https://rinkeby.infura.io/"+infuraAPIKey, 0),
port: 7545,
network_id: 4,
gas: 4712388
},
live: {
host: "localhost",
port: 8546,
provider: createInfuraProvider(mnemonic, infuraUrl),
network_id: 1,
gas: 4712388
}
},
compilers: {
solc: {
version: "0.4.24"
}
}
};
Error message:
1_initial_migration.js
======================
Deploying 'Migrations'
----------------------
Error: *** Deployment Failed ***
"Migrations" could not deploy due to insufficient funds
* Account: 0xdBB63dca232c0deF386758eAC53A0B7Cc558217b
* Balance: 0 wei
* Message: sender doesn't have enough funds to send tx. The upfront cost is: 9424776000000000 and the sender's account only has: 0
* Try:
+ Using an adequately funded account
+ If you are using a local Geth node, verify that your node is synced.
at /Users/technical/.nvm/versions/node/v10.15.3/lib/node_modules/truffle/build/webpack:/packages/truffle-deployer/src/deployment.js:364:1
at process._tickCallback (internal/process/next_tick.js:68:7)
Truffle v5.0.7 (core: 5.0.7)
Node v10.15.3