4

In a pay 2 script hash transaction, does the redeem script get checked for valid public keys before a transaction can be signed? I have noticed that if I have a redeem script with one invalid pubkey out of 3, even if I sign with a valid private key for the multi-sig transaction, the "scriptSig" is blank and the hex returned for the signrawtransaction is small/incomplete.

Any ideas?

I saw a comment on here that led me to believe that public keys in redeem scripts could be text or 'anything'

2
  • Get checked by what? What code/project are you using to sign transactions? Commented Jan 17, 2017 at 13:21
  • I am using bitcoin-cli
    – Derek
    Commented Jan 17, 2017 at 16:57

2 Answers 2

1

For m of n multisig, only the last m pub keys are checked for validity, given that at least the last m pub keys are valid public keys and match to signatures in the correct order. Other pub keys are not checked and can be used to push arbitrary data.

0

You are doing something wrong. (or your tool is broken)

Signing the input can not leave scriptSig blank

4
  • the tool is bitcoin-cli. I can reproduce steps in my question later if needed, but if you want to try - run createmultisig then modify one of the public keys that is in the redeemscript. Send btc to the multi address. Create a 3rd party and try to send to that user. Sign the "send" transaction with the modifed redeemScript, and you'll see that scriptSig is blank
    – Derek
    Commented Jan 17, 2017 at 17:00
  • If you modify one of the keys, the corresponding address will change. Bitcoin Core cannot even know how to sign for it without knowing that. Commented Jan 17, 2017 at 17:28
  • Are you saying that the signature part re-creates the mutlisign address using the keys that are found in the "corrupt" redeemScript? I would have thought that was encoded in the transaction that was created using the real redeemScript
    – Derek
    Commented Jan 17, 2017 at 17:30
  • I think what @PieterWuille means, and correct me if I'm wrong, is that if you modify one of the public keys used to create the redeemScipt, the reddemScript itself changes, that is: the address format for P2SH according to BIP13 is [one-byte version][20-byte hash][4-byte checksum], since the 20 byte hash represents the hash of the scrip you have created, lets say its a 1-3 multisig address like: address = 1 <PubKey1><PubKey2><PubKey3> 3, if you change, for example PubKey2 for a new one: address2 = 1 <PubKey1><PubKey4><PubKey3> 3, the resulting script will change (address != address2).
    – sr_gi
    Commented Feb 16, 2017 at 11:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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