I have studied the documents for creating a new account using Nethereum..

var ecKey = Nethereum.Signer.EthECKey.GenerateKey();
var privateKey = ecKey.GetPrivateKeyAsBytes().ToHex();
var account = new Nethereum.Web3.Accounts.Account(privateKey);

I want to create the account on Geth to start with for testing and then will migrate this to Ethereum live. For this I am initalising Web3 with a constructor:

public Web3 _web3;

        public BaseEthererumService()
            _web3 = new Web3(Config.EndPointURL);  // Prod "https://mainnet.infura.io";
            // Geth "localhost:8545";

What I want is to write a new address to Geth (or Ethereum in prod) and to receive a new contract address back..

I have also tried:

public async Task<string> CreateAccount()

            var account = await _web3.Personal.NewAccount.SendRequestAsync("123");

            return account;

But this bombs out without returning any form of address. And when I run at a CLI geth account list I don't get anything back...

I simply need to register a new account on the blockchain programmatically using Nethereum.Web3

Any help would be appreciated.

  • Are you running your own node? Infura doesn't support creation of accounts. If you are running your own node how do you launch geth? In the default configuration geth will not enable personal API for security reasons, you have to enable it explicitely.
    – Ismael
    Dec 5, 2018 at 1:00

1 Answer 1


if you're running Geth, you'll need to point to the geth.ipc file instead of the endpoint url pointing to Infura.io for key generation because they won't store your private key for you.

Basically, run Geth locally and add the geth.ipc file path to Config.EndPointURL, and you should be able to generate a key with it.

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.