<blockquote>
  <p>What does it mean "push data operations"?</p>
</blockquote>

<p>Push data operations are when a script pushes a byte vector into the stack. Examples are pushing signatures, public keys, or scripts. It excludes all script opcodes apart from OP_PUSHDATA1, OP_PUSHDATA2, OP_PUSHDATA3. </p>

<blockquote>
  <p>OP_CHECKMULTISIG seems to be allowed but does not look like "push data" to me.
  OP_CHECKMULTISIG is an opcode, however, since it's actually contained in a byte vector. You are pushing a full script to the stack, instead of just pushing the opcode.</p>
</blockquote>

<p>So, if you look at a P2SH scriptSig:</p>

<blockquote>
  <p>...signatures... {scriptLength}{script}</p>
</blockquote>

<p>You'll see that OP_CHECKMULTISIG is contained within {script} instead of being directly executed by whatever is parsing the scriptSig. </p>

CC BY-SA 3.0
2014-12-15T09:43:08.350Z
2014-12-15T09:43:08.350Z
karimkorun
<p>Like <a href="https://bitcoin.stackexchange.com/users/208/pieter-wuille">Pieter Wuille</a> mentions, there is a difference between the <code>scriptPubKey</code> and the <code>scriptSig</code> script.</p>

<p>When a transaction is made, every output has it's own <code>scriptPubKey</code> script that specifies the condition to spend the output. Standard pay-to-address transactions have a script that can be interpreted as "sign this hash with the private key that corresponds to this address".</p>

<p>To spend the output, one must include it as an input in a new transaction. But to fulfil the output script, you will need to pass data as input to the script, mostly this is a signature. This data is passed in the <code>scriptSig</code> script.</p>

<p>The <a href="https://en.bitcoin.it/wiki/Script" rel="nofollow">wiki page on the scripting concept</a> will probably help you understand it.</p>

CC BY-SA 3.0
2014-01-08T18:14:43.970Z
Yes, I know how scripts work, but note this question is specifically about BIP0016. The question arised because `OP_CHECKMULTISIG` is in `scriptSig` (actually, in its inner serialized script) so it still applies. I guess the answer is: "the restriction only applies to the outer non-serialized scriptSig", is that correct?
kaoD
CC BY-SA 3.0
2014-01-08T21:30:20.633Z
You probably refer to this example `scriptSig: [signature] {[pubkey] OP_CHECKSIG}`. I think the curly brackets mean that the result of the operation between them is included. So it has 2 data elements. The signature and the result. But I'm not entirely sure of it, I didn't read the whole BIP. If the answer appears irrelevant, I'll remove it, just to thought you were confusing the two different script types.
Steven Roose
CC BY-SA 3.0
2014-08-06T20:04:56.773Z
The scriptSig contains 2 push operations: one with the signature, one with the serialized script. The scriptSig itself only contains pushes. Obviously, one of those pushes contains the actual script, but it's still just a push.
Pieter Wuille
CC BY-SA 3.0
2014-01-08T11:29:58.253Z
2014-01-08T11:29:58.253Z
Steven Roose
<p>In the "Pay to Script Hash", ScriptSig looks like this</p>

<blockquote>
  <p>...signatures... {serialized script}</p>
</blockquote>

<p>and ScriptPubKey is </p>

<blockquote>
  <p>OP_HASH160 [20-byte-hash-value] OP_EQUAL</p>
</blockquote>

<p>You have to understand that {serialized script} in the ScriptSig is initially treated as a constant that just gets pushed onto the data stack. So even if {serialized script} is {[pubkey] OP_CHECKSIG}, as mentioned later in BIP16 as an example, it will not fail validation because the OP_CHECKSIG is not treated as an operation, it is just part of a constant. </p>

<p>Note that there are two validation steps in "Pay to Script Hash". The first step is where {serialized script} is treated as a constant and the rest of the script makes sure that the [20-byte-hash-value] is indeed the hash of {serialized script}. </p>

<p>The second validation step occurs when the first validation step succeeds, and 
in the words of BIP16 </p>

<blockquote>
  <p>{serialized script} is popped off the initial stack, and the transaction is validated again using the popped stack and the deserialized script as the scriptPubKey.</p>
</blockquote>

<p>If you are still confused, I have written a beginner friendly article that explains how "Pay to Script Hash" works and walks through the execution of an example script in an article here: </p>

<p><a href="http://kaykurokawa.blogspot.com/2014/07/scripting-in-bitcoin-part-2.html" rel="nofollow">http://kaykurokawa.blogspot.com/2014/07/scripting-in-bitcoin-part-2.html</a></p>

CC BY-SA 3.0
2014-08-06T19:39:10.300Z
2014-08-06T19:39:10.300Z
k kurokawa
<p><a href="https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki" rel="nofollow">BIP0016</a> says <code>"Validation fails if there are any operations other than "push data" operations in the scriptSig"</code>.</p>

