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

1 Answer 1


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));

  • is newPassword a variable here?
    – Atul Anand
    Aug 14, 2019 at 12:47
  • You can use a string or a variable. Which version are you using? Aug 15, 2019 at 7:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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