Author

Topic: P2SH address additional security (Read 465 times)

full member
Activity: 184
Merit: 101
September 13, 2017, 04:25:39 AM
#3
P2SH just lets you be even more secure by easily putting more conditions on the redemption of your coins, like requiring more than 1 key to spend.

If I use P2SH, the scriptPubKey is just 23 bytes and the sender doesn't have to worry about what exactly the redeem condition I am setting on my coins is. P2SH works like this. I take the script that I want to be my scriptPubKey and I serialize it (I'll use {} to denote serialization):
Code:
redeemScript = {OP_3 {pubkey1} {pubkey2} {pubkey3} {pubkey4} {pubkey5} OP_5 OP_CHECKMULTISIG}
redeemScript_hash = hash160(sha256(redeemScript))

And then the scriptPubKey that the sender actually uses is:
Code:
OP_HASH160 {redeemScript_hash} OP_EQUAL

Which is just 23 bytes in total. The nice thing is that it provides a layer of abstraction. The person who is sending me coins doesn't need to know how I am keeping my coins secure. All they see is a hash of a redeemScript, but they don't know what conditions that redeemScript actually puts on redeeming the coins.

Basically, P2SH itself is not inherently more secure because the redeem script can be anything. But what it does is enable coin-receivers to easily communicate how coin-senders should send them coins, while letting the coin-receivers dictate the conditions of how/when those coins can be spent.
staff
Activity: 3458
Merit: 6793
Just writing some code
September 12, 2017, 09:00:59 AM
#2
P2SH allows you to make and use whatever scripts you want and still have a standard transaction. There are fancy scripts you can make that would be considered non-standard if they were in an output. P2SH moves those scripts into the input and those scripts can be anything and still be considered standard. The requirements for spending from a P2SH address are unique because you can have any script you want. It is not that P2SH enables special things to be done, but rather it just makes those special things be standard scripts.
sr. member
Activity: 658
Merit: 282
September 12, 2017, 06:39:06 AM
#1
I read an article from Bitcoinwiki about Pay to script hash today:
https://en.bitcoin.it/wiki/Pay_to_script_hash

Quote
The recipient might need the signatures of several people to spend these bitcoins, or a password might be required, or the requirements could be completely unique.

This part sounds really interesting to me. What additional security measures are possible that are only hinted at in the quote? Does
anybody have a link where can I find a more detailed explanation of all the features that P2SH addresses offer in terms of security?
Jump to: