在Nuget中安装BitcoinSVCryptor包并在程序中调用`
using System;
using NBitcoin;
namespace bsvAddress
{
class Program
{
static void Main(string[] args)
{
string privateKeyStr = "cVkkQ9gmQWb7M7FKKSAnKzkj5b3VJfHZath9YzvtzWqSyshpjLdX";
BitcoinSecret privateKey = new BitcoinSecret(privateKeyStr);
Network network = privateKey.Network;
string networkStr = network.ToString();
PubKey pubKey = privateKey.PubKey;
string pubKeyStr = pubKey.ToHex();
KeyId pkhash = pubKey.Hash;
string pkhashStr = pkhash.ToString();
BitcoinAddress address = pkhash.GetAddress(network);
string addressStr = address.ToString();
Console.WriteLine("private:" + privateKeyStr);
Console.WriteLine("network:" + networkStr);
Console.WriteLine("public Key:" + pubKeyStr);
Console.WriteLine("public Key Hash:" + pkhash);
Console.WriteLine("address:" + addressStr);
}
}
}