Everything below is relevant for web3.js v1.x.
There is no such function web3.eth.accounts.newAccount()
.
There is function web3.eth.personal.newAccount()
.
The difference is that function web3.eth.accounts.create()
merely returns an object with an account credentials, while web3.eth.personal.newAccount()
creates an actual account on the node, via an RPC (remote-procedure call) to a node process (e.g., Parity, Geth, Ganache, etc).
Due to the above, function create
is synchronous by nature and returns the result immediately, while function newAccount
is asynchronous by nature and returns a Promise
object which must be resolved (waited for) in order to obtain the result.
So you will technically be doing:
const accountObject = web3.eth.accounts.create(...);
const accountAddress = await web3.eth.personal.newAccount(...);
Here is the official documentation: