How to use Wallet to hold multiple private keys and Bitcoin addresses?
zydjohnHotmail opened this issue · comments
Hello:
I am rather new to this repo, I want to know something on how to use the repo.
I would like to register some web site with Bitcoin transactions, so I need some Bitcoin addresses, around 20 to 30.
I know I can generate private key using the repo, and generate one Bitcoin address from this private key, like the following:
var privateKey1 = new Key();
var bitcoinPrivateKey1 = privateKey1.GetWif(Network.Main);
var bitcoinPublicKey1 = bitcoinPrivateKey.PubKey;
var address =
bitcoinPublicKey1.GetAddress(ScriptPubKeyType.Segwit, Network.Main);
Console.WriteLine(address);
What I want to do is:
I want to generate like 20 private keys, and each private key, generate one Bitcoin address.
Then I want to store the 20 Bitcoin addresses into one Wallet, how I can do this?
I found a number of BitCoin wallet online, but I don’t understand how to use them. I want to keep the generated Bitcoin address, not change it each time. By the way, I am using Nbitcoin version 7.0.8 on Windows 10 (Version 21H2).
Please advise,
Thanks,
Except for learning purpose, don't do this.
If you just want to learn, read https://programmingblockchain.gitbook.io/programmingblockchain/ to be accustomed to this library.
If you want to rely on a real wallet please use https://github.com/dgarage/NBXplorer/ or even https://github.com/btcpayserver/btcpayserver (but this last one it might be more than you need)
Wallet nowadays use BIP32, you can get an overview on https://www.youtube.com/watch?v=-7kHWZCYJkk
Hello:
Thank you very much for your reply. The last option seems to be interesting (btcpayserver).
Now, I have one more question to ask, can I use the last option to receive BTC payment to replace exchange wallet?
with both you can do wallet to receive and send BTC, maybe btcpayserver is easier, nbx is more flexible.
btcpay relies on nbx behind the scene, so anyway, if you chose it, you will have both.