////Option 1 : Spender knows my birthdate
Op pushBirthdate = Op.GetPushOp(birth);
Op selectIf = OpcodeType.OP_1; //go to if
Op redeemBytes = Op.GetPushOp(redeemScript.ToBytes());
Script scriptSig = new Script(pushBirthdate, selectIf, redeemBytes);
spending.Inputs[0].ScriptSig = scriptSig;
//Verify the script pass
var result = spending
.Inputs
.AsIndexedInputs()
.First()
.VerifyScript(tx.Outputs[0].ScriptPubKey);
Console.WriteLine(result); // True
////Option 2 : Spender knows my private key
BitcoinSecret secret = new BitcoinSecret("...");
var sig = spending.SignInput(secret, scriptCoin);
var p2pkhProof = PayToPubkeyHashTemplate
.Instance
.GenerateScriptSig(sig, secret.PrivateKey.PubKey);
selectIf = OpcodeType.OP_0; //go to else
scriptSig = p2pkhProof + selectIf + redeemBytes;
spending.Inputs[0].ScriptSig = scriptSig;
//Verify the script pass
result = spending
.Inputs
.AsIndexedInputs()
.First()
.VerifyScript(tx.Outputs[0].ScriptPubKey);
Console.WriteLine(result); // True
///////////