Example #1
0
 private void calcBase58()
 {
     if (pubKeyHash != null)
     {
         this.address = Base58CheckString.FromByteArray(pubKeyHash, PUBKEYHASH);
     }
     else
     {
         throw new InvalidOperationException("Address is not a public key or script hash!");
     }
 }
Example #2
0
 public static PrivateKey FromWIF(String s)
 {
     Byte[] b = Base58CheckString.ToByteArray(s);
     if (b.Length == 0x20)
     {
         return(new PrivateKey(b, false));
     }
     else if (b.Length == 0x21)
     {
         return(new PrivateKey(b.Take(0x20).ToArray(), true));
     }
     else
     {
         throw new ArgumentException("Invalid WIF Private Key");
     }
 }
Example #3
0
        private Byte calcHash()
        {
            Byte version;

            Byte[] hash = Base58CheckString.ToByteArray(address, out version);
            switch (version)
            {
            case PUBKEYHASH:
                pubKeyHash = hash;
                break;

            case SCRIPTHASH:
                scriptHash = hash;
                break;
            }
            return(version);
        }