3

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.

  • The account you want to unlock is not available, list accounts returns an empty array. You can not unlock an account that is not available. See this answer. – Afr Jun 2 '17 at 11:59
  • Can you explain what you mean with available? I made the account in parity and I am 100% sure the passphrase is correct. – Niels Van Diermen Jun 2 '17 at 18:40
  • >>> web3.personal.listAccounts returns []. Can you find out why? Are you using a different datadir or keypath? – Afr Jun 2 '17 at 18:45
1

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...']
  • How would you use this to unlock an account, rather than just list it? – blockchaindotsol Sep 25 '17 at 22:24
  • Parity does expose it, but my test failed when hitting the endpoint. I updated the answer to include the pitfall I ran into (The personal API is not exposed by default) – carver Sep 26 '17 at 0:33
  • Worked with @blockchaindotsol offline to make sure they are using the right json-rpc-over-http port (rather than the ui port default). – carver Sep 26 '17 at 0:39
-2

We found the issue, we did not define the key directory properly. Thanks for the help!

  • 1
    Hi there - can you add a few more specific details about how the directory wasn't defined? (e.g. A typo in the name, or something like that?) It might help others in future. And get more upvotes :-) – Richard Horrocks Jun 3 '17 at 10:07

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.