<p>The structure of the Bitcoin Core wallet makes it difficult to implement importing extended public keys. This structure makes several assumptions about keys available in the keypool which xpubs do not meet. One such assumption is availability of private keys. While it isn't impossible to implement support for it, doing so is difficult to do, difficult to review, and is largely a hack on top of a hack.</p>

<p>Recently, native descriptor wallets was merged into Bitcoin Core so you will be able to import xpubs that are in a descriptor in 0.21. Native descriptor wallets took a long time to implement because of structural changes that had to be made to the wallet to even be able to support this.</p>

CC BY-SA 4.0
2020-06-12T17:31:36.890Z
Thank you Andrew for answering so quickly. The last part from your answer is not to clear for me, my bad.

Does it mean that in the future version 0.21 from Bitcoin Core maybe it could be possible to import xpubs? Thanks!.
decentralized.b
CC BY-SA 4.0
2020-06-12T17:42:03.217Z
Yes. In 0.21 and later, you can create a descriptor wallet which allows you to import descriptors. Such descriptors can contain xpubs.
Ava Chow
CC BY-SA 4.0
2020-06-12T14:45:41.970Z
2020-06-12T14:45:41.970Z
Ava Chow
<p>I'm trying to create a watch-only wallet importing the extended public key from a Ledger Nano (as an example) but is not to easy to do directly to my Node, I should do it through electrum personal server or something like that.
I was trying to find a clear (like 5 years old) explanation of what is the reason for that.
I was trying to do that in the mainnet and from the regtest following the next command in order to get the checksum but all the time a message said that the key is not valid.</p>

<p>bitcoin-cli --regtest <strong>getdescriptorinfo</strong> "wpkh(vpub5UwuWtLWaprMvQBpnZeufhRAqYsgrYf7ZMxr6Kf7N41aa9M7UzZJ1e7HMwzdxGnfer5g2PaFgcvmNU7iRZAasNXz6EdDW6FGdcKf8m4oF7b/*)"</p>

<p>And there are plans to allow this import function?, I think so it's a very convenience feature.</p>

CC BY-SA 4.0
2020-06-11T22:34:48.707Z
I forgot to comment that the vpub is only an example in order to don't put a real xpub from a ledger nano.
decentralized.b
CC BY-SA 4.0
2020-06-11T23:05:37.510Z
It seems like you are asking two questions here. Can you clarify, exactly, what it is that you want to know?
Ava Chow
CC BY-SA 4.0
2020-06-12T08:34:37.043Z
Thank you @AndrewChow, the main question is why Bitcoin Core does not support importing extended public keys directly?. I was reading that is not possible but it is not clear for me the main reason why it is not possible.

And on another hand, it is possible, I would like to know if there are plans to made this possible in the near future, but the main question is the first one.
decentralized.b
CC BY-SA 4.0
2020-06-12T14:38:17.650Z
Why are you asking about `getdescriptorinfo`? How is that related?
Ava Chow
CC BY-SA 4.0
2020-06-12T18:01:19.267Z
This was because I was thinking (erroneously) that I could apply the process to import an xpub described in this answer (https://bitcoin.stackexchange.com/questions/88520/using-importmulti-with-internal-set-to-true-does-not-add-any-change-keys-what-a)

But this not works for extended public keys.
decentralized.b
<public-key><watch-only><wallet-import>
Why Bitcoin Core does not support importing extended public keys directly?
decentralized.b
# Why Bitcoin Core does not support importing extended public keys directly?

(Asked by: username_0 on 2020-06-11)

I'm trying to create a watch-only wallet importing the extended public key from a Ledger Nano (as an example) but is not to easy to do directly to my Node, I should do it through electrum personal server or something like that.
I was trying to find a clear (like 5 years old) explanation of what is the reason for that.
I was trying to do that in the mainnet and from the regtest following the next command in order to get the checksum but all the time a message said that the key is not valid.

bitcoin-cli --regtest **getdescriptorinfo** "wpkh(vpub5UwuWtLWaprMvQBpnZeufhRAqYsgrYf7ZMxr6Kf7N41aa9M7UzZJ1e7HMwzdxGnfer5g2PaFgcvmNU7iRZAasNXz6EdDW6FGdcKf8m4oF7b/\*)"

And there are plans to allow this import function?, I think so it's a very convenience feature.

**Tags:** public-key, watch-only, wallet-import

> **Comments:**
> **username_0**: I forgot to comment that the vpub is only an example in order to don't put a real xpub from a ledger nano.  
> **username_1**: It seems like you are asking two questions here. Can you clarify, exactly, what it is that you want to know?  
> **username_0**: Thank you @AndrewChow, the main question is why Bitcoin Core does not support importing extended public keys directly?. I was reading that is not possible but it is not clear for me the main reason why it is not possible.  And on another hand, it is possible, I would like to know if there are plans to made this possible in the near future, but the main question is the first one.  
> **username_1**: Why are you asking about `getdescriptorinfo`? How is that related?  
> **username_0**: This was because I was thinking (erroneously) that I could apply the process to import an xpub described in this answer (https://bitcoin.stackexchange.com/questions/88520/using-importmulti-with-internal-set-to-true-does-not-add-any-change-keys-what-a)  But this not works for extended public keys.  

---

## 1 answers

### Answer by username_1 on 2020-06-12. Score: 1

The structure of the Bitcoin Core wallet makes it difficult to implement importing extended public keys. This structure makes several assumptions about keys available in the keypool which xpubs do not meet. One such assumption is availability of private keys. While it isn't impossible to implement support for it, doing so is difficult to do, difficult to review, and is largely a hack on top of a hack.

Recently, native descriptor wallets was merged into Bitcoin Core so you will be able to import xpubs that are in a descriptor in 0.21. Native descriptor wallets took a long time to implement because of structural changes that had to be made to the wallet to even be able to support this.

> **Comments:**
> **username_0**: Thank you Andrew for answering so quickly. The last part from your answer is not to clear for me, my bad.  Does it mean that in the future version 0.21 from Bitcoin Core maybe it could be possible to import xpubs? Thanks!.  
> **username_1**: Yes. In 0.21 and later, you can create a descriptor wallet which allows you to import descriptors. Such descriptors can contain xpubs.  

---

