2
1
I would like to learn the difference, explained as simple as possible, between OP_CHECKMULTISIG / OP_CHECKMULTISIGVERIFY and OP_CHECKSIG / OP_CHECKSIGVERIFY. The only explanation I found is: Same as OP_CHECKMULTISIG (or same as OP_CHECKSIG) except OP_VERIFY is executed afterward.
For OP_VERIFY: Mark a transaction as invalid if top stack value is not true.
Can this be better explained? How does OP_CHECKMULTISIGVERIFY and OP_CHECKMULTISIG differ in practice and in logic of creating scripts? What are the effects (pros and cons) of OP_VERIFY being executed afterward or before? Examples would be highly appreciated.
This means that every script that has advanced logics and multiple OP_IF and OP_ENDIF has to end with an OP_VERIFY in case between if and endifs we only have OP_CHECKSIG and OP_CHECKMULTISIG? – skydanc3r – 2017-07-27T11:43:11.723
This means the following script is invalid: IF 2 <Alice key> <Bob key> 2 CHECKMULTISIGVERIFY ELSE <Bob key> CHECKSIGVERIFY SHA256 <hash_of_secret> EQUALVERIFY ENDIF – skydanc3r – 2017-07-27T11:47:03.843
You used VERIFY in that script, did you mean to? You don't need to end with OP_VERIFY, the script will still be valid at the end if a non-zero (true) value is on the stack. The VERIFY versions are mostly used to mark it as invalid early on rather than evaluating the whole script, like you might use "return false;" in Java or C++ – MeshCollider – 2017-07-27T12:37:06.067
Thanks. In my example the second condition after else (providing the secret) will not even be checked in case first condition is not met, because checkmultisigverify will end the script immediately. Got it right? – skydanc3r – 2017-07-27T13:05:09.803
Yep, correct :) – MeshCollider – 2017-07-27T19:21:46.260
Thanks a lot. It was confusing because in bip65 on github there is this example: IF <service pubkey> CHECKSIGVERIFY ELSE <expiry time> CHECKLOCKTIMEVERIFY DROP ENDIF <user pubkey> CHECKSIG but maybe there is mistake here in documentation. – skydanc3r – 2017-07-27T19:35:21.143