0

0

Hi i am trying to migrate contract by using getch on oracle virtual box ubuntu. Although 1_initial_migration.js deploying it shows Block: 0 Seconds:16743 and it is not completed to deploy and also there is a 2_deploy_contract.js.Normally is it taking much time or deploy in a minute? What's wrong?Why it is not finished 1_initial_migration.js deploying and starting deploy 2_deploy_contract.js?

truffle migrate --reset --network rinkeby

Here is contract:

  pragma solidity 0.4.2;

  contract Election {
  // Read/write candidate
  string public candidate;

  // Constructor
  function Election () public {
   candidate = "Candidate 1";
  }
 }

migrations.sol

  pragma solidity >=0.4.21 <0.6.0;

  contract Migrations {
  address public owner;
  uint public last_completed_migration;

  constructor() public {
   owner = msg.sender;
  }

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



   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);
   }
 }

1_initial_migration.js

 const Migrations = artifacts.require("Migrations");

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

I had the same problem when migrating on private ethereum using geth. The problem was solved as soon as I started the mining process.
Make sure that your blocks are getting mined.

  • how to start mining process?truffle migrate --reset --network rinkeby do it? – jhdm Aug 20 at 18:50
  • truffle migrate --reset --network rinkeby it shows migrations dry-run, 1_initial_migration.js and 2_deploy_contracts.js shows block number ,timestamp, totl sent... like that. Then when starting migrations 1_initial_migration.js has transaction hash and blocks still be loaded and not finished. What should i do? @Prachi Sharma – jhdm Aug 20 at 18:54
  • truffle migrate --reset --network rinkeby it shows migrations dry-run, 1_initial_migration.js and 2_deploy_contracts.js shows block number ,timestamp, totl sent... like that. Then when starting migrations 1_initial_migration.js has transaction hash and blocks still be loaded and not finished. What should i do? – jhdm Aug 20 at 19:05
  • i use also miner.start() command but it still not finished, continue – jhdm Aug 20 at 19:09
  • After 30 minutes, it is done. Thank you so much! – jhdm Aug 20 at 20:22

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.