Understanding Bitcoin Descriptor structure

5 replies 36 views
LuckyCoinLegendary
Posts: 832 · Reputation: 4795
#1May 21, 2020, 06:39 AM
So, I came across these new descriptors from Bitcoin Core and Sparrow Wallet, and they look like this: I'm kinda lost with them. I get that wpkh is for deriving P2WPKH keys, and the hash at the end is a checksum, but I'm confused about the chain code on the left and the xpub on the right. They each have their own derivation paths, and I’m not sure how they differ from each other.
4 Reply Quote Share
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#2May 21, 2020, 07:34 AM
The "e7ae72ff" on the left is the "master fingerprint" computed from the public key pair of the master private key. Refer to this post to see how it works: https://bitcointalk.org/index.php?topic=5444628.msg61903879#msg61903879 The derivation path indicates the actual positions of the displayed master fingerprint (representing "m") and the extended public key. So the watch-only descriptor's derivation path is m/84'/0'/0'(xpub)/0/*(address_index) defining the path to your receiving addresses. --edit-fixed-the-labeled-derivation-path--
0 Reply Quote Share
LuckyCoinLegendary
Posts: 832 · Reputation: 4795
#3May 21, 2020, 10:41 AM
So I see that given the master private key, first we derive 84h/0h/0h. Then I'm guessing the xpub value is just the extended public key resulting from that derivation? Since there's more derivation paths after it, it wouldn't make much sense if it was something otherwise.
0 Reply Quote Share
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#4May 23, 2020, 01:27 AM
Yes, from the example descriptor; it's the extended public key at m/84'/0'/0' (BTW, I double-checked it and removed an extra "/" ) Yes, that's done in the signer wallet where the master private key is available. In descriptors without private key like your example, the extended public key is specified instead and its derivation path from the master private key is indicated on its left.
4 Reply Quote Share
yield_forkFull Member
Posts: 162 · Reputation: 728
#5May 23, 2020, 04:15 AM
An interesting detail is about the behavior of bitcoin core when importing an extended private key with the descriptor configured on the root node (m). When doing this and then exporting the descriptors (gethdkeys command for example) Bitcoin Core doesn't derive the fingerprint from the descriptor. Using for example the extended private key of an electrum wallet (with descriptors): Importing into Bitcoin Core: When listing the public keys available in the keystore using the gethdkeys command, Bitcoin Core returns the following: Note that there is no fingerprint listed in this case. Now, when comparing this to an extended private key set to the derivation path m/84'/0'/0', Bitcoin Core displays the fingerprint correctly. Here is an example:
2 Reply Quote Share
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#6May 23, 2020, 05:57 AM
It's a neat detail because otherwise, it'll be showing a value that wont be any of use. Here's why: That's because the xpub in your first example gethdkeys result is a "master public key" which is the pair of the master private key. Since it's the master public key, there's no reason to compute a master fingerprint because it's basically the master public key itself (w/o the chain code), hashed.
1 Reply Quote Share

Related topics