1 2016-08-07 22:33:24 <p2me> hey, i've got a question regarding P2SH, any help?
2 2016-08-07 23:06:40 <jl2012> p2me: just ask what you want to ask. People will answer when they see it
3 2016-08-07 23:12:25 <p2me> sure. i've been trying to learn more about bitcoin on the protocol level. i understand how the normal p2pkh stuff goes but p2sh is really confusing me.
4 2016-08-07 23:13:19 <p2me> the pubkeyscript = OP_HASH160 [20-byte-hash-value] OP_EQUAL
5 2016-08-07 23:14:44 <p2me> this seems only to ask for a hash of the redeem script with no mention of actually checking whether the redeem script itself returns true.
6 2016-08-07 23:15:52 <p2me> i know modern clients only accept 4 "standard" scripts and if they recognized a P2SH transaction validate the redeem script itself + the hash
7 2016-08-07 23:17:23 <p2me> but to an old client (which accepted non-standard scripts), wouldn't the hash alone be enough to spend the coins? could that client also mine the block or what would happen?
8 2016-08-07 23:36:33 <achow101> p2me: no, it asks for something which hashes to the specified 20 byte hash. This something is the redeemscript.
9 2016-08-07 23:38:27 <p2me> oops, worded that badly
10 2016-08-07 23:38:51 <p2me> right - it asks for something which when hashed = [20-byte-hash-value]
11 2016-08-07 23:39:26 <p2me> which is the redeem script, but where does it then check that the redeem script (along with the sigs you usually provide) actually validates?
12 2016-08-07 23:40:52 <p2me> if you had for example, 2 of 3 multisig in p2sh scriptsig would look like: <sig> <sig> <redeemscript>
13 2016-08-07 23:42:00 <p2me> why wouldn't JUST <redeemscript> work? specifically if you broadcast this tx to old nodes which handled non-standard scripts
14 2016-08-07 23:43:50 <warren> p2me: old nodes that don't understand P2SH you mean?
15 2016-08-07 23:44:01 <p2me> right
16 2016-08-07 23:46:18 <warren> p2me: In general soft-forks work by narrowing what is considered to be valid in newer software. Violations of new rules wouldn't be mined into blocks or verified by newer software following the new rules. Old software might consider violations of new rules that it doesn't know about to be "valid" but it would fail to confirm on the longest chain that they follow.
17 2016-08-07 23:47:18 <warren> Not sure if that makes sense.
18 2016-08-07 23:51:42 <p2me> is that invalidating specific to P2SH? i heard you could get "non-standard" scripts onto the blockchain if an older node managed to mine them
19 2016-08-07 23:55:04 <p2me> like, i could send coins to pubkeyscript "solve 5+5" if i mined the block myself. new nodes wouldn't relay it because it's not 1 of the 4 standard tx types but they'd still validate it if it was in a block
20 2016-08-07 23:57:13 <p2me> (the "solve 5+5" example being a raw pubkeyscript, NOT a P2SH), like these things: https://medium.com/@alcio/a-look-at-bitcoin-non-standard-outputs-c97f65cccbb6#.p5x22lm9x