MetacoSA / NBitcoin

Comprehensive Bitcoin library for the .NET framework.
MIT License
1.86k stars 844 forks source link

Where do the private keys come from? #1091

Open OlMi1 opened 2 years ago

OlMi1 commented 2 years ago

Hey there, I know this likely is a dumb question but I do not really understand the generation of private keys. I generate wallets like this:

Key address = new Key();
string privatek = address.GetBitcoinSecret(Network.Main);
// Do more stuff with it

GetBitcoinSecret() refers to the BitcoinSecret class. But what is the base for generating this private key? Random characters? The current UNIX timestamp? I don't really understand what the BitcoinSecret class does.

And I know the issues are for actual issues, I apologize, but I didn't find a better way.

jspri3 commented 2 years ago

@OlMi1 make sure you have a read through documentation. I believe your question is really on Key Generation and randomness. See here for detail programmingblockchain/key_generation/is_it_random_enough