This question already has an answer here:

I am new to this technology and I am trying to Deploy the contract to Ropsten test network. I have my geth running in one terminal. In my truffle console I have an account with some ether. I unlock it, then straight after in another terminal I go to my project directory to run truffle compile, then truffle migrate.

I get this error:

Running migration: 1_initial_migration.js
  Deploying Migrations...
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: account is locked
    at Object.module.exports.InvalidResponse (/usr/local/lib/node_modules/truffle/node_modules/ether-pudding/node_modules/web3/lib/web3/errors.js:35:16)
    at /usr/local/lib/node_modules/truffle/node_modules/ether-pudding/node_modules/web3/lib/web3/requestmanager.js:86:36
    at null.request.onreadystatechange (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/httpprovider.js:114:13)
    at null.dispatchEvent (/usr/local/lib/node_modules/truffle/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:591:25)
    at setState (/usr/local/lib/node_modules/truffle/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:610:14)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:447:13)
    at emitNone (events.js:72:20)
    at IncomingMessage.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:905:12)
    at doNTCallback2 (node.js:450:9)
    at process._tickDomainCallback (node.js:405:17)

I have changed my gas to different amounts but rolled it back, since that seems to not be the problem as I have enough ether.

I also googled the problem and it suggested I get the latest geth, I believe i do.

Can someone please help? I am totally new to this and completely lost and don't know what else to do. Perhaps I should use embark.

I appreciate any advice :) thank you beforehand

marked as duplicate by Rob Hitchens B9lab, Badr Bellaj, Nicolas Massart, Tjaden Hess, Matthew Schmidt Feb 4 '17 at 22:07

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Truffle is a great framework. I wouldn't steer you away from it. In my experience, this error is not misleading. I don't think the account is unlocked the way you think it is.

In geth, when you do:

web3.personal.unlockAccount("address")

it doesn't last very long at all. 30 seconds if memory serves. In any case, this might help:

web3.personal.unlockAccount(web3.personal.listAccounts[0], "password", 15000)
  • whatever address is first
  • put the password in the 2nd argument
  • unlock it for 15,000 seconds (so it won't bother you for a while).

Should respond true.

Hope I didn't flub the syntax. Just a handy phrase to know.

Hope it helps.

  • Hi Rob, thank you for the quick response. I have tried the second command but i get this error: Error: could not decrypt key with given passphrase at Object.module.exports.InvalidResponse (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/errors.js:35:16) at null.RequestManager.send (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/requestmanager.js:61:22) at Personal.send [as unlockAccount] (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/method.js:145:58) at evalmachine.<anonymous>:1:-47 @RobHitchens – Namu Ujin Na Feb 3 '17 at 22:45
  • 1
    Password error. Also probably not misleading. Put your real password in there where I said "password". You can also do web3.personal.listAccounts to confirm that you have accounts on this network. You need at least one. – Rob Hitchens B9lab Feb 3 '17 at 22:53
  • yes I have entered my correct password. and I have 3 accounts :( the only time it returns true is when it is truffle(default)> web3.personal.unlockAccount('address', 'password', 15000), but then in the other console when i try to deploy it by running truffle migrate, its complains that the account is locked, bear in mind i am doing it as fast as possible, cannot be longer than 30 secs :/ @RobHitchens – Namu Ujin Na Feb 3 '17 at 23:16
  • I just realized this issue isn't new. Have a look here: ethereum.stackexchange.com/questions/10160/… and check your geth command line (rpc stuff) and truffle.js. – Rob Hitchens B9lab Feb 3 '17 at 23:23
  • yes this is a similar problem, but there is no fix... i was hope me posting would help @RobHitchens – Namu Ujin Na Feb 3 '17 at 23:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.