I'm using truffle v5.0.14 to handle my contracts. All was well while developing with ganache, but when I wanted to deploy to the real network (a private one) I have problems with the account.

The node that I have to connect to prevents from unlocking accounts for rpc calls, so what is the correct way to load my account to truffle?

2 Answers 2


All accounts in Ganache are unlocked by default, but when you want to connect to other network and deploy contracts there (using truffle) then you should use this library



This is a rite of passage.

A favorite one-liner, in the Geth console:

web3.personal.unlockAccount(web3.personal.listAccounts[0],"<password>", 15000);

Meaning, unlock my first account, with this password, for 15,000 seconds (i.e. don't bother me for a while).

When you are finished, manually lock it or just restart the node.

PSA: Don't expose the personal API over RPC. That would help you get it to work from truffle and/or scripts but it might start responding to other people, and that would be bad.

Hope it helps.

  • Hey Rob! I can't call the unlock method because web3 says that 'unlock is forbidden for HTTP'. I could run the geth node with the allow-insecure-unlock flag, but I guess there must be a better way. But I'm no expert, that's why I asked
    – andrés
    May 15, 2019 at 0:57

Your Answer

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

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