0

Here is my genesis.json file

{ "config": { "chainId": 1994, "homesteadBlock": 0, "eip155Block": 0, "eip158Block": 0, "byzantiumBlock": 0 }, "difficulty": "400", "gasLimit": "2100000", "alloc": { "7b684d27167d208c66584ece7f09d8bc8f86ffff": { "balance": "100000000000000000000000" }, "ae13d41d66af28380c7af6d825ab557eb271ffff": { "balance": "120000000000000000000000" } } } 

Here is the truffle-config.js

networks { development: { host: "127.0.0.1", // Localhost (default: none) port: 8545, // Standard Ethereum port (default: none) network_id: "*", // Any network (default: none) from: "0x0000000000000000000000000000000000000001", gas: 200000, }, }; 

Here is the 1_initial_migration.js

const Migrations = artifacts.require("Migrations"); module.exports = function(deployer) { deployer.deploy(Migrations); }; 

I have kept the gas in the 1_initial_migration.js file lower than the gasLimit. But still, I find this error on using "truffle migrate":

Compiling your contracts...

===========================

Everything is up to date, there is nothing to compile.

Migrations dry-run (simulation)

===============================

Network name: 'development-fork'
Network id: 1
Block gas limit: 0x1388

1_initial_migration.js

======================

Deploying 'Migrations'


Error: Error: Error: * Deployment Failed *

"Migrations" exceeded the block limit (with a gas value you set).
* Block limit: 0x50e7c
* Gas sent: 20000
* Try:
+ Sending less gas.
+ Setting a higher network block limit if you are on a
private network or test client (like ganache).

at Object.run
(/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-migrate/index.js:84:1)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Truffle v5.0.18 (core: 5.0.18)
Node v8.10.0

Please give some solutions.

Thank you

12
  • gas: 20000 is insufficient for any transaction whatsoever, as the minimum is 21000, and that's for a simple transfer of funds. For deployment you're gonna need a lot more than that. Commented May 22, 2019 at 13:39
  • I made it gas: 200000. but still, the same error shows up. - @goodvibration Commented May 22, 2019 at 13:46
  • 1_initial_migration.js should contain code, not just some json object, what's going on here????? Commented May 22, 2019 at 13:51
  • i am really really sorry. i wrote wrong file name. kindly look into the question again, i have edited - @goodvibration Commented May 22, 2019 at 13:58
  • What is from doing in truffle-config.js??? Commented May 22, 2019 at 14:41

1 Answer 1

2
networks { development: { host: "127.0.0.1", // Localhost (default: none) port: 8545, // Standard Ethereum port (default: none) network_id: "*", // Any network (default: none) from: "0x0000000000000000000000000000000000000001", gas: 200000, }, }; 

from should be a valid ethereum address that has balance, use one of the accounts in your genesis file, change also your gas limit in the genesis file “gasLimit”: “0x8000000”.

And it is much easier and quicker to use Ganache instead of private BC

1
  • Yes. This issue resolved by switching from truffle develop to ganache-cli when running my tests. Commented May 4, 2021 at 17:16

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.