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?


var HDWalletProvider = require("truffle-hdwallet-provider");
var mnemonic = "<MNEMONIC>";
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:


   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

1 Answer 1


HDWalletProvider and MyEtherWallet, They both are work differently so there is some alternative you can use:

  1. Using Private keys:
var HDWalletProvider = require("truffle-hdwallet-provider");
//load single private key as string
var provider = new HDWalletProvider("3f841bf589fdf83a521e55d51afddc34fa65351161eead24f064855fc29c9580", "http://localhost:8545");

// Or, pass an array of private keys, and optionally use a certain subset of addresses
var privateKeys = [
var provider = new HDWalletProvider(privateKeys, "http://localhost:8545", 0, 2); //start at address_index 0 and load both addresses
  1. Update Migration File to Get Addresses:
module.exports = function(deployer,network,accounts) {   
  • This still does not work. I changed your line console.log(a) to console.log(accounts) and it shows a different list of accounts each time. However, the Account listed by Truffle as the deploying account with no funds remains the same, and is unrelated to the private key. I am using MetaMask to extract the private key. Any other ideas?
    – user77510
    Mar 11, 2019 at 8:46
  • Either When you go for **console.log(accounts)** it will show all addresses that are generated so next time you know what address will be responsible for transaction and so you can fill that account with some ether. Or Instead of using **mnemonic** you can use private that can be extract from Metamask Mar 12, 2019 at 8:53
  • The trouble is, I don't have access to the addresses listed in the console. I have tried the mnemonic and private key approach, and the addresses that I see and fill with ether e.g. in Metamask, do not correspond with the addresses logged by Truffle.
    – user77510
    Mar 12, 2019 at 12:35
  • What I did was send some ETH to address showed on web3.eth.getAccounts() from truffle console. Mar 27, 2021 at 2:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.