<p>There was a longer discussion thread in bitcointalk, I proide two references:</p>

<p><a href="https://bitcointalk.org/index.php?topic=2333913.msg23758008#msg23758008" rel="nofollow noreferrer">https://bitcointalk.org/index.php?topic=2333913.msg23758008#msg23758008</a></p>

<p><a href="https://bitcointalk.org/index.php?topic=1682183.msg21389041#msg21389041" rel="nofollow noreferrer">https://bitcointalk.org/index.php?topic=1682183.msg21389041#msg21389041</a></p>

<p>(Both threads are worthwhile to read in it's entirety). 
In short: before nodes talk to each other, they verify the capabilities. And a segwit node would reduce the information for a non-segwit node, so that he can understand the transaction details.  </p>

CC BY-SA 3.0
2018-03-16T12:42:49.020Z
2018-03-16T12:42:49.020Z
pebwindkraft
<p>I understand that P2SH addresses are used to allow "segwit unaware" wallets to create outputs spendable by segwit wallets (please correct me if I got something wrong). For new clients I think I got it: they will check that the script cointaned in the witness matches the script hash and execute it.</p>

<p>What I do not understand is how this  output is spendable by a segwit aware client to the eyes of an old client. Because it clearly doesn't look like an anyone can spend. How does it work?</p>

<p>Thanks.</p>

CC BY-SA 3.0
2018-03-15T22:21:35.350Z
Why doesn't it  look like an anyone can spend?
Osias Jota
CC BY-SA 3.0
2018-03-15T23:26:48.593Z
My statement came from the belief that the p2sh address was generated by encoding hash160 <witness program hash> op_equal. I found this: https://github.com/bitcoinbook/bitcoinbook/issues/440 . This means that decoding it makes it an anyone can spend for old clients right?
domegabri
CC BY-SA 3.0
2018-03-16T17:39:27.687Z
In addition to the previous comment: https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#p2wpkh-nested-in-bip16-p2sh . Segwit clients use a non-empty scriptSig when spending outputs received from old clients.
domegabri
<segregated-witness><p2sh>
segwit nested in p2sh
domegabri
# segwit nested in p2sh

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

I understand that P2SH addresses are used to allow "segwit unaware" wallets to create outputs spendable by segwit wallets (please correct me if I got something wrong). For new clients I think I got it: they will check that the script cointaned in the witness matches the script hash and execute it.

What I do not understand is how this output is spendable by a segwit aware client to the eyes of an old client. Because it clearly doesn't look like an anyone can spend. How does it work?

Thanks.

**Tags:** segregated-witness, p2sh

> **Comments:**
> **username_1**: Why doesn't it  look like an anyone can spend?  
> **username_0**: My statement came from the belief that the p2sh address was generated by encoding hash160 <witness program hash> op_equal. I found this: https://github.com/bitcoinbook/bitcoinbook/issues/440 . This means that decoding it makes it an anyone can spend for old clients right?  
> **username_0**: In addition to the previous comment: https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#p2wpkh-nested-in-bip16-p2sh . Segwit clients use a non-empty scriptSig when spending outputs received from old clients.  

---

## 1 answers

### Answer by username_2 on 2018-03-16. Score: 1 | Accepted answer

There was a longer discussion thread in bitcointalk, I proide two references:

<https://bitcointalk.org/index.php?topic=2333913.msg23758008#msg23758008>

<https://bitcointalk.org/index.php?topic=1682183.msg21389041#msg21389041>

(Both threads are worthwhile to read in it's entirety).
In short: before nodes talk to each other, they verify the capabilities. And a segwit node would reduce the information for a non-segwit node, so that he can understand the transaction details.


---

