I am using the Geth 1.7 console. I tried unlocking the account using personal.unlockAccount(eth.accounts[0], "{top secret password}") but it failed with the following error: first argument must be the account to unlock.

I suspect the error might be due to the fact that eth.accounts[0] is undefined.

How do I set up eth.accounts[0]?

2 Answers 2


Please make sure to create an account first before trying to unlock an account residing at the zeroth element in eth.accounts.

To create an account: personal.newAccount('yourPasswordForTheNewAccount')

You are seeing undefined because there is not account to unlock.


You may need to create a ethereum account.

Please use the following command on the geth console.

personal.newAccount("new passphrase")

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.