3

Hi I am using Geth and i try to truffle migrate but it gives error. truffle-config.js is belown:

development: {
  host: "127.0.0.1",     // Localhost (default: none)
  port: 8545,            // Standard Ethereum port (default: none)
  network_id: "4",       //rinkeby id
  from:"my address",
  gas: 1000   
 }

When I do truffle migrate using command -truffle migrate, I get this error.

 Error: Error: Error:  *** Deployment Failed ***
 "Migrations" ran out of gas (using a value you set in your network 
  config or deployment parameters.)
  * Block limit:  0x50e7c
  * Gas sent:     1000

at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-migrate/index.js:92:1)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)

Can you help me please?

jhdm
  • 147
  • 3
  • 8

2 Answers2

2

I solved the error by adding this code to the truffle config file.

   compilers: {
    solc: {
      version: "0.5.16",
      settings: {
        optimizer: {
          enabled: true, // Default: false
          runs: 1000, // Default: 200
        },
      },
    },
  },
  • Please provide additional details in your answer. As it's currently written, it's hard to understand your solution. – Community Sep 08 '21 at 11:33
1

It's exactly what the error says. ran out of gas (using a value you set in your network config or deployment parameters.)

gas: 1000 is not enough to deploy your contract

Vitaly Migunov
  • 4,297
  • 2
  • 19
  • 23
  • what should i write because when i write gas:4700000it also same error. i tried a lot of numbers – jhdm Aug 17 '19 at 14:36
  • 1
    You can try `6800000` since you deploying to rinkeby. You also can estimate how much gas your contract require via solc --gas yourContract.sol – Vitaly Migunov Aug 17 '19 at 14:52