September 5, 2026

Generate public addresses (NBitcoin)

I’m trying to generate a public address and for that, I have the code:

var key = new Key();
var wif = key.GetWif(Network.Main);

Console.WriteLine($"WIF: {wif}");

var secret = new BitcoinSecret(key, Network.Main);
Console.WriteLine($"Private Key: {secret.ToWif()}");
Console.WriteLine($"Public Address (Legacy): {secret.GetAddress(ScriptPubKeyType.Legacy)}");
Console.WriteLine($"Public Address (Segwit): {secret.GetAddress(ScriptPubKeyType.Segwit)}");
Console.WriteLine($"Public Address (SegwitP2SH): {secret.GetAddress(ScriptPubKeyType.SegwitP2SH)}");

When I pick the WIF and import it to Blockchain.com (for example), I only get the Legacy public address. Can the same private key sign Segwit and SegwitP2SH transactions?
How can I import a private key and get the Segwit and SegwitP2SH public addresses?

My knowledge about how this works is limited and I’m trying to learn…

Previous Article

Cardano Price on the Brink of Crashing Down! ADA Price Predicted to Hit $0.50 if Falls Below $1

Next Article

SecuX is Your Viable Option For Trading