What I am wanting to create is a Bitcoin script that will do the following:
- check against
- check against
then only redeem if both sig checks work but *additionally* I need it to ensure that is identical to and that is different to .
Is this even possible?
If must be identical to , then essentially aren't you saying that you require two the following:
- check
against
- check against
Though it seems roundabout, OP_CHECKMULTISIG could potentially be used. If you put in a null output and require 2-of-2 signatures that sign the output, then in effect that would mean and have to be valid signatures of .
Here's my cursory attempt. The problem with it (in addition to whatever problems I don't see) is that the scriptPubKey doesn't pass the "is_p2sh()" test since it's not "OP_HASH160 <20 bytes> OP_EQUAL". Since I'm not sure how far you're willing to go from Bitcoin in your endeavor, I figure I'll include this anyway.
redeemScript:
2 2 OP_CHECKMULTISIG
scriptSig:
0
scriptPubKey:
// This part copies and to the alt stack for later.
2 OP_PICK OP_TOALTSTACK 1 OP_PICK OP_TOALTSTACK
// Normal P2SH stuff.
OP_HASH160 OP_EQUAL
// Bring and back from the alt stack. The top stack item will be true if they are not equal.
OP_FROMALTSTACK OP_FROMALTSTACK OP_EQUAL OP_NOT
At any rate, hopefully this will give you some ideas.