Skip to main content
1 of 4
Nyxynyx
  • 1.2k
  • 1
  • 13
  • 30

Truffle migrate does not run 2_deploy_contracts.js

Created a truffle project using truffle init, edited truffle.js to use Infura's Rinkeby network. Installed the following npm packages

npm install ethereumjs-wallet bip39 [email protected] [email protected] zeppelin-solidity --save

However after truffle compile, runnning truffle migrate --network rinkeby does only a partial migrate. It does not go on to migrate 2_deploy_contracts.js.

Running migration: 1_initial_migration.js
  Deploying Migrations...
  ... 0xf7a1eea43cfe61d59f55a3f5ce8b1c33bc9d5b37c2486ebdc83fdf4d1ba03041

Anyone knows what might be the problem?


truffle.js

var bip39 = require("bip39");
var hdkey = require('ethereumjs-wallet/hdkey');
var ProviderEngine = require("web3-provider-engine");
var WalletSubprovider = require('web3-provider-engine/subproviders/wallet.js');
var Web3Subprovider = require("web3-provider-engine/subproviders/web3.js");
var Web3 = require("web3");

// Get our mnemonic and create an hdwallet
var mnemonic = "couch solve unique spirit wine fine occur rhythm foot feature glory away";
var hdwallet = hdkey.fromMasterSeed(bip39.mnemonicToSeed(mnemonic));

// Get the first account using the standard hd path.
var wallet_hdpath = "m/44'/60'/0'/0/";
var wallet = hdwallet.derivePath(wallet_hdpath + "0").getWallet();
var address = "0x" + wallet.getAddress().toString("hex");

var providerUrl = "https://rinkeby.infura.io/somekey";
var engine = new ProviderEngine();
engine.addProvider(new WalletSubprovider(wallet, {}));
engine.addProvider(new Web3Subprovider(new Web3.providers.HttpProvider(providerUrl)));
engine.start(); // Required by the provider engine.


module.exports = {
  networks: {
    development: {
      host: "localhost",
      port: 8545,
      network_id: "*" // Match any network id
    },

    rinkeby: {
        network_id: 4,
        provider: engine,
        from: address
    }
  }
};

Here's the output of truffle migrate --network rinkeby --verbose-rpc

Using network 'rinkeby'.

  Running migration: 1_initial_migration.js
     .> {
     .>   "jsonrpc": "2.0",
     .>   "id": 1,
     .>   "method": "eth_accounts",
     .>   "params": []
     .> }
   .<   {
   .<     "id": 1,
   .<     "jsonrpc": "2.0",
   .<     "result": [
   .<       "0xcede48d8ac162d1b08ed9419010de3c99f2cfdd6"
   .<     ]
   .<   }
     .> {
     .>   "jsonrpc": "2.0",
     .>   "id": 2,
     .>   "method": "net_version",
     .>   "params": []
     .> }
   .<   {
   .<     "id": 2,
   .<     "jsonrpc": "2.0",
   .<     "result": "4"
   .<   }
    Deploying Migrations...
     .> {
     .>   "jsonrpc": "2.0",
     .>   "id": 3,
     .>   "method": "net_version",
     .>   "params": []
     .> }
   .<   {
   .<     "id": 3,
   .<     "jsonrpc": "2.0",
   .<     "result": "4"
   .<   }
     .> {
     .>   "jsonrpc": "2.0",
     .>   "id": 4,
     .>   "method": "eth_sendTransaction",
     .>   "params": [
     .>     {
     .>       "from": "0xcede48d8ac162d1b08ed9419010de3c99f2cfdd6",
     .>       "gas": "0x47e7c4",
     .>       "gasPrice": "0x174876e800",
     .>       "data": "0x6060604052341561000f57600080fd5b5b60008054600160a060020a03191633600160a060020a03161790555b5b6101e58061003c6000396000f300606060405263ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630900f010811461005e578063445df0ac1461007f5780638da5cb5b146100a4578063fdacd576146100d3575b600080fd5b341561006957600080fd5b61007d600160a060020a03600435166100eb565b005b341561008a57600080fd5b610092610182565b60405190815260200160405180910390f35b34156100af57600080fd5b6100b7610188565b604051600160a060020a03909116815260200160405180910390f35b34156100de57600080fd5b61007d600435610197565b005b6000805433600160a060020a039081169116141561017c5781905080600160a060020a031663fdacd5766001546040517c010000000000000000000000000000000000000000000000000000000063ffffffff84160281526004810191909152602401600060405180830381600087803b151561016757600080fd5b6102c65a03f1151561017857600080fd5b5050505b5b5b5050565b60015481565b600054600160a060020a031681565b60005433600160a060020a03908116911614156101b45760018190555b5b5b505600a165627a7a723058205f879dec75723925844d4fd706c85432c3686fa32c9ccf4e7a6ca2b8bb0307380029"
     .>     }
     .>   ]
     .> }
     .> {
     .>   "id": 1507552744042366,
     .>   "jsonrpc": "2.0",
     .>   "params": [
     .>     "0xcede48d8ac162d1b08ed9419010de3c99f2cfdd6",
     .>     "pending"
     .>   ],
     .>   "method": "eth_getTransactionCount"
     .> }
   .<   {
   .<     "id": 1507552744042366,
   .<     "jsonrpc": "2.0",
   .<     "result": "0x13"
   .<   }
     .> {
     .>   "id": 1507552744515044,
     .>   "jsonrpc": "2.0",
     .>   "params": [
     .>     "0xf902741385174876e8008347e7c48080b902216060604052341561000f57600080fd5b5b60008054600160a060020a03191633600160a060020a03161790555b5b6101e58061003c6000396000f300606060405263ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630900f010811461005e578063445df0ac1461007f5780638da5cb5b146100a4578063fdacd576146100d3575b600080fd5b341561006957600080fd5b61007d600160a060020a03600435166100eb565b005b341561008a57600080fd5b610092610182565b60405190815260200160405180910390f35b34156100af57600080fd5b6100b7610188565b604051600160a060020a03909116815260200160405180910390f35b34156100de57600080fd5b61007d600435610197565b005b6000805433600160a060020a039081169116141561017c5781905080600160a060020a031663fdacd5766001546040517c010000000000000000000000000000000000000000000000000000000063ffffffff84160281526004810191909152602401600060405180830381600087803b151561016757600080fd5b6102c65a03f1151561017857600080fd5b5050505b5b5b5050565b60015481565b600054600160a060020a031681565b60005433600160a060020a03908116911614156101b45760018190555b5b5b505600a165627a7a723058205f879dec75723925844d4fd706c85432c3686fa32c9ccf4e7a6ca2b8bb03073800291ba0b65823e784f3eccb6aee7f2832d6780df2d345052fc59b18a5fc0b695d5e59b3a06c6dccd25ca9f120883ba6ffec3a7a22bc38a06fa50e71159ee00e1990fbfc7f"
     .>   ],
     .>   "method": "eth_sendRawTransaction"
     .> }
   .<   {
   .<     "id": 1507552744515044,
   .<     "jsonrpc": "2.0",
   .<     "result": "0xf2b4e82e4a806ad1adcd8ff4e6d5cad05ee99302a2265810e3de04fd3a652c33"
   .<   }
   .<   {
   .<     "id": 4,
   .<     "jsonrpc": "2.0",
   .<     "result": "0xf2b4e82e4a806ad1adcd8ff4e6d5cad05ee99302a2265810e3de04fd3a652c33"
   .<   }
    ... 0xf2b4e82e4a806ad1adcd8ff4e6d5cad05ee99302a2265810e3de04fd3a652c33
     .> {
     .>   "jsonrpc": "2.0",
     .>   "id": 5,
     .>   "method": "eth_newBlockFilter",
     .>   "params": []
     .> }
Nyxynyx
  • 1.2k
  • 1
  • 13
  • 30