This question is a continuation of the my post yesterday.
Today I have a question on P2SH execution so, an example of the script should be this
OP_0 <A Signature> <B Signature> OP_2 <Public key A> <Public key B>
<Public key C> OP_3 OP_CHECKMULTISIG
OP_HASH160 <ScriptSig Hash> OP_EQUAL
or if used the P2SH key should be is this (I think in this script left-hand something to convert the hash160 inside the P2SH key, right?)
OP_0 <A Signature> <B Signature> OP_2 <Public key A> <Public key B>
<Public key C> OP_3 OP_CHECKMULTISIG
OP_HASH160 <P2SH key> OP_EQUAL
Now if I have understood well the simulation of the execution is divided into two phases
- The hash
scriptSig
is equal to hash inside thescriptPubKey
Simulation
- Put on the
scriptSig
on the stack, so the stack now is<A sig> <B sig> <A pubkey> <B pubkey> <C pubkey>
- Calculate the
hash160
with the data inside the stack, so now the stack status is<scriptSig hash>
- Put on the
scriptSig
hash expected, now the stack status is<hash scriptsig> <hash scriptsigexpected>
- return the result of the operator
OP_EQUAL
(true or false)
- the
scriptSig
will execute such as the script multi-signature
Simulation
- put on the stack the
scriptSig
, the stack status is<A Signature> <B Signature>
- push the public keys, that stack status is
<A Signature> <B Signature> <Public key A> <Public key B> <Public key C>
- apply the
OP_CHECKMULTISIG
operator and get the result
My questions are:
- With the P2SH key, the execution is the same? if not, what is the form of the P2SH with the P2SH key?
Also, I read this post but I don't think contains this answer.
If my example script is wrong, I'm sorry to give me a corrections