Suppose you have a company which has three main leaders called A, B and C also the company have 5 shareholders called S1 to S5. The decision rule for spending any coin from company’s address is to either we present 1 of the main leaders signature and three other signature from shareholders.
For example following unlocking script works (since it contains one of the leaders):
<sig_S1> <sig_A> <sig_S2> <sig_S5>
but not this one:
<sig_S1> <sig_S4> <sig_S3> <sig_S5>
How I can check if amongst multi signatures there exist a signature which corresponds to a specific public key, in this case, I will learn that a leader’s signature surely exists. for example, if we find out from 5 signatures provided the signature of A exists, and the locking code will look like follows:
(3 times duplicate of all signatures provided) (check for the existence of A in signatures) OP_IF 4 <pub_A> <pub_S1> <pub_S2> ... <pub_S5> 5 OP_CHECKMULTISIG OP_ENDIF (the same as above for B) (the same as above for C)