0

Updated:

I have a function where I init web3 and included web3.eth.personal.newAccount at the bottom of the function to create a new account.

initWeb3: function() {
    if (typeof web3 !== 'undefined') {
      App.web3Provider = web3.currentProvider;
      web3 = new Web3(web3.currentProvider);
    } else {
      App.web3Provider = new web3.providers.HttpProvider('http://localhost:8545');
      web3 = new Web3(App.web3Provider);
    }

    web3.eth.personal.newAccount('abc123').then(function(data) {
      console.log(data);
    }); 
  },

When connected to localhost:8545(ganache) in metamask and test this, it generates a new account, but when connected to ropsten, I get the following error:

inpage.js:1 MetaMask - RPC Error: Internal JSON-RPC error. {code: -32603, message: "Internal JSON-RPC error."}

Why can't I generate a new account if I'm connected to Ropsten? I use web3 1.0 btw.

  • Have you tested any other web3 calls as a sanity check? Are there errors in the console? – Shawn Tabrizi Jul 30 '18 at 18:42
  • yes I've tried with web3.eth.getAccounts() and it's working fine. I've changed my network connection in metamask to ropsten test network, and now I'm getting this error in the console. inpage.js:1 MetaMask - RPC Error: Internal JSON-RPC error. {code: -32603, message: "Internal JSON-RPC error."} – bbusdriver Jul 30 '18 at 18:53
  • it just worked with localhost:8545 ganache! why can't it generate new account connected to ropsten? – bbusdriver Jul 30 '18 at 18:57
  • So your question is why is MetaMask failing? Are you hosting your web page on a server or just opening the file on your local desktop? – Shawn Tabrizi Jul 30 '18 at 19:33
  • On a local desktop – bbusdriver Jul 30 '18 at 19:43

Your Answer

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

Browse other questions tagged or ask your own question.