0

I am having an issue deploying to ropsten. I am receiving an insufficient funds error but I believe my address to have ether on ropsten.

This command:

truffle migrations --network ropsten

Also Tried: truffle deploy --network ropsten

Note, the next commands deploy successfully: truffle deploy --network development truffle migrations --network mainnet

config:

'use strict';

const keys = require("./private.js");
let privateKeyMain = keys.main;
let privateKeyRopsten = keys.test
let mainApiKey = keys.mainApiKey
let ropstenApiKey = keys.ropstenApiKey
let mnemonic = keys.mnemonic
var HDWalletProvider = require("truffle-hdwallet-provider");


require('dotenv').config();
const Web3 = require("web3");
const web3 = new Web3();
const WalletProvider = require("truffle-wallet-provider");
const Wallet = require('ethereumjs-wallet');

/*
var mainNetPrivateKey = new Buffer(privateKeyMain, "hex")
var mainNetWallet = Wallet.fromPrivateKey(mainNetPrivateKey);
// var mainNetProvider = new WalletProvider(mainNetWallet, "mainnet.infura.io/v3/" + mainApiKey);

var ropstenPrivateKey = new Buffer(privateKeyRopsten, "hex")
var ropstenWallet = Wallet.fromPrivateKey(ropstenPrivateKey);
*/

var mainNetProvider = new HDWalletProvider(mnemonic, "https://mainnet.infura.io/v3/" + mainApiKey);
// var ropstenProvider = new HDWalletProvider(mnemonic, "https://rinkeby.infura.io/v3/" + ropstenApiKey);
var ropstenProvider = new HDWalletProvider(mnemonic, "ropsten.infura.io/v3/cb06dad7697b45b3999d15a8745be75c" + ropstenApiKey);/*
development: {
      host: "127.0.0.1",
      port: 8545,
      network_id: "*"
    },
mainnet: {
  provider: mainNetProvider,
  gas: 4600000,
  gasPrice: web3.utils.toWei("20", "gwei"),
  network_id: "1",
}
*/
module.exports = {
  networks: {

    ropsten: {
      provider: ropstenProvider,
      // You can get the current gasLimit by running
      // truffle deploy --network rinkeby
      // truffle(rinkeby)> web3.eth.getBlock("pending", (error, result) =>
      //   console.log(result.gasLimit))
      gas: 4600000,
      gasPrice: web3.utils.toWei("20", "gwei"),
      network_id: "4",
    },

  },

  compilers: {
    solc: {
      version: "0.5.0",
    }
  },

  solc: {
    optimizer: {
      enabled: true,
      runs: 1
    }
  },

  mocha: {
    reporter: 'eth-gas-reporter',
    reporterOptions: {
      currency: 'USD',
      gasPrice: 10
    }
  }
};

My error

Error: * Deployment Failed *

"Migrations" could not deploy due to insufficient funds * Account: 0x1a3681a9f7A10210Ed71E867821543CC8c85c71b * Balance: 0 wei * Message: insufficient funds for gas * price + value * Try: + Using an adequately funded account + If you are using a local Geth node, verify that your node is synced.

at /Users/jakemartin/.nvm/versions/node/v10.9.0/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.5 (core: 5.0.5) Node v10.9.0

It occurs during the deployment of migrations.

But if you look up that address at ropsten.etherscan, it has funds. Check for yourself! https://ropsten.etherscan.io/address/0x1a3681a9f7a10210ed71e867821543cc8c85c71b

I'm stuck - advice appreciated

----UPDATE-----

Now it just hangs...

Only things I changed are gasPrice and gas.

New ropsten config:

 ropsten: {
    provider: ropstenProvider,
    // You can get the current gasLimit by running
    // truffle deploy --network rinkeby
    // truffle(rinkeby)> web3.eth.getBlock("pending", (error, result) =>
    //   console.log(result.gasLimit))
    gas: 6500000,
    gasPrice: web3.utils.toWei("400", "gwei"),
    network_id: "4",
  }
  • Now it just hangs... Only things I changed are gasPrice and gas. – Jake Martin Aug 1 at 7:56
0

Your given network_id in networks: was wrong. It should be network_id :"3" if you are connecting with ropsten. network_id :"4" present rinkeby testnet.

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.