How to solve “The method personal_newAccount does not exist/is not available” Error?

0 votes

I am working on web3 and running a private blockchain

The app.ts file:

import * as Web3 from 'web3';
var web3   = new Web3(new Web3.providers.WebsocketProvider('ws://localhost:8546'));
web3.eth.getAccounts().then(accounts => {
    var sender = accounts[0];
    web3.eth.personal.unlockAccount(sender, 'password');
});

And I am getting the following error:

Unhandled rejection Error: Returned error: The method personal_newAccount does not exist/is not available
Jul 27, 2018 in Blockchain by digger
• 27,620 points
221 views

1 answer to this question.

0 votes
You are connecting using WS but have added personal to rpcapi. To make it work, you have add wsapi to your code and it will work.

Always be careful through what you are trying to connect and what you have written in your code.
answered Jul 27, 2018 by slayer
• 29,050 points

Related Questions In Blockchain

+1 vote
1 answer

How does a miner get to know that a transaction is verified by all the nodes?

Contrary to the popular belief, it is ...READ MORE

answered Mar 26, 2018 in Blockchain by Johnathon
• 9,070 points
54 views
0 votes
1 answer

Hyperledger Fabric:Promise is rejected:Error:Failed to deserialize creator identity,The supplied identity is not valid.

 This error happens because basic-network/docker-compose.yaml has CA ...READ MORE

answered Nov 14, 2018 in Blockchain by Omkar
• 67,120 points
175 views
0 votes
1 answer
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
103 views
+1 vote
5 answers

How to solve "truffle: command not found" error in blockchain?

First try restarting the system and then ...READ MORE

answered Jul 16, 2018 in Blockchain by slayer
• 29,050 points
658 views