1

I can create Multisignature wallet electrum with 2 xpub keys.

How can I create bitcoin core to do that?

Standart use; Add a multisig address from 2 addresses

bitcoin-cli addmultisigaddress 2 "[\"16sSauSf5pF2UkUwvKGq4qjNRzBZYqgEL5\",\"171sgjn4YtPu27adkKGrdDwzRTxnRkBfKV\"]"

Is there way to do like;

bitcoin-cli addmultisigaddress 2 "[\"tpubDAenfwNu5GyCJWv8oqRAckdKMSUoZjgVF5p8WvQwHQeXjDhAHmGrPa4a4y2Fn7HF2nfCLefJanHV3ny1UY25MRVogizB2zRUdAo7Tr9XAjm\",\"tprv8erNzbjXdtYpKbKF4HeZpBCQj2W64MS2SAJCcWxgqLueSZ9KLTPZGoDTu8NugecLLqeS2RYan2f6qcexUTjp3m2HGxmpAiP48BaUz7XHxzQ\"]"

3

This will be mostly possible in the upcoming Bitcoin Core 0.18 release.

First you need to understand that the sequence of such paired multisig addresses (with public keys generated from 2 xpubs in lockstep) can be described in the new descriptor language.

The syntax is sh(multi(2,XPUB/*,XPUB/*)). The sh indicates P2SH embedding, multi refers to multisig, the 2 means 2 signatures are required, and the two XPUB arguments are what the public keys are drawn from.

As descriptors are intended to be safe for human communication, they need a checksum in some cases. This checksum can be computed using the getdescriptorinfo RPC command, which will append a #CHECKSUM suffix.

Once you have the descriptor, you can do multiple things with it. One is determining the corresponding addresses using deriveaddresses.

bitcoin-cli deriveaddresses "DESC" [0,1000]

Will give you the first 1001 addresses (using keys with indexed 0 through 1000) for your descriptor.

You can also import them into a wallet, all at once using the flexible importmulti RPC, which in 0.18 is extended to support descriptors.

bitcoin-cli importmulti [{"desc" : "DESC", "range" : [0, 1000], "watchonly" : true, "timestamp" : "now"}]

Will import the first 1000 addresses, together will all information necessary to recognize payments to them, and sign for spending them (excluding the private keys, of course).

  • The watchonly indicates you're aware private keys are missing, but want to import as watched anyway.
  • The timestamp indicates the first time these keys may have been used. "now" means you know the keys haven't been used yet (or you don't care about their history); alternatively you can give a timestamp as the number of seconds since UNIX epoch to specify a birth time.

Note that this will not automatically watch for more than the first 1000 addresses as they get consumed - you'll need a new import command for that (for now).

  • Ive finally put this to test and it is really handy. Any idea when importing an xprv in this manner will allow private key importing? It would be really nice to have an offline node that I can import xprv into to be the final signer of my HD musig transactions. – Fontaine Sep 5 at 2:40

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.