-1

When I execute following code then it show me: MetaMask - RPC Error: The method personal_newAccount does not exist/is not available

  if(typeof window.web3 !== "undefined" && typeof window.web3.currentProvider !== "undefined") {
            var web3 = window.web3 ? new Web3(window.web3.currentProvider) : new Web3(new Web3.providers.HttpProvider("https://mainnet.infura.io/v3/[infura-id]"));
           // web3.personal.newAccount('@!password').then(console.log);
            var password = "m'UxJjB][Tmk";
            //web3.accounts.create(password);
            web3.personal.newAccount(password,function (error, result) {
              console.log("In otherFunction with: " + result);
            });

          }
  • 1
    Add the following line in your code: – goodvibration Aug 7 at 7:07
  • @goodvibration, which lines? – Adil Kadiyawala Aug 7 at 9:12
  • Which code????? – goodvibration Aug 7 at 9:51
  • @goodvibration, I have edited my question and also add code. kindly review it – Adil Kadiyawala Aug 7 at 10:23
1

MetaMask only support a limited set of Ethereum API, see here for the detailed list: https://metamask.github.io/metamask-docs/API_Reference/JSON_RPC_API.

The function personal.newAccount is not supported.

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.