4

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"?

1 Answers1

5
  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)

Edit:

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
{"jsonrpc":"2.0","id":67,"result":true}