Esempio n. 1
0
        public PublicKeyHashAddress(ImmutableArray<byte> publicKeyHashBytes)
        {
            this.publicKeyHashBytes = publicKeyHashBytes;

            var outputScript = new PayToPublicKeyHashBuilder().CreateOutputFromPublicKeyHash(publicKeyHashBytes.ToArray());
            this.outputScriptHash = new UInt256(SHA256Static.ComputeHash(outputScript));
        }
Esempio n. 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;
        }
Esempio n. 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;
        }