what are the essentials of P2SH? Whats cool about it , why is it important?
JF
Simple version is that it allows you to encumber an output with the hash of a script. This means the sender just has the ability to just "send to an address" and the receiver can have the script associated with that address be anything.
As an example:
Lets say I wanted you to pay me by sending funds to me that would be secured by a 2-of-3 multisig sig script. Sounds complicated huh?
All you do is send funds to this address 31vqFj21siCMUso7KcmRVGMvFyaVbXZXhP. It is that easy. You don't need to do anything different other than "pay an address".
Behind the scenes when your client decodes this address it will find that it contains a scriptHash (029ceacd493bac104217f4da1a0b8c13a18110e4) and create an output which has the following PkScript:
OP_HASH160 029ceacd493bac104217f4da1a0b8c13a18110e4 OP_EQUAL
This says restrict the redemption of this output to a script which hashes to 029ceacd493bac104217f4da1a0b8c13a18110e4. You don't need to worry about if the script is Standard, validating it, trying to figure out how to make a custom tx to fund this script. You just "send some coins" to the 31vqFj21siCMUso7KcmRVGMvFyaVbXZXhP.
The following isn't necessary for the sender (you to know) but how it works is I created a 2-of-3 multisig script.
In hex it is:
522102d83bba35a8022c247b645eed6f81ac41b7c1580de550e7e82c75ad63ee9ac2fe2103aeb681df5ac19e449a872b9e9347f1db5a0394d2ec5caf2a9c143f86e232b0d82103d728ad6757d4784effea04d47baafa216cf474866c2d4dc99b1e8e3eb936e73153ae
It you take a HASH-160 of the script you get 029ceacd493bac104217f4da1a0b8c13a18110e4 and if you encode that with Base58Checked you get 31vqFj21siCMUso7KcmRVGMvFyaVbXZXhP.
You aren't required to use P2SH for complex scripts but tell me which one is easier for you as the sender to do:
a) send 1 BTC to 31vqFj21siCMUso7KcmRVGMvFyaVbXZXhP
or
b) Please pay me by sending a custom tx. Set one of the outputs to be 1 BTC with a PubKeyScript of 522102d83bba35a8022c247b645eed6f81ac41b7c1580de550e7e82c75ad63ee9ac2fe2103aeb68
1df5ac19e449a872b9e9347f1db5a0394d2ec5caf2a9c143f86e232b0d82103d728ad6757d4784e
ffea04d47baafa216cf474866c2d4dc99b1e8e3eb936e73153ae. Make sure you manually compute the other outputs. Sorry no client helps you do this so fire up bitcoind (or bitcoin-qt w/server=1) and use the createrawtransaction RPC call. You will need to manually pick your inputs from the unspent set so you might also want to take a look at listunspent and you will neeed to sign and submit the custom tx using signrawtransaction and sendrawtransaction. Don't worry you can use help
on each of these to figure out the custom syntax.
Now imagine this is a business can you imagine asking thousands of customers to do "b"?