Both web3.eth.accounts.create() and web3.eth.personal.newAccount() not working

by Atul Anand   Last Updated August 13, 2019 18:28 PM

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

Answers 1

If you are using web3.js 1.0.0 or greater, than you simply need to do the following (from the docs):


August 13, 2019 17:37 PM

Related Questions

Web3 not defined

Updated December 20, 2017 21:28 PM

How to call a smart contract function in a DAPP?

Updated July 03, 2019 04:28 AM

web3.BatchRequest is not working in react.js

Updated July 30, 2019 09:28 AM

React Native FlatList example code Error

Updated January 13, 2019 16:28 PM