Importing master keys on bitcoin core I want to use a mnemonic phrase and BIP 39 to store the keys, and use bitcoin-core, I understand that master private keys cannot be imported at least directly and that mnemonic phrase is not supported.

Also, I know that there is the idea of re-think the wallet format of bitcoin core to use descriptors, that support key derivation using BIP32.

My idea was to use importmulti to generate a basic usable wallet with some addresses generated from the master account key.

Using https://iancoleman.io/bip39/ , I've generated a seed and mnemonic:

rebel image use energy write boil throw okay claw
umbrella advice together clarify water actress


From there I can get the account extended private key (44'/1'/0'):

tprv8fvSBE7NPnC8FJfBwcptSmmgxhQZhsAbbzRWaLo9d9ystozdV7BFUbRHqvYgL18fnV3WfM4GZb2cLKbLq5H8qZqC9XDnq8Mep3RWXfRsZ7o

From there I can build some descriptors to build usable wallet:

External

deriveaddresses "combo(tprv8fvSBE7NPnC8FJfBwcptSmmgxhQZhsAbbzRWaLo9d9ystozdV7BFUbRHqvYgL18fnV3WfM4GZb2cLKbLq5H8qZqC9XDnq8Mep3RWXfRsZ7o/0h/*)#quvrmfad" 0
# =&gt; ["myeHNHuNnbk1aG4WcJNkWw6foM2G64AXGF", "myeHNHuNnbk1aG4WcJNkWw6foM2G64AXGF", "tb1qcm233e9h79ntuv4c5mhsvmfhe2umvm0hsgafsf", "2N56BvNBqmkTh1Jic4GbpXSYpbtTNHUdQFw"]


Internal

deriveaddresses "wpkh(tprv8fvSBE7NPnC8FJfBwcptSmmgxhQZhsAbbzRWaLo9d9ystozdV7BFUbRHqvYgL18fnV3WfM4GZb2cLKbLq5H8qZqC9XDnq8Mep3RWXfRsZ7o/1h/*)#6gdaynzv" 0
# =&gt; ["tb1q5vgxy6ntsugpdde9ryhst66cz8z4c8ztp4k7qv"]


To generate the wallet, I've created an empty wallet (as I don't want to depend on backups, just the mnemonic I generated earlier), and import some addresses with importmulti:

createwallet "mnemonic-test" false true
importmulti '[{"desc": "combo(tprv8fvSBE7NPnC8FJfBwcptSmmgxhQZhsAbbzRWaLo9d9ystozdV7BFUbRHqvYgL18fnV3WfM4GZb2cLKbLq5H8qZqC9XDnq8Mep3RWXfRsZ7o/0h/*)#quvrmfad", "range": 10, "timestamp": "now"}, {"desc": "wpkh(tprv8fvSBE7NPnC8FJfBwcptSmmgxhQZhsAbbzRWaLo9d9ystozdV7BFUbRHqvYgL18fnV3WfM4GZb2cLKbLq5H8qZqC9XDnq8Mep3RWXfRsZ7o/1h/*)#6gdaynzv", "range": 10, "internal": true, "timestamp": "now"}]' '{"rescan": false}'


It seems to work, all the generated addresses are generated, there is no HD seed enabled (so the addresses are always derived from the mnemonic seed).

The problems I found is that, those addresses, are never used by bitcoin-wallet, when trying to receive bitcoin it says it cannot generate an address (does not try to use one of the already generated addresses) and when spending it says it does not have any internal address available.

Do you know how to enable those coins?
You cannot import private keys to the keypool. This is currently not allowed because it is generally regarded as unsafe, at least with the way that the wallet works today. There is ongoing work to change this in the future.

You could do a split wallet setup where you have a watch only wallet with the pubkeys imported into the keypool and use that for address generation and transaction creation. Then you have a wallet with just the private keys imported and you use that for signing. But that's not what you want.

If you aren't tied to using a BIP 39 seed, you could generate a 256 bit seed and use sethdseed to set the HD seed of a wallet. That would do what you want, but BIP 39 uses 512 bit seeds and not 256, so it won't work there.



Imported addresses are never automatically used when you do getnewaddress. When you import them, you need to set keypool: "true" for each imported object for that to work.