This question already has an answer here:

When trying to send a transaction through json-rpc interface on a geth node (version 1.4.10-stable-5f55d95a, running on testnet) using eth_sendTransaction I got this error message:

-32000 [message] => account is locked

I have tried to unlock the account using the following command:

geth --testnet --exec "personal.unlockAccount(eth.accounts[0], password, 3600)" attach true http://localhost:8545

But I get another error:

Fatal: Unable to attach to remote geth: invalid endpoint

Trying to unlock as explained in how to unlock the account with geth?

geth --testnet --unlock 0x3b877e80b... --password password

throws this error too:

Fatal: Could not open database: resource temporarily unavailable

Another option to unlock account according to previous URL is using the Geth interactive Javascript console. But how do I launch such console?

I've seen someone is having same problem on code -32000 message: account is locked but any command of the kind

geth --unlock

is not working on my geth node.

Is it possible to unlock accounts directly through json-rpc interface anyhow?

Why geth is not allowing me to unlock my ethereum account? Why "invalid endpoint"?

marked as duplicate by niksmac, Matthew Schmidt, Sebi, galahad, The Officious BokkyPooBah Sep 5 '16 at 15:03

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 3 down vote accepted
  1. The command with attach should be like:
$ geth --testnet --exec "personal.unlockAccount(eth.accounts[0], \"password\", 3600)" attach http://localhost:8545

Make sure that you have included personal in your --rpcapi "eth,web3,personal" in the first Geth you launched.

  1. The command with unlock should be used as part of the first Geth launch:

    • Have a password.txt file that contains as many lines as there are accounts to unlock. Each line with password without the ".
    • Then add --unlock "0x3b877e80b..." --password password.txt to your Geth command line.
  2. Beside that, to launch Geth with a console, just add console at the end. So, when you are in the Geth console, you can type:

> personal.unlockAccount(eth.accounts[0])
// Or
> personal.unlockAccount(eth.accounts[0], "password")
// Or
> personal.unlockAccount(eth.accounts[0], "password", 3600)


At your own risk, because the call carries the password in clear, the direct call to unlock via RPC is:

$ curl -X POST --data '{"jsonrpc":"2.0","method":"personal_unlockAccount","params":["0x7642b...", "password", 3600],"id":67}' http://localhost:8545
  • 1
    Given that exporting personal over rpc opens up a node to exploits shouldn't they be attaching through ipc instead, e.g. geth --testnet --exec "personal.unlockAccount(eth.accounts[0], \"password\", 3600)" attach ~/<datadir>/geth.ipc? – o0ragman0o Sep 2 '16 at 21:51
  • I agree 100%. I just asked if both Geth are on the same computer. – Xavier Leprêtre B9lab Sep 2 '16 at 22:05
  • Thanks a lot. Using command line call to geth as you described worked like a charm. Nevertheless, I wonder if this unlock action could be also possible through json-rpc protocol, avoinding admin intervention on command line. – Juan Ignacio Pérez Sacristán Sep 3 '16 at 16:53
  • 1
    I added it in the answer, but be careful, the password is travelling in the clear. – Xavier Leprêtre B9lab Sep 3 '16 at 20:40
  • is there way for unlock account using private key not using password @XavierLeprêtreB9lab – Yogesh Karodiya Nov 4 '17 at 13:45

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