3

I have created a new address using web3.eth.accounts.create() and it responds with

{ address: '0x9AA2767207d0aC9cCdD2e3B244210f630588F3E3',
  privateKey:
   '0x15bc394db36ab8745ca34a9961d84abf5a45697823726d500785df940e416cbc',
  signTransaction: [Function: signTransaction],
  sign: [Function: sign],
  encrypt: [Function: encrypt] }

But in geth console, it lists out all my accounts, except 0x9AA2767207d0aC9cCdD2e3B244210f630588F3E3. What have gone wrong here? I'm using web3 -1.0.0-beta.34 . I also tried using web3.eth.personal.newAccount('qwerty') but it shows The method personal_newAccount does not exist/is not available but clearly they mentioned this method in the 1.0.0 documentation.

I have initialised web3 and personal like

var personal = new Personal('http://localhost:8545' || 'ws://localhost:8546');  
    web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545') || 'ws://localhost:8546');

Can some one help me on this problem? Thank you.

2 Answers 2

1

make sue you have allowed personal api while starting geth like geth --rpc --rpcport "8545" --rpcapi personal

1
  • yes, thank you. Previously I have allowed web3 only.
    – e.k
    Commented Jun 22, 2018 at 6:26
1

The method that you use web3.eth.accounts.create() creates an account but doesn't link it to your node, instead use newAccount:

web3.eth.personal.newAccount(password, [callback])

That should do. For further details see the docs here

Hope this helps.

4
  • I tried using that also but it shows method doesn't exists
    – e.k
    Commented Jun 21, 2018 at 14:08
  • The method exists!!, look at the docs in the link I provided, what version of web3 are you using.
    – Jaime
    Commented Jun 21, 2018 at 14:09
  • web3 -1.0.0-beta.34
    – e.k
    Commented Jun 21, 2018 at 14:19
  • I think initialising personal is the problem. I have initialised like new Personal('localhost:8545' || 'ws://localhost:8546'). Is this correct?
    – e.k
    Commented Jun 21, 2018 at 14:41

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.