I've done several deployment using truffle, but it didn't ask me to unlock the account while deploying the contract on my private chain. But recently I have done one deployment and it asked me to unlock the account.

I was showing this error: Error: authentication needed: password or unlock

So, I'm wondering, in which case it asks to unlock the account and when it won't ask?


Check your network config in your truffle-config.js (doc), you probably use an account (or the default account) that is on your node. You have to unlock it on your node first to interact with it.

Or you could use an hdwallet provider (repo here) but it will probably need some eth to make transaction unless you accept gasPrice: 0 transactions.

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.