public PublicKeyHashAddress(ImmutableArray<byte> publicKeyHashBytes)
        {
            this.publicKeyHashBytes = publicKeyHashBytes;

            var outputScript = new PayToPublicKeyHashBuilder().CreateOutputFromPublicKeyHash(publicKeyHashBytes.ToArray());
            this.outputScriptHash = new UInt256(SHA256Static.ComputeHash(outputScript));
        }
Beispiel #2
0
        private UInt256 AddressToOutputScriptHash(string address)
        {
            var addressBytes = Base58Encoding.DecodeWithCheckSum(address);
            var publicKeyHash = addressBytes.Skip(1).ToArray();

            var outputScript = new PayToPublicKeyHashBuilder().CreateOutputFromPublicKeyHash(publicKeyHash);
            var outputScriptHash = new UInt256(SHA256Static.ComputeHash(outputScript));

            return outputScriptHash;
        }
Beispiel #3
0
        private UInt256 PublicKeyHashToOutputScriptHash(byte[] publicKeyHash)
        {
            if (publicKeyHash.Length != 20)
                throw new ArgumentException("publicKeyHash");

            var outputScript = new PayToPublicKeyHashBuilder().CreateOutputFromPublicKeyHash(publicKeyHash);
            var outputScriptHash = new UInt256(SHA256Static.ComputeHash(outputScript));

            return outputScriptHash;
        }