<p>A <code>P2SH</code> transaction will execute whatever <code>redeemScript</code> you provide, which must be a standard transaction:</p>

<blockquote>
  <p>Transactions that redeem these pay-to-script outpoints are only
  considered standard if the serialized script - also referred to as the
  redeemScript - is, itself, one of the other standard transaction
  types. See <a href="https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki#specification" rel="nofollow noreferrer">BIP16</a></p>
</blockquote>

<p>Those standard transactions, like a <code>P2PKH</code> does require a signature, so even though you provide the right <code>redeemScript</code>, if it doesn't execute successfully, the entire tx will become invalid.</p>

CC BY-SA 4.0
2019-09-04T12:12:29.063Z
Just to note, Bitcoin Core 0.10.0 and later no longer require that the redeemScript is one of the standard transaction types. See https://github.com/bitcoin/bitcoin/pull/4365.
Martin Harrigan
CC BY-SA 4.0
2018-11-15T21:01:59.290Z
2018-11-15T21:01:59.290Z
JBaczuk
<p>Most transaction outputs to P2SH addresses have the following scriptPubKey:</p>

<pre><code>HASH160 f45d94733d430261962932e0c847075195916a04 OP_EQUAL
</code></pre>

<p>As I understand it, this transaction do not need to be signed. Is it true?</p>

<p>The user just needs to provide a redeemScript whose HASH160 is equal to f45d94733d430261962932e0c847075195916a04.</p>

<p>So, if we know that: </p>

<pre><code>HASH160(data1) = hash1
HASH160(data2) = hash2
</code></pre>

<p>and the user creates two transaction outputs to P2SH addresses with the scriptPubKeys:</p>

<pre><code>HASH160 f45d94733d430261962932e0c847075195916a04 OP_EQUAL
</code></pre>

<p>then the scriptPubKey is the same for both transaction outputs, but why is the redeemScript is always different?  </p>

<pre><code>HASH160(data1) = hash1
HASH160(data2) = hash1
....
????
</code></pre>

CC BY-SA 4.0
2018-11-15T20:25:54.437Z
Can you provide an example of two different redeem scripts with the same hash?
Mike D
<bitcoin-core><script><bitcoin-core-development><input-script>
Different redeemScript for the same scriptPubKey?
Andrew
# Different redeemScript for the same scriptPubKey?

(Asked by: username_0 on 2018-11-15)

Most transaction outputs to P2SH addresses have the following scriptPubKey:

```
HASH160 f45d94733d430261962932e0c847075195916a04 OP_EQUAL

```

As I understand it, this transaction do not need to be signed. Is it true?

The user just needs to provide a redeemScript whose HASH160 is equal to f45d94733d430261962932e0c847075195916a04.

So, if we know that:

```
HASH160(data1) = hash1
HASH160(data2) = hash2

```

and the user creates two transaction outputs to P2SH addresses with the scriptPubKeys:

```
HASH160 f45d94733d430261962932e0c847075195916a04 OP_EQUAL

```

then the scriptPubKey is the same for both transaction outputs, but why is the redeemScript is always different?

```
HASH160(data1) = hash1
HASH160(data2) = hash1
....
????

```

**Tags:** bitcoin-core, script, bitcoin-core-development, input-script

> **Comments:**
> **username_1**: Can you provide an example of two different redeem scripts with the same hash?  

---

## 1 answers

### Answer by username_2 on 2018-11-15. Score: 1

A `P2SH` transaction will execute whatever `redeemScript` you provide, which must be a standard transaction:

> Transactions that redeem these pay-to-script outpoints are only
> considered standard if the serialized script - also referred to as the
> redeemScript - is, itself, one of the other standard transaction
> types. See [BIP16](https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki#specification)

Those standard transactions, like a `P2PKH` does require a signature, so even though you provide the right `redeemScript`, if it doesn't execute successfully, the entire tx will become invalid.

> **Comments:**
> **username_3**: Just to note, Bitcoin Core 0.10.0 and later no longer require that the redeemScript is one of the standard transaction types. See https://github.com/bitcoin/bitcoin/pull/4365.  

---

