1

I understand how the validation works if someone wants to spend coins from a multisig address. But what if the receiver makes a mistake and provides an invalid script hash to the sender? Is there anyway that nodes can verify if the hash is from a valid script?

2

A cryptographic hash function projects an arbitrary amount of data to a limited image space. In the case of P2SH, the hash is a RIPEMD160 hash, projecting the redeem script to an hash digest of exactly 20 B (160 b) length.

This is a trapdoor or one-way function that cannot be reverted (if it can be reverted, it's broken and therefore not a cryptographic hash function). Thus, a recipient cannot tell what redeem script was hashed to produce the P2SH address, and consequently cannot evaluate the validity of the redeem script.

If the recipient makes a mistake and provides the hash of an invalid script, there is no recourse.

  • Thanks for the thoughtful answer. So if the recipient makes a mistake the coins will simply be lost? – Pitchas Jul 11 '18 at 14:05
  • If the redeem script is unspendable, they are lost. – Murch Jul 11 '18 at 16:47
0

No, it is not possible. The only way that a node can verify the hash is correct is by having the script itself and checking the hash. Even then, there is no guarantee that the hash really belongs to some other valid script that the node does not know about. Since there are an infinite number of scripts, it would be impossible to check all possible valid scripts and their hashes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.