Code:
var Web3 = require('web3'); var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); var sender = web3.eth.accounts[0]; console.log('Sender: ' + sender); web3.personal.listAccounts;
Output:
Sender: 0xA0A0A01 home/ubuntuuser/node_modules/web3/lib/web3/requestmanager.js:61 throw errors.InvalidResponse(result); ^ Error: The method personal_listAccounts does not exist/is not available at Object.module.exports.InvalidResponse (/home/ubuntuuser/node_modules/web3/lib/web3/errors.js:38:16) at RequestManager.send (/home/ubuntuuser/node_modules/web3/lib/web3/requestmanager.js:61:22) at Personal.get [as listAccounts] (/home/ubuntuuser/node_modules/web3/lib/web3/property.js:107:62) at Object.<anonymous> (/home/ubuntuuser/Desktop/Ethereum/ethy.js:63:14) at Module._compile (module.js:410:26) at Object.Module._extensions..js (module.js:417:10) at Module.load (module.js:344:32) at Function.Module._load (module.js:301:12) at Function.Module.runMain (module.js:442:10) at startup (node.js:136:18)
- Question:
From the above, commands like web3.eth.accounts[0]
works fine, however web3.personal.listAccounts;
doesn't. Why might that be the case?
personal
to the--rpcapi
something like thisgeth --rpc --rpcapi eth,web3,net,ssh,db,debug,personal
enable serveral apis.personal
interface isn't exposed over RPC by default. You can do this more safely over IPC ethereum.stackexchange.com/questions/1413/…geth --rpc
also cause a security risk? or was it just the--rpcapi ...
?