2

I try to create new account.

var web3 = new Nethereum.Geth.Web3Geth();

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

in account i recived

{"privateKey":"0x062f0c51f1949b6cf14329df0fe59c739f98fdfdbef8a70e885c1d028f999a12","address":"0xDd8414810DC6111BEed80383D20AA2A0313BCd51","transactionManager":{"defaultGasPrice":20000000000,"defaultGas":21000,"client":null,"transactionReceiptService":{}},"nonceService":null}

but in testchain this address not added

web3.eth.accounts
["0x12890d2cce102216644c59dae5baed380d84830c", "0x13f022d72158410433cbd66f5dd8bf6d2d129924", "0x3a2e25cfb83d633c184f6e4de1066552c5bf4517", "0xaf7c2c210d31245cf332fc1d820bdfd77d1e3555", "0xfd1a70a36f6369d369ce58fe3aa012eb2d8593ab", "0xb6d706ddeece5f9c118073ddceaca5578eea474d", "0xbf5c0f806d6cd0778b8263e803315422a7afd684", "0x711cdc94ae25c5b2f2005b10c13b67bccb82fea7", "0x6d5d2f40cc9f353b83f9a2f53615d3ecbf5447f5", "0x04ce8794628f6640636032cd8e44e62e80816871", "0x7429958b6ba7fc693ef34c466b00f4d34633e6a0", "0xe24d16f8aa08f384cfc480e97a000c53d04c36e5", "0x3448664731d7d1e29078d0f72f6f5db826fec8d7", "0x38bef2ee44b565274789e7fa3b212ddca8b175cc", "0x48a44c89a45fb9a35ebe34dfada675f1473f39e6", "0x009c366f337bbc672d383c50ffa60654c5ca54a3", "0xf2be7e6940ce3827d07fa12c3df8a9167d92da30", "0x3193aca2ea0dc9e841ac237283fa6ba22fe473dd"]

What i must do to create new account?

1 Answer 1

0

I use the following to create a new account

public async Task<string> CreateNewEthereumAddressAsync(string password)
{
  return await web3.Personal.NewAccount.SendRequestAsync(password);
}

don't send it a plain text password. Do some salting and hashing on the plaintext password before sending it to this function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.