bitcoin core – Why does importmulti not help zpub and ypub?

0
6
bitcoin core – Why does importmulti not help zpub and ypub?


The “xpub” format was outlined by BIP32. It is an ordinary that specifies easy methods to derive public keys from grasp public keys and seeds. Elements of it are extensively adopted, some elements aren’t. Nevertheless, it doesn’t say something about how the keys it generate needs to be become addresses, solely the keys themselves.

Now, on the time, there was solely actually one apparent means of turning a key into an addresses: through the use of its hash in a P2PKH (1…) deal with. This was applied by quite a few items of software program, which as a rule handled “importing an xpub” as “importing an xpub and watching all P2PKH addresses for the ensuing keys”. This made sense, as a result of it was how everybody needed to make use of them anyway.

Then got here alongside Segwit, which launched two new widespread methods of paying to single-key outputs. Pockets software program wanted a method to “mark” an xpub as being supposed for use for P2WPKH (bc1…) or P2SH-P2WPKH (3…), as an alternative of the normal P2PKH. Because the xpub normal had turn into interpreted as P2PKH solely (somewhat than an address-agnostic means of describing public keys), one thing aside from xpubs have been wanted. This is the reason some individuals adopted ypub/zpub for this objective.

I consider that is complicated, as it’s unclear now what an xpub means, and it’s not scalable: we will not preserve inventing new xpub-like codecs for every type of addresses which may be invented. Particularly with the introduction of multisig and extra advanced constructions, which merely do not match right into a single xpub-like factor (since you’ll want to mix a number of of them).

Because of this, Bitcoin Core is utilizing (and additional creating) an method known as Output Descriptors. These are strings that specify precisely and unambiguously what scripts/addresses are desired, primarily based on the concerned public keys. These expressions help xpubs, however solely within the authentic address-neutral that means – the remainder is conveyed utilizing capabilities on high of them. For instance:

  • pkh(xpub.../44'/0'/0'/0/*) would describe the BIP44 addresses derived from a specific xpub (P2PKH).
  • sh(wpkh(xpub.../49'/0'/0/*)) would describe the BIP49 addresses derived from a specific xpub (P2SH-P2WPKH).
  • wsh(multi(2,xpub1.../*,xpub2.../*,xpub3.../*)) represents a 2-of-3 P2WSH-embedded multisig.

There are a lot of extra options in descriptors, and there’s ongoing improvement.

Disclaimer: I am the writer of BIP32.

LEAVE A REPLY

Please enter your comment!
Please enter your name here