1

I have a parity node hosted on kovan network. How to create account using web3py? I used web3.personal.newAccount()=>which is giving error as no method found.

What are the api's available for parity?

2
  • 1
    Have you enabled the personal API on the node you are connected to? Commented Oct 3, 2018 at 7:16
  • @RaghavSood yes I have enabled.
    – Deepthi Kr
    Commented Oct 8, 2018 at 6:20

1 Answer 1

3

Unfortunately, the personal module is not standardized across clients. parity supports a different API than geth. Some alternatives for creating an account:

  1. Use locally managed keys, OR
  2. Create the accounts on the parity node using the CLI

Local keys

>>> my_account = w3.eth.account.create('add something random here to improve key generation')
>>> transaction = {
...     'to': '0xF0109fC8DF283027b6285cc889F5aA624EaC1F55',
...     'value': 1000000000,
...     'gas': 2000000,
...     'gasPrice': 234567897654321,
...     'nonce': 0,
...     'chainId': 1
... }
>>> signed = my_account.signTransaction(transaction)
>>> w3.eth.sendRawTransaction(signed.rawTransaction) 

Parity CLI

parity --chain kovan account new
Loading config file from users.toml
Please note that password is NOT RECOVERABLE.
Type password: 
Repeat password:
0x66a4b6f39b4c3e7203ab9caeecbad58d8f29b046
4
  • The account created using w3.eth.account.create is not available in parity node..and the 'to' key in transaction is standard?
    – Deepthi Kr
    Commented Oct 8, 2018 at 6:19
  • Right, when using local keys, all signing would have to happen locally in python. The account would never be added to your parity node. If you must have the account in your node, then try the Parity CLI option.
    – carver
    Commented Oct 8, 2018 at 18:07
  • It would be nice to add a 3rd option which would be to load a previously existing account into web3py
    – fccoelho
    Commented Nov 14, 2018 at 18:35
  • I see where you're going, but I think it's OT for this particular question, and believe that question is asked/answered elsewhere.
    – carver
    Commented Nov 14, 2018 at 19:01

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.