Web3.js: web3.personal.newAccount() Doesn't work

Created on 15 Sep 2016  路  5Comments  路  Source: ChainSafe/web3.js

I'm running a very simple code and it's giving me an error.

var Web3 = require('web3');
var web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'));

var newAccount = web3.personal.newAccount("yo");
console.log(newAccount)
/home/info/open-ethereum-pool/node_modules/web3/lib/web3/requestmanager.js:61
        throw errors.InvalidResponse(result);
        ^

Error: The method personal_newAccount does not exist/is not available
    at Object.InvalidResponse (/home/info/open-ethereum-pool/node_modules/web3/lib/web3/errors.js:35:16)
    at RequestManager.send (/home/info/open-ethereum-pool/node_modules/web3/lib/web3/requestmanager.js:61:22)
    at Personal.send [as newAccount] (/home/info/open-ethereum-pool/node_modules/web3/lib/web3/method.js:145:58)
    at Object.<anonymous> (/home/info/open-ethereum-pool/test.js:7:26)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.runMain (module.js:590:10)

Most helpful comment

Amm. Well. It's working.
if I use following parameters when I start geth.

--rpcapi="db,eth,net,web3,personal,web3"

All 5 comments

Amm. Well. It's working.
if I use following parameters when I start geth.

--rpcapi="db,eth,net,web3,personal,web3"

errorfatal

I am getting this error when i am executing --rpcapi="db,eth,net,web3,personal,web3" this command

  1. Run " geth attach ".
  2. Then in Javascript console itself run " admin.startRPC(address, port, "*", "web3,personal,admin,debug,db,net,eth,miner,rpc,txpool") ".

Works fine.

Can use " web3.personal.newAccount("password"); " and " web3.personal.unlockAccount(address, "password", 0) " at the client side using rpc api itself.

geth 1.7.3 now, you should like this geth --rpc --rpcapi db,eth,net,web3,personal,web3 without " "

if I connect to the test network such as kovan test network or main network , how to deal with this problom

Was this page helpful?
0 / 5 - 0 ratings