i am trying to create a new account using web3.js with angular 4. Following is my service


import { Injectable } from '@angular/core';
import * as Web3 from 'web3';

declare let require: any;
declare let window: any;

export class ContractsService {
  private web3: any;

  constructor() {
    if (typeof window.web3 !== 'undefined') {
      // Use Mist/MetaMask's provider
      this.web3 = new Web3(window.web3.currentProvider);

      if (this.web3.version.network !== '4') {
        alert('Please connect to the Rinkeby network');
    } else {
        'Please use a dapp browser like mist or MetaMask plugin for chrome'

  public creatAccount() {
    let acc = this.web3.eth.personal.newAccount('abc123');


` but i am having following error.

enter image description here

can anybody please tell me what is wrong with this code? thanks :)

1 Answer 1


Try the below code for Account Creation

 public creatAccount() {
     let acc = this.web3.personal.newAccount('abc123');

Refeernce :- https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_newaccount

  • thanks for the answer, now i am getting following error ` RROR Error: The MetaMask Web3 object does not support synchronous methods like personal_newAccount without a callback parameter ` Commented Feb 28, 2018 at 9:54

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.