I'm making a dApp on reactjs. I wanted to create a new account and have done it trying 2 methods

  1. this.web3.eth.personal.newAccount()
  2. this.web3.eth.accounts.create()

I have attached the code below(ignore the comments)

 OTPSubmit(event) {
     //alert('A name was submitted: ' + this.state.value);
        showComponent: true,
       account: this.web3.eth.personal.newAccount()
       #account: this.web3.eth.accounts.create()


These are the errors I'm getting

  1. web3.eth.accounts.create() is not a function
  2. Cannot read property 'newAccount' of undefined

Can you please help me? I am very new to this


if you are using web3.js 1.0.0, try giving a password in the parameters like this:


if you are using an older version, try to separate "password" and "callback result" arguments like "Hamid Jolany" mentionned in this post:

web3.eth.personal.newAccount(password,(result)=>{ console.log(result); res.send(JSON.stringify(result));

New contributor
Melek Boujelbene is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • is newPassword a variable here? – Atul Anand Aug 14 at 12:47
  • You can use a string or a variable. Which version are you using? – Melek Boujelbene Aug 15 at 7:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.