示例#1
0
        public static BTCKeyPair GetPublicAddress(BTCKeyPair privateKey)
        {
            Key key = new Key(privateKey.PrivateKey, -1, true);

            privateKey.PublicAddress = key.PubKey.GetAddress(Network.Main).ToString();
            return(privateKey);
        }
示例#2
0
        public static BTCKeyPair GenerateKey()
        {
            RandomUtils.Random = new RNGCryptoServiceProviderRandom();// UnsecureRandom();
            Key nKey = new Key();

            BTCKeyPair bKey = new BTCKeyPair();

            bKey.PrivateKey             = nKey.ToBytes();
            bKey.WIFPrivateKey          = nKey.GetWif(Network.Main).ToString();
            bKey.PublicAddress          = nKey.PubKey.GetAddress(Network.Main).ToString();
            bKey.PublicAddressTruncated = WIFEncoder.ConvertFromPublicAddress(bKey.PublicAddress);

            return(bKey);
        }