<p>It looks like you are confusing the BIP 32 serialization with output descriptor serialization.</p>
<p>Output descriptors contain an extended public key serialized using the method described in BIP 32. This serialization applies only to that particular public key. The derivation appended to the end is independent and separate from that xpub's serialization. That is part of descriptors.</p>
<blockquote>
<ol>
<li>My question is for example for the second key: is the <em>depth</em> connected with the appended tail /0/0/*? If it is, shouldn't it be 2 instead of 1? Can depth be restored from the appended tail?</li>
</ol>
</blockquote>
<p>No. The tail is independent from the xpub. The depth applies only to the pubkey serialized by the xpub, which the derivation path is not a part of.</p>
<blockquote>
<ol start="2">
<li>Why is the child index zero for the second key? Should it not be equal to the number that corresponds to the star. Can a child index be restored from the appended tail /0/0/*?</li>
</ol>
</blockquote>
<p>Because the serialization is only for that particular xpub. The appended derivation information is not part of this serialization.</p>

CC BY-SA 4.0
2021-05-23T01:11:06.367Z
2021-05-23T01:11:06.367Z
Ava Chow
<p>I'm looking at the following official test vector:</p>
<pre><code>wsh(multi(1,xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB/1/0/*,xpub69H7F5d8KSRgmmdJg2KhpAK8SR3DjMwAdkxj3ZuxV27CprR9LgpeyGmXUbC6wb7ERfvrnKZjXoUmmDznezpbZb7ap6r1D3tgFxHmwMkQTPH/0/0/*))
</code></pre>
<p>which is serialized for the first key as:</p>
<pre><code>04 ; version 4
88b21e ; `xpub`
00 ; depth 0 == public key of a master key
00000000 ; parent fingerprint
00000000 ; child index
60499f801b896d83179a4374aeb7822aaeaceaa0db1f85ee3e904c4defbd9689 ; chain code
03cbcaa9c98c877a26977d00825c956a238e8dddfbd322cce4f74b0b5bd6ace4a7 ; key data
e233a252 ; base58 checksum
</code></pre>
<p>and the second key:</p>
<pre><code>04 ; version 4
88b21e ; `xpub`
01 ; depth 1
bd16bee5 ; parent fingerprint
00000000 ; child index
f0909affaa7ee7abe5dd4e100598d4dc53cd709d5a5c2cac40e7412f232f7c9c ; chain code
02fc9e5af0ac8d9b3cecfe2a888e2117ba3d089d8585886c9c826b6b22a98d12ea ; key data
44183bfc ; base58 checksum
</code></pre>
<ol>
<li><p>My question is for example for the second key: is the <em>depth</em> connected with the appended tail /0/0/*? If it is, shouldn't it be 2 instead of 1? Can depth be restored from the appended tail?</p>
</li>
<li><p>Why is the child index zero for the second key? Should it not be equal to the number that corresponds to the star. Can a child index be restored from the appended tail /0/0/*?</p>
</li>
</ol>

<raw-data><output>
output descriptor serialization
Gorazd
# output descriptor serialization

(Asked by: username_0 on 2021-05-22)

I'm looking at the following official test vector:

```
wsh(multi(1,xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB/1/0/*,xpub69H7F5d8KSRgmmdJg2KhpAK8SR3DjMwAdkxj3ZuxV27CprR9LgpeyGmXUbC6wb7ERfvrnKZjXoUmmDznezpbZb7ap6r1D3tgFxHmwMkQTPH/0/0/*))

```

which is serialized for the first key as:

```
04 ; version 4
88b21e ; `xpub`
00 ; depth 0 == public key of a master key
00000000 ; parent fingerprint
00000000 ; child index
60499f801b896d83179a4374aeb7822aaeaceaa0db1f85ee3e904c4defbd9689 ; chain code
03cbcaa9c98c877a26977d00825c956a238e8dddfbd322cce4f74b0b5bd6ace4a7 ; key data
e233a252 ; base58 checksum

```

and the second key:

```
04 ; version 4
88b21e ; `xpub`
01 ; depth 1
bd16bee5 ; parent fingerprint
00000000 ; child index
f0909affaa7ee7abe5dd4e100598d4dc53cd709d5a5c2cac40e7412f232f7c9c ; chain code
02fc9e5af0ac8d9b3cecfe2a888e2117ba3d089d8585886c9c826b6b22a98d12ea ; key data
44183bfc ; base58 checksum

```

1. My question is for example for the second key: is the *depth* connected with the appended tail /0/0/\*? If it is, shouldn't it be 2 instead of 1? Can depth be restored from the appended tail?
2. Why is the child index zero for the second key? Should it not be equal to the number that corresponds to the star. Can a child index be restored from the appended tail /0/0/\*?

**Tags:** raw-data, output


---

## 1 answers

### Answer by username_1 on 2021-05-23. Score: 0 | Accepted answer

It looks like you are confusing the BIP 32 serialization with output descriptor serialization.

Output descriptors contain an extended public key serialized using the method described in BIP 32. This serialization applies only to that particular public key. The derivation appended to the end is independent and separate from that xpub's serialization. That is part of descriptors.

> 1. My question is for example for the second key: is the *depth* connected with the appended tail /0/0/\*? If it is, shouldn't it be 2 instead of 1? Can depth be restored from the appended tail?

No. The tail is independent from the xpub. The depth applies only to the pubkey serialized by the xpub, which the derivation path is not a part of.

> 2. Why is the child index zero for the second key? Should it not be equal to the number that corresponds to the star. Can a child index be restored from the appended tail /0/0/\*?

Because the serialization is only for that particular xpub. The appended derivation information is not part of this serialization.


---

