Bitcoin Forum
February 22, 2026, 12:06:20 AM *
News: Latest Bitcoin Core release: 30.2 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Segwit - P2SH nested in a P2WSH  (Read 690 times)
laurentmt (OP)
Sr. Member
****
Offline Offline

Activity: 384
Merit: 286


View Profile
January 09, 2017, 11:07:36 PM
 #1

Hi there,

A (stupid) question about segwit : what happens if I use a P2SH script (HASH160 <20-byte-hash> EQUAL) as the witness script of a P2WSH scriptpubkey ? Is it processed as a simple validation of a hash or does it also trigger the evaluation of the P2SH script ?

Thanks in advance !
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3892
Merit: 7608


Just writing some code


View Profile WWW
January 09, 2017, 11:24:39 PM
 #2

You have the wrong assumption here. The normal p2sh output is not some special output that triggers a special behavior. There is no special behavior. The way script validations works is the input script (i.e. scriptsig) and the output script (p2sh in this case) are concatenated (input then output) and evaluated command by command.

Your p2sh script as the script of a p2wsh script would thus hash whatever is on top of the stack and compare that to the hash you specify. It would not go looking elsewhere.

laurentmt (OP)
Sr. Member
****
Offline Offline

Activity: 384
Merit: 286


View Profile
January 12, 2017, 01:49:28 AM
 #3

Makes sense. Thanks !
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!