trufflesuite / truffle-migrate

On-chain migrations management
17 stars 17 forks source link

Error when deploying migrations #32

Open nklipa13 opened 6 years ago

nklipa13 commented 6 years ago

I'm getting error when trying to deploy contract to Kovan or Rinkeby network.

Error encountered, bailing. Network state unknown. Review successful transactions manually.
Transaction cost exceeds current gas limit. Limit: 4704588, got: 6721975. Try decreasing supplied gas.

Steps to reproduce:

  1. mkdir TruffleTest
  2. cd TruffleTest
  3. truffle unbox metacoin
  4. change truffle.js to:
    
    const dotenv           = require('dotenv').config();
    const HDWalletProvider = require('truffle-hdwallet-provider-privkey');

const mnemonic = process.env.ETHEREUM_ACCOUNT_MNEMONIC;

module.exports = { networks: { kovan: { provider: function() { return new HDWalletProvider(mnemonic, https://kovan.infura.io/); }, network_id: '42', gasPrice: 1000000000 }, rinkeby: { provider: function() { return new HDWalletProvider(mnemonic, 'https://rinkeby.infura.io/'); }, network_id: '4', }, test: { provider: function() { return new HDWalletProvider(mnemonic, 'http://127.0.0.1:8545/'); }, network_id: '*', }, } }


5. `touch .env`
6. put `ETHEREUM_ACCOUNT_MNEMONIC=your_private_key` in .env file
7. `npm install dotenv`, `npm install truffle-hdwallet-provider-privkey`
6. run `truffle migrate --network=kovan`

This error is happening with any truffle project in three different laptops.
madjarevicn commented 6 years ago

I'm getting the same issue.

cgewecke commented 6 years ago

@madjarevicn @nklipa13

Could you see if setting the default gas key like this helps?

rinkeby: {
  provider: function() {
    return new HDWalletProvider(mnemonic, 'https://rinkeby.infura.io/');
  },
  network_id: '4',
  gas: 4700000
},
madjarevicn commented 6 years ago

Works for me.

nklipa13 commented 6 years ago

@cgewecke great, can you explain why is that? Because it worked two-three days ago? Thanks