<p>No, P2SH can only be invoked using the exact magic pattern described in BIP16 in the scriptPubKey and not using any variant of it, nor recursively inside the P2SH redeemScript itself.</p>

<p>Earlier proposals (see OP_EVAL) existed that did allow much more flexibility, but it was hard to give strong guarantees about execution time and memory in such a model.</p>

CC BY-SA 3.0
2016-03-16T10:49:41.367Z
2016-03-16T10:49:41.367Z
Pieter Wuille
<p>BIP16 P2SH defines special rules to apply on scripts with a specific pattern, namely:
<code>OP_HASH160 &lt;scriptHash&gt; OP_EQUAL</code>.</p>

<p>My question is: <strong>Can a P2SH be used within a script?</strong> So can I e.g. make a scriptPubKey:
<code>&lt;420000&gt; OP_CHECKLOCKTIMEVERIFY OP_DROP OP_HASH160 &lt;scriptHash&gt; OP_EQUAL</code>?
Or must all additional opcodes be in the redeemScript so that the whole scriptPubKey follows the pattern mentioned in the BIP16 above?</p>

<script><p2sh>
P2SH (pay to script hash) within a script?
Bjarne Magnussen
# P2SH (pay to script hash) within a script?

(Asked by: username_0 on 2016-03-15)

BIP16 P2SH defines special rules to apply on scripts with a specific pattern, namely:
`OP_HASH160 <scriptHash> OP_EQUAL`.

My question is: **Can a P2SH be used within a script?** So can I e.g. make a scriptPubKey:
`<420000> OP_CHECKLOCKTIMEVERIFY OP_DROP OP_HASH160 <scriptHash> OP_EQUAL`?
Or must all additional opcodes be in the redeemScript so that the whole scriptPubKey follows the pattern mentioned in the BIP16 above?

**Tags:** script, p2sh


---

## 1 answers

### Answer by username_1 on 2016-03-16. Score: 3 | Accepted answer

No, P2SH can only be invoked using the exact magic pattern described in BIP16 in the scriptPubKey and not using any variant of it, nor recursively inside the P2SH redeemScript itself.

Earlier proposals (see OP\_EVAL) existed that did allow much more flexibility, but it was hard to give strong guarantees about execution time and memory in such a model.


---

