11

I have created a dapp where the user can sign a contract using metamask. However, the account that gets the money send to keeps getting locked. Sure, I can manually unlock it, but this is really annoying. Is there any way to automate this, that it remains unlocked?


Seems like you can unlock it for as long as the geth instance is running using a 0 as duration parameter:

web3.personal.unlockAccount("address", "pass", 0);

4
  • 4
    This might help for Geth: ethereum.stackexchange.com/questions/8418/… One thing unclear in the question is that the receiving account does not need to be unlocked: only if it needs to sign a transaction.
    – eth
    Jan 4, 2017 at 10:18
  • 1
    it is insecure to unlock an account permanently
    – Badr Bellaj
    Jan 5, 2017 at 13:51
  • 1
    You should add an answer, and mark it correct, if your issue is resolved. Jan 5, 2017 at 22:45
  • For POA accounts, account should be unlocked all the time, otherwise account cannot seal the block and chain might be stop growing. It is difficult to keep track of is it unlocked or locked. So it is easier to keep it unlocked permanently on POA. @Badr Bellaj♦
    – alper
    Jan 25, 2018 at 8:37

1 Answer 1

16

Seems like you can unlock it for as long as the geth instance is running using a 0 as duration parameter:

web3.personal.unlockAccount("address", "pass", 0);

3
  • 1
    tip - use null for password and enter it masked/when asked. Shouldn't be recorded in log then.
    – B. Shea
    Jan 2, 2018 at 12:33
  • When I use null it gives Error: could not decrypt key with given passphrase error. @bshea
    – alper
    Jan 25, 2018 at 8:35
  • null works. web3.personal.unlockAccount("account_address", "password", null);
    – Edison
    May 5, 2018 at 14:33

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.