Understanding Bitcoin Descriptors

5 replies 343 views
0xNodeMember
Posts: 257 · Reputation: 80
#1Nov 23, 2021, 07:36 PM
What’s the deal with these Bitcoin descriptors from Core and Sparrow Wallet? I get that wpkh is about P2WPKH keys, and the end hash is a checksum but I’m lost on the left side where it shows what looks like a chain code and the xpub on the right... What’s the difference?
6 Reply Quote Share
0xChadNewbie
Posts: 138 · Reputation: 3
#2Nov 25, 2021, 11:05 AM
The "e7ae72ff" you see is actually the "master fingerprint." It's calculated from the public key of the master private key. The derivation path you see shows where the fingerprint and the xpub sit. For a watch-only descriptor, the path m/84'/0'/0' indicates where your receiving addresses are.
3 Reply Quote Share
0xNodeMember
Posts: 257 · Reputation: 80
#3Nov 25, 2021, 03:59 PM
So, if I get it right, starting from the master private key, we first go through 84h/0h/0h. Is the xpub just the extended public key we get after this? I mean, since there are more paths to follow, it has to be that way, right?
3 Reply Quote Share
0xChadNewbie
Posts: 138 · Reputation: 3
#4Nov 26, 2021, 02:33 AM
Exactly, from your example descriptor, the xpub is at m/84'/0'/0'. I double-checked and fixed an extra slash too. The signer wallet has the master private key so it does the derivation. In cases where there’s no private key, like your example, we use the xpub instead with its path on the left.
4 Reply Quote Share
Posts: 25 · Reputation: 179
#5Nov 26, 2021, 02:41 AM
Here’s something interesting about how Bitcoin Core handles importing extended private keys. If you set the descriptor at the root node (m) and export them later using something like the gethdkeys command, it won’t derive the fingerprint from the descriptor!
1 Reply Quote Share
0xChadNewbie
Posts: 138 · Reputation: 3
#6Nov 26, 2021, 03:54 AM
Yeah, that’s kinda cool but also confusing. The xpub from your first example is like a "master public key" which is paired with the master private key. So, there's no need to compute a master fingerprint since it’s basically the master public key hashed, without getting into chain codes.
5 Reply Quote Share

Related topics