I have:

  1. A geth account
  2. Access to web3 API

I want to:

  1. Invoke the function, web3.eth.sign(coinbase, sha)

If I put this in a javascript file sign.js, and I call node.js, will it sign my message? Or does my geth account have to be unlocked? Can I unlock it in bash and then call node.js?



2 Answers 2


You need to unlock your account to be able to operate with it. The third parameter of unlockAccount is a timeout in seconds.

web3.personal.unlockAccount("0x..", "<passs>", 1000);

But be aware that if you unlock your account, any other program with access to your node can sign whithin the timeout.

See this to know how to secure your node and to avoid problems: How to reduce the chances of your Ethereum wallet getting hacked?.


As of web3.js v1.0, you have to go through eth in order to reach personal from nodejs:

web3.eth.personal.unlockAccount("0x..", "<passs>", 1000);

Otherwise you'll get the error TypeError: Cannot read property 'unlockAccount' of undefined

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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