<p>What does it mean "push data operations"? <code>OP_CHECKMULTISIG</code> seems to be allowed but does not look like "push data" to me.</p>

CC BY-SA 3.0
2014-01-08T09:19:18.100Z
Note that the rule is about the scriptSig, not the scriptPubKey. The former contains the data that is passed to the latter.
Pieter Wuille
<multi-signature><p2sh>
BIP0016 pay-to-scripthash transaction validation
kaoD
# BIP0016 pay-to-scripthash transaction validation

(Asked by: username_0 on 2014-01-08)

[BIP0016](https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki) says `"Validation fails if there are any operations other than "push data" operations in the scriptSig"`.

What does it mean "push data operations"? `OP_CHECKMULTISIG` seems to be allowed but does not look like "push data" to me.

**Tags:** multi-signature, p2sh

> **Comments:**
> **username_1**: Note that the rule is about the scriptSig, not the scriptPubKey. The former contains the data that is passed to the latter.  

---

## 3 answers

### Answer by username_2 on 2014-12-15. Score: 1

> What does it mean "push data operations"?

Push data operations are when a script pushes a byte vector into the stack. Examples are pushing signatures, public keys, or scripts. It excludes all script opcodes apart from OP\_PUSHDATA1, OP\_PUSHDATA2, OP\_PUSHDATA3.

> OP\_CHECKMULTISIG seems to be allowed but does not look like "push data" to me.
> OP\_CHECKMULTISIG is an opcode, however, since it's actually contained in a byte vector. You are pushing a full script to the stack, instead of just pushing the opcode.

So, if you look at a P2SH scriptSig:

> ...signatures... {scriptLength}{script}

You'll see that OP\_CHECKMULTISIG is contained within {script} instead of being directly executed by whatever is parsing the scriptSig.


---

### Answer by username_3 on 2014-01-08. Score: 0

Like [username_1 username_1](https://bitcoin.stackexchange.com/users/208/username_1-username_1) mentions, there is a difference between the `scriptPubKey` and the `scriptSig` script.

When a transaction is made, every output has it's own `scriptPubKey` script that specifies the condition to spend the output. Standard pay-to-address transactions have a script that can be interpreted as "sign this hash with the private key that corresponds to this address".

To spend the output, one must include it as an input in a new transaction. But to fulfil the output script, you will need to pass data as input to the script, mostly this is a signature. This data is passed in the `scriptSig` script.

The [wiki page on the scripting concept](https://en.bitcoin.it/wiki/Script) will probably help you understand it.

> **Comments:**
> **username_0**: Yes, I know how scripts work, but note this question is specifically about BIP0016. The question arised because `OP_CHECKMULTISIG` is in `scriptSig` (actually, in its inner serialized script) so it still applies. I guess the answer is: "the restriction only applies to the outer non-serialized scriptSig", is that correct?  
> **username_3**: You probably refer to this example `scriptSig: [signature] {[pubkey] OP_CHECKSIG}`. I think the curly brackets mean that the result of the operation between them is included. So it has 2 data elements. The signature and the result. But I'm not entirely sure of it, I didn't read the whole BIP. If the answer appears irrelevant, I'll remove it, just to thought you were confusing the two different script types.  
> **username_1**: The scriptSig contains 2 push operations: one with the signature, one with the serialized script. The scriptSig itself only contains pushes. Obviously, one of those pushes contains the actual script, but it's still just a push.  

---

### Answer by username_4 on 2014-08-06. Score: 0

In the "Pay to Script Hash", ScriptSig looks like this

> ...signatures... {serialized script}

and ScriptPubKey is

> OP\_HASH160 [20-byte-hash-value] OP\_EQUAL

You have to understand that {serialized script} in the ScriptSig is initially treated as a constant that just gets pushed onto the data stack. So even if {serialized script} is {[pubkey] OP\_CHECKSIG}, as mentioned later in BIP16 as an example, it will not fail validation because the OP\_CHECKSIG is not treated as an operation, it is just part of a constant.

Note that there are two validation steps in "Pay to Script Hash". The first step is where {serialized script} is treated as a constant and the rest of the script makes sure that the [20-byte-hash-value] is indeed the hash of {serialized script}.

The second validation step occurs when the first validation step succeeds, and
in the words of BIP16

> {serialized script} is popped off the initial stack, and the transaction is validated again using the popped stack and the deserialized script as the scriptPubKey.

If you are still confused, I have written a beginner friendly article that explains how "Pay to Script Hash" works and walks through the execution of an example script in an article here:

<http://kaykurokawa.blogspot.com/2014/07/scripting-in-bitcoin-part-2.html>


---

