2

I am trying to run my first contract, but I am getting this error when using my dev testnet account.

Error: authentication needed: password or unlock undefined

I am using geth to run JS console using this command

geth attach

What should I do to use authenticate my account?

Thanks in advance!

5

You can unlock the account using below command on geth console:

If you have not created more than one account on geth then use -

personal.unlockAccount(eth.coinbase, 'your account password in quotes', 0)

The first argument in above command is the account hash(address), second is the password in quotes and third is the time in seconds till the time you want the account to be unlocked.

eth.coinbase is default account which gets created while initializing genesis block. You can also use eth.accounts[0] in place of eth.coinbase

If the account you are trying to unlock is not the first one then use the index of your account from this array - eth.accounts.

For instance, if my account is at second index then you can use it like this -

personal.unlockAccount(eth.accounts[1], 'your account password in quotes', 0)

Hope this helps.

  • 1
    Helped very much. Worked great. – jamescampbell Jul 23 '18 at 15:08

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.