简体   繁体   中英

.net Generate good private key for Ethereum account

We're using Nethereum ( https://docs.nethereum.com/en/latest/ ) to develop a .net based DApp for the Ethereum network. Part of the functionality will involve allowing a user to create a new Ethereum account. According to the Nethereum documentation

To create a new account you just need to generate a new private key, Nethereum.Signer provides a method to do this using “SecureRandom”. The Account object accepts just the private key as a constructor, to reduce any coupling with private key generation, and prescriptive way to generate private keys. It is recommended that you use a more complex random generator to create your private keys than using “SecureRandom”, but this is simple enough for testing.

So, obviously we don't want to use "SecureRandom" in production.

What's the best way of generating a really good private key suitable for creating an Ethereum account? Is there a .net library that will do this?

For information, the best approach is to use a HD Wallet which will generate a master private key and any number of account private keys. See https://docs.nethereum.com/en/latest/nethereum-managing-hdwallets/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM