1

It is showing error on migrating to the testnetwork-

$ truffle migrate --network ourTestNet

Compiling ./contracts/Wrestling.sol...

Compilation warnings encountered:

/home/mayank/Desktop/Truffle/trial/contracts/Wrestling.sol:35:9: Warning: Invoking events without "emit" prefix is deprecated.
        WrestlingStartsEvent(wrestler1,wrestler2);
        ^---------------------------------------^
,/home/mayank/Desktop/Truffle/trial/contracts/Wrestling.sol:68:9: Warning: Invoking events without "emit" prefix is deprecated.
        EndOfRoundEvent(wrestler1Deposit,wrestler2Deposit);
        ^------------------------------------------------^
,/home/mayank/Desktop/Truffle/trial/contracts/Wrestling.sol:75:9: Warning: Invoking events without "emit" prefix is deprecated.
        EndOfWrestlingEvent(theWinner,gains);
        ^----------------------------------^

Writing artifacts to ./build/contracts

Using network 'ourTestNet'.

Running migration: 1_initial_migration.js
  Deploying Migrations...
  ... undefined
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: unknown account
    at Object.InvalidResponse (/usr/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/errors.js:38:1)
    at /usr/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/requestmanager.js:86:1
    at /usr/lib/node_modules/truffle/build/webpack:/~/truffle-migrate/index.js:225:1
    at /usr/lib/node_modules/truffle/build/webpack:/~/truffle-provider/wrapper.js:134:1
    at XMLHttpRequest.request.onreadystatechange (/usr/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/httpprovider.js:128:1)
    at XMLHttpRequestEventTarget.dispatchEvent (/usr/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:64:1)
    at XMLHttpRequest._setReadyState (/usr/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:354:1)
    at XMLHttpRequest._onHttpResponseEnd (/usr/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:509:1)
    at IncomingMessage.<anonymous> (/usr/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:469:1)
    at IncomingMessage.emit (events.js:185:15)
    at endReadableNT (_stream_readable.js:1101:12)
    at process._tickCallback (internal/process/next_tick.js:114:19)

Migration.sol-

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

truffle.js-

module.exports = {
  // See <http://truffleframework.com/docs/advanced/configuration>
  // to customize your Truffle configuration!
    networks: {
    development: {
      host: "127.0.0.1",
      port: 7545,
      network_id: "*" // Match any network id
    },
    ourTestNet: {
      host: "127.0.0.1",
      port: 7000,
      network_id: "*" 
    }
  }
};
2
  • Please do update the code with the truffle.js info Apr 3 '18 at 8:15
  • i have updated those files. Apr 3 '18 at 9:35
0

You are missing the default Migrations.sol file, which is required by truffle to store the current migration step. Usually, this file is created by truffle init, but you can also download it directly from the template project at GitHub -> https://github.com/trufflesuite/truffle-init-bare/blob/master/contracts/Migrations.sol

2
  • i am not missing that i have that included and the first account that is coinbase is unlocked too Apr 4 '18 at 6:26
  • Then try to delete your build subdirectory, call truffle compile and call migrate again.
    – ivicaa
    Apr 4 '18 at 6:27

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.