[Ethereum] Unable to unlock account with Parity and Web3 on the testnet

debianparityweb3.py

I'm running a local Parity node for the testnet (Ropsten) on Debian (Jessie). I'm using web3.py to connect to this node and create transactions.

I've created a new account:

parity account new --chain ropsten

I'm running my parity node with the following options

/usr/bin/parity --chain ropsten --no-ui --rpcapi 'eth,web3,personal' --jsonrpc-interface 127.0.0.1 --bootnodes 'enode://20c9ad97c081d63397d7b685a412227a40e23c8bdc6688c6f37e97cfbc22d2b4d1db1510d8f61e6a8866ad7f0e17c02b14182d37ea7c3c8b9c2683aeb6b733a1@52.169.14.227:30303,enode://6ce05930c72abc632c58e2e4324f7c7ea478cec0ed4fa2528982cf34483094e9cbc9216e7aa349691242576d552a2a56aaeae426c5303ded677ce455ba1acd9d@13.84.180.240:30303'

When I test this node, it's running fine, see the following python shell:

Python 3.4.2 (default, Oct  8 2014, 10:45:20) 
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from web3 import Web3, KeepAliveRPCProvider, IPCProvider
>>> web3 = Web3(KeepAliveRPCProvider(host='localhost', port='8545'))
>>> web3.eth.blockNumber
1012932

However, when I try to unlock my account it returns False (with a proper account hash and password ofcourse)

>>> web3.personal.unlockAccount('my-account-hash', 'some-password')
False

When I check if it's actually in my list of accounts, I get the following:

>>> web3.personal.listAccounts
[]

Any ideas would be kindly appreciated.

Best Answer

The RPC methods under personal_* are not exposed by default. The question set it up correctly. (although today, the correct arg is --jsonrpc-apis 'eth,web3,personal').

If you are still failing to connect, and you are using IPC, note that the argument above only sets up calls over HTTP. If you are using IPC, you need to use --ipc-apis 'eth,web3,personal' instead.

If you would rather not expose the personal APIs, for security reasons, you can use the eth_accounts RPC call.

>>> web3.eth.accounts
['0x...']
Related Topic