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!"); } }
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"); } }
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); }