Friday, November 22, 2024

bitcoind – Create multisignature pockets from xpub keys in Bitcoin Core

This will likely be principally attainable within the upcoming Bitcoin Core 0.18 launch.

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

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

As descriptors are meant to be secure for human communication, they want a checksum in some circumstances. This checksum may be computed utilizing the getdescriptorinfo RPC command, which is able to append a #CHECKSUM suffix.

Upon getting the descriptor, you are able to do a number of issues with it. One is figuring out the corresponding addresses utilizing deriveaddresses.

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

Provides you with the primary 1001 addresses (utilizing keys with listed 0 via 1000) to your descriptor.

You can even import them right into a pockets, utilizing the versatile importmulti RPC, which in 0.18 is prolonged to help descriptors.

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

Will import the primary 1000 addresses, collectively will all info needed to acknowledge funds to them, and signal for spending them (excluding the non-public keys, in fact).

  • The watchonly signifies you are conscious non-public keys are lacking, however wish to import as watched anyway.
  • The timestamp signifies the primary time these keys could have been used. "now" means you recognize the keys have not been used but (or you do not care about their historical past); alternatively you may give a timestamp because the variety of seconds since UNIX epoch to specify a beginning time.

Word that this is not going to mechanically look ahead to greater than the primary 1000 addresses as they get consumed – you will want a brand new import command for that (for now).

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles