I am trying to use my account to deploy contracts. I used this to unlock my account :

$ web3.personal.unlockAccount(eth.accounts[0], "password")
$ web3.personal.unlockAccount(eth.accounts[0], "password", 1500000)

I have tried both of them and it still gives this error :

Running migration: 1_initial_migration.js
  Deploying Migrations...
  ... undefined
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: authentication needed: password or unlock
    at Object.InvalidResponse (/usr/lib/node_modules/truffle/build/cli.bundled.js:37295:16)
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:224765:36
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:66971:11
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:208348:9
    at XMLHttpRequest.request.onreadystatechange (/usr/lib/node_modules/truffle/build/cli.bundled.js:209773:13)
    at XMLHttpRequestEventTarget.dispatchEvent (/usr/lib/node_modules/truffle/build/cli.bundled.js:67130:18)
    at XMLHttpRequest._setReadyState (/usr/lib/node_modules/truffle/build/cli.bundled.js:67420:12)
    at XMLHttpRequest._onHttpResponseEnd (/usr/lib/node_modules/truffle/build/cli.bundled.js:67575:12)
    at IncomingMessage.<anonymous> (/usr/lib/node_modules/truffle/build/cli.bundled.js:67535:24)
    at emitNone (events.js:110:20)

I dont understand why this error persists even after the account has been unlocked. I do have enough balance (even though thats not the error). I am deploying on a private node but I have performed enough mining to have created the initial DAG as well as have some safe blocks.

  • Is truffle connecting to your geth instance? Are there another instances of geth runnig? You can try to add your address in the from field of truffle.js. – Ismael Sep 2 '17 at 18:07
  • Yes, truffle is getting connected. I added an unknown account into the from field in truffle and it told me so. There are no other geth instances running and I am already using the from field. – kneelb4darth Sep 3 '17 at 5:15
  • Which version of geth are you using? Where are you executing unlockAccount from (it should be from geth console)? – Ismael Sep 4 '17 at 15:20

A quick fix would be to set your defaultAccount and etherbase account to eth.accounts[0].
You can do this by running the following commands in your geth console:

eth.defaultAccount = eth.accounts[0]

and then run

personal.unlockAccount(eth.accounts[0], "password")

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.