简体   繁体   中英

Truffle migration takes too much time

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM