/// <summary>
        /// Extract witness redeem from WitScript
        /// </summary>
        /// <param name="witScript">Witscript to extract information from</param>
        /// <param name="expectedScriptId">Expected redeem hash</param>
        /// <returns>The witness redeem</returns>
        public Script ExtractWitScriptParameters(WitScript witScript, WitScriptId expectedScriptId = null)
        {
            if (witScript.PushCount == 0)
            {
                return(null);
            }
            var    last   = witScript.GetUnsafePush(witScript.PushCount - 1);
            Script redeem = new Script(last);

            if (expectedScriptId != null)
            {
                if (expectedScriptId != redeem.WitHash)
                {
                    return(null);
                }
            }
            return(redeem);
        }
 public Script GenerateScriptPubKey(WitScriptId scriptHash)
 {
     return(scriptHash.ScriptPubKey);
 }
Beispiel #3
0
 public BitcoinWitScriptAddress(WitScriptId segwitKeyId, Network network)
     : base(new[] { (byte)OpcodeType.OP_0, (byte)0x00 }.Concat(segwitKeyId.ToBytes(true)).ToArray(), network)
 {
 }