0

I´m having problem migrating my contracts to the private blockchain. That blockchain is located in a CentOS VirtualMachine instance. With the Geth console I connect to the blockchain and I unlock one account.

1

Then I open a new terminal and I open the Truffle console. First I compile the code (compile --reset) and then I migrate the contracts (migrate --reset). But the Truffle console answer me the following:

Error encountered, bailing. Network state unknown. Review successful transactions manually. Error: authentication needed: password or unlock at Object.InvalidResponse (C:\Users\emendez\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\errors.js:38:1) at C:\Users\emendez\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\requestmanager.js:86:1 at C:\Users\emendez\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-migrate\index.js:225:1 at C:\Users\emendez\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-provider\wrapper.js:134:1 at XMLHttpRequest.request.onreadystatechange (C:\Users\emendez\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\httpprovider.js:128:1) at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\emendez\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:64:1) at XMLHttpRequest._setReadyState (C:\Users\emendez\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:354:1) at XMLHttpRequest._onHttpResponseEnd (C:\Users\emendez\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:509:1) at IncomingMessage. (C:\Users\emendez\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:469:1) at IncomingMessage.emit (events.js:187:15) at IncomingMessage.EventEmitter.emit (domain.js:460:23) at endReadableNT (_stream_readable.js:1094:12) at process._tickCallback (internal/process/next_tick.js:63:19)

My truffle migration js file:

var Migrations = artifacts.require("./Migrations.sol");
var Strings = artifacts.require("./lib/Strings.sol");
var DateTime = artifacts.require("./lib/DateTime.sol");
var Travel = artifacts.require("./Travel.sol");

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

All the files works because doing proves with Ganache was working, now that I have changed the test environment to a virtual host with a private implemented blockchain i have this problem.

I change also the truffle config parameters:

module.exports = {
  networks: {
    development: {
      host: "127.0.0.1",
      port: 22000,
      network_id: "*" // Match any network id
    }
  },
  compilers: {
    solc: {
      version: "0.4.24"
    }
 }
};

I look to many post with the same error response but I still having the issue. So I make this post to try to solve the problem.

EDIT

I execute this commands in the geth console but still having the same issue.

eth.defaultAccount = eth.accounts[4]
miner.setEtherbase(eth.accounts[4])
personal.unlockAccount(eth.accounts[4], "blockchain")
1

Multiple things could be happening here, but likely the account you are using to deploy is not the one you are unlocking.

If you don't specify otherwise by default, truffle uses eth.accounts[0], is not unlocked and therefore fails.

You can try to specify the deployer account in your config file by adding this in your truffle config inside development object

from: '0xYourAddress'

Or you can specify it during deployment by following this structure:

deployer.deploy(Strings, {from: "0xYourAddress"});

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.