Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: laurentmt on February 18, 2015, 10:41:24 PM



Title: Nested P2SH
Post by: laurentmt on February 18, 2015, 10:41:24 PM
I've just found a strange script in the first input of this transaction (http://webbtc.com/tx/f9f19561a1b9d5e3d3d1cc90a83ac104d9c16f5982040b7aa8cbc4d93154d337). It looks like a PS2H inside a P2SH :

scriptPubKey = OP_HASH160 f2941f... OP_EQUAL
scriptSig = OP_PUSHDATA1 98 4c96225... 17 a914ced... 
  with a914ced... = OP_HASH160 14 cede0e... OP_EQUAL

My understanding is that :
- first, we check that hash160(a914ced...) = f2941f...
- then, we check that hash160(4c96225...) = cede0e... (the redeem script acts like a puzzle)

But the script debugger seems to have a very different interpretation which I don't understand. Do I miss something ?


Title: Re: Nested P2SH
Post by: hhanh00 on February 19, 2015, 01:29:05 PM
The script debugger only shows you the inner script evaluation.


Title: Re: Nested P2SH
Post by: laurentmt on February 19, 2015, 01:49:17 PM
The script debugger only shows you the inner script evaluation.
It's weird because usually the script debugger shows the complete evaluation (e.g. the P2PKH output of the same transaction).
Anyway. Do you think that my understanding of the script is correct (i.e. we have a puzzle nested inside a P2SH) ?


Title: Re: Nested P2SH
Post by: hhanh00 on February 19, 2015, 02:57:31 PM
It looks like it. IMHO, it's not smart because the miner can trivially rewrite the tx and steal the coins.


Title: Re: Nested P2SH
Post by: laurentmt on February 19, 2015, 05:44:29 PM
It looks like it. IMHO, it's not smart because the miner can trivially rewrite the tx and steal the coins.
Yep. That's the problem of script puzzles without signatures.
I think it's just someone having some fun with bitcoin scripts or may be it was a game... I don't know.
Anyway, thanks for your answer.