Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: BusyAssistant on February 08, 2019, 05:54:18 AM



Title: Creating a multisig address with HD key/ non-HD key?
Post by: BusyAssistant on February 08, 2019, 05:54:18 AM
Is it valid to create a 2/3 multisig address using a mix of HD keys and non- HD?

Reason I ask is because on bitcoin-cli when trying to sign, I'm getting an error about invalid private key when trying to sign a 2/3 tx with the HD child private key. It might be something else, but is this valid?

The exact error msg is this:

Code:
bitcoinrpc.authproxy.JSONRPCException: -5: Invalid private key

Thanks


Title: Re: Creating a multisig address with HD key/ non-HD key?
Post by: pooya87 on February 08, 2019, 06:07:14 AM
you can't mix an extended key with a normal private key and get a multi signature address. a multi sig is created by mixing the private keys themselves. so to create a 2 of 3 key you need to give your function 3 private keys or define a new function yourself that takes an extended key, derives n keys from it and then mixes it with the single keys (m-n) keys that you additionally give it and returns the multi signature address for you.


Title: Re: Creating a multisig address with HD key/ non-HD key?
Post by: BusyAssistant on February 08, 2019, 05:25:43 PM
Ok so I am not using an extended private key to generate the multisig address. I'm using a prviate key derived from it (a child private key?).

I successfully generate the 2/3 address via bitcoin-cli method createmultisig with the public keys (1 belonging to child public key, 2 belonging to standard non-HD keys).

So just to clarify, it is valid to create a multisig address with mixed normal and child public keys?


Title: Re: Creating a multisig address with HD key/ non-HD key?
Post by: jackg on February 08, 2019, 05:33:12 PM
Yes it is! They're all still private keys, they follow the same format just one can be derived from a seed.

You can do some useless fancy stuff with these keys to oalrhough I'm not sure why you would do what you're trying to do. There may come issues later on when you try to make and sign a transaction if they're on different applications (unless you have all three on an instance of electrum or something or you want to spend them all at once and can import them to bitcoin core or another client at the point you want to spend them).


Title: Re: Creating a multisig address with HD key/ non-HD key?
Post by: BusyAssistant on February 08, 2019, 05:39:58 PM
Ok thanks. It must be a syntax error I'm having when trying to sign, as it usually is. I have a hell of a time with the stupid escaping, and the signrawtransactionwithkey method has tons of parameters. Thanks.