<p>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.</p>

CC BY-SA 4.0
2018-08-28T19:03:13.897Z
2018-08-28T19:10:07.877Z
2018-08-28T19:10:07.877Z
MCCCS
<p>You are doing something wrong. (or your tool is broken)</p>

<p>Signing the input <strong>can not</strong> leave scriptSig blank</p>

CC BY-SA 3.0
2017-01-17T17:00:43.513Z
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
CC BY-SA 3.0
2017-01-17T17:28:47.380Z
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.
Pieter Wuille
CC BY-SA 3.0
2017-01-17T17:30:31.547Z
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
CC BY-SA 3.0
2017-02-16T11:55:57.383Z
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
CC BY-SA 3.0
2017-01-17T05:43:57.610Z
2017-01-17T05:43:57.610Z
amaclin
<p>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.</p>

<p>Any ideas?</p>

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

CC BY-SA 3.0
2017-01-17T13:21:01.017Z
Get checked by what? What code/project are you using to sign transactions?
Pieter Wuille
CC BY-SA 3.0
2017-01-17T16:57:15.610Z
I am using bitcoin-cli
Derek
<script><multi-signature>
Multi-signature public key validation
Derek
# Multi-signature public key validation

(Asked by: username_0 on 2017-01-17)

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'

**Tags:** script, multi-signature

> **Comments:**
> **username_1**: Get checked by what? What code/project are you using to sign transactions?  
> **username_0**: I am using bitcoin-cli  

---

## 2 answers

### Answer by username_2 on 2018-08-28. Score: 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.


---

### Answer by username_3 on 2017-01-17. Score: 0

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

Signing the input **can not** leave scriptSig blank

> **Comments:**
> **username_0**: 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  
> **username_1**: 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.  
> **username_0**: 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  
> **username_4**: 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).  

---

