I need to create and broadcast a MULTISIG transaction to the test network. OP_CHECKMULTISIG is to be used. I need a locking script that requires my public key and 1 of other 3 people’s. The order of the signatures in unlocking script should not matter.
As far as i know OP_CHECKMULTISIG requires order, so I don’t know how to deal with no order situation. Also, how am I even going to check the signature of mine with my public key if its not top of the stack at the beginning. It seems too complex, but if there’s an easier way or a certain scheme I’d gladly take the help.
Also, does this mean that only 2 signature would be given for unlocking script or more than 2 is possible? If so I made one, but it’s not using OP_CHECKMULTISIG and not sure if its valid:
OP_CHECKSIG
OP_IF
# If yes, second signature must be an employee's
OP_SWAP # [result1, sig2]
OP_DUP OP_CHECKSIG OP_SWAP
OP_DUP OP_CHECKSIG OP_SWAP
OP_DUP OP_CHECKSIG
OP_ADD OP_ADD
OP_1 OP_GREATERTHANOREQUAL # At least 1 employee signed
OP_ELSE
# If first is not manager's, check if it's an employee's
OP_SWAP # [result1, sig2]
OP_DUP OP_CHECKSIG OP_SWAP
OP_DUP OP_CHECKSIG OP_SWAP
OP_DUP OP_CHECKSIG
OP_ADD OP_ADD
OP_1 OP_GREATERTHANOREQUAL OP_IF
# If first is an employee's, second must be manager's
OP_CHECKSIG
OP_ELSE
OP_0 # Fail if first sig is neither
OP_ENDIF
OP_ENDIF