I am trying to create account on ethereum private network using web3js from front end.
I have written the below lines in my js file. The createAccount() gets called from an HTML page
web3 = new Web3(new Web3.providers.HttpProvider("http://127.0.0.1:8545"));
function createAccount(){
console.log("web3 version"+web3.version.api);
web3.eth.accounts.create();
}
I get the below in the console
web3 version0.20.1
Uncaught TypeError: web3.eth.accounts.create is not a function
Is it possible to create account on the node from front end html page using web3js?
If not then what are the steps for doing the same from web3j.
Best Answer
Prior to version 1.0 of web3js - which has the eth.accounts functionality; creating a new account is achieved via
which you can find documented here
That said, to achieve this via Node.js you will need to enable 'personal' via RPC - which is inadvisable - or connect via IPC. See this existing answer for more details.
More information on the rpc flag, and parameter, that you would have to provide to enable this can be found on this web3js issue.