NBitcoin get signature, use spending P2SH transaction with non-standard script

0
55


It appears the primary query might be completed with one thing like:

//after creating newtx and specifying enter and outputs  
newtx.Inputs[0].ScriptSig = privatekey.ScriptPubKey;  
newtx.Signal(privatekey, false);  //places signature and pubkey in ScriptSig  
//use these plus extra parameters in script  
newtx.Inputs[0].ScriptSig = new Script(  
   newtx.Inputs[0].ScriptSig + " " +  
   //go away signature and pubkey as first parameters pushed onto stack  
   //then add extra parameter (kind PubKey)  
   Op.GetPushOp(additionalParameter.ToBytes()) + " " +  
   //then add script whose hash was in authentic P2SH trans  
   Op.GetPushOp(scriptIn.ToBytes()));  

The scriptIn is identical as the same old P2KH script preceded by a examine for the hash of one other parameter

scriptIn = new Script(  
        "OP_HASH160 "  
        + Op.GetPushOp(additionalParameter.Hash.ToBytes())  
        + " OP_EQUALVERIFY"  
        + " OP_DUP"  
        + " OP_HASH160 "  
        + Op.GetPushOp(pubkeyhash.ToBytes())  
        + " OP_EQUALVERIFY"  
        + " OP_CHECKSIG"  
        );  

However when the transaction is shipped it will get the next error:
16: mandatory-script-verify-flag-failed (Signature should be zero for failed CHECK(MULTI)SIG operation)

Unsure why it is failing.

LEAVE A REPLY

Please enter your comment!
Please enter your name here