Generate deal with of ‘non-public key’ from person enter

0
25


Assuming the non-public key string on this instance is pk

Console.WriteLine("Enter non-public key:");
string pk = Console.ReadLine();
var bitcoinPrivateKey = new BitcoinSecret(pk, Community.Major);

var legacy_address = bitcoinPrivateKey.GetAddress(ScriptPubKeyType.Legacy);

Console.WriteLine("Legacy Tackle :" + legacy_address);

And if you wish to get p2sh-segwit and bech32 deal with, add beneath traces:

var p2shsegwit_address = bitcoinPrivateKey.GetAddress(ScriptPubKeyType.SegwitP2SH);
var nativesegwit_address = bitcoinPrivateKey.GetAddress(ScriptPubKeyType.Segwit);

Console.WriteLine("P2SH-Segwit Tackle :" + p2shsegwit_address);
Console.WriteLine("Bech32 Tackle :" + nativesegwit_address);



Supply hyperlink

Leave a reply