5

I basically followed this Zeppelin crowdsale tutorial, just changed the names of the contracts. I was able to successfully deploy on a local Ganache, but then when trying to deploy to the live ethereum network it fails on invalid address, apparently raised by migrating 1_initial_migration.js, which looks like this:

var Migrations = artifacts.require("./Migrations.sol");

module.exports = function(deployer) {
  deployer.deploy(Migrations);
};

and Migrations.sol looks like this:

pragma solidity ^0.4.17;

contract Migrations {
  address public owner;
  uint public last_completed_migration;

  modifier restricted() {
    if (msg.sender == owner) _;
  }

  function Migrations() public {
    owner = msg.sender;
  }

  function setCompleted(uint completed) public restricted {
    last_completed_migration = completed;
  }

  function upgrade(address new_address) public restricted {
    Migrations upgraded = Migrations(new_address);
    upgraded.setCompleted(last_completed_migration);
  }
}

Here is a screenshot from the terminal where truffle migration fails:

enter image description here

How is it possible that I can deploy to Ganache but not to the live network? Am I doing something wrong? Any suggestions?

3
  • 1
    apparently I'm running geth with --light modifier. can this be the reason?
    – shaharsol
    Commented Feb 23, 2018 at 19:23
  • that can be the reason, see: ethereum.stackexchange.com/questions/41028/…
    – n1cK
    Commented Jul 8, 2018 at 14:36
  • Can you deploy to a testnet, for example Ropsten? You should anyway always first deploy to a testnet before live. Commented Aug 12, 2018 at 18:46

1 Answer 1

2

I had faced similar issue I am able to resolve it after deleting JSON files from /build/contracts. Then I tried to redeploy the contract and it was done successfully.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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