First I call:

curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "createwallet", "params":["ColdWallet", true] }' -H 'content-type: text/plain;' http://user:password@

Which returns:

result = {
    name = ColdWallet;
    warning = "";

I then import keys to the keypool:

bitcoin-cli getdescriptorinfo "wpkh(tpubDFLL8VNUhpLNVLw8179WCEuMZtKtTDd7EeYeFDtThzisj6wfJ4Zi43qUvCE7ciCFxVKZYssRr9P9PerLefkVEjKL6CphUvbGv1CrSCS2KUB/*)"

responseString = {

  "descriptor": "wpkh(tpubDFLL8VNUhpLNVLw8179WCEuMZtKtTDd7EeYeFDtThzisj6wfJ4Zi43qUvCE7ciCFxVKZYssRr9P9PerLefkVEjKL6CphUvbGv1CrSCS2KUB/*)#udrnh6f5",
  "isrange": true,
  "issolvable": true,
  "hasprivatekeys": false


bitcoin-cli -rpcwallet=ColdWallet importmulti '[{ "desc": "wpkh(tpubDFLL8VNUhpLNVLw8179WCEuMZtKtTDd7EeYeFDtThzisj6wfJ4Zi43qUvCE7ciCFxVKZYssRr9P9PerLefkVEjKL6CphUvbGv1CrSCS2KUB/*)#udrnh6f5", "timestamp": "now", "range": [0, 99], "watchonly": true, "label": "Fully Noded Cold Storage", "keypool": true, "internal": false, "rescan": false }]'

result = (
        success = 1;

I then set keypool to false and internal to true:

bitcoin-cli -rpcwallet=ColdWallet importmulti '[{ "desc": "wpkh(tpubDFLL8VNUhpLNVLw8179WCEuMZtKtTDd7EeYeFDtThzisj6wfJ4Zi43qUvCE7ciCFxVKZYssRr9P9PerLefkVEjKL6CphUvbGv1CrSCS2KUB/*)#udrnh6f5", "timestamp": "now", "range": [100, 199], "watchonly": true, "keypool": false, "internal": true, "rescan": false }]'

result = (
        success = 1;

I can use getnewaddress -rpcwallet=ColdWallet without issue but if I try:

curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "walletcreatefundedpsbt", "params":[[],[{"mxV3ojsAHKuYHoDVqYczs6iPAfCCYESEDc":0.0001}]] }' -H 'content-type: text/plain;' http://user:password@

result = {

    error =     {
        code = "-4";
        message = "Can't generate a change-address key. No keys in the internal keypool and can't generate any keys.";
    id = curltest;
    result = "<null>";


Furthermore calling bitcoin-cli rpcwallet=ColdWallet getwalletinfo


  "walletname": "ColdWallet",
  "walletversion": 169900,
  "balance": 0.00000000,
  "unconfirmed_balance": 0.00000000,
  "immature_balance": 0.00000000,
  "txcount": 1,
  "keypoololdest": 1561077339,
  "keypoolsize": 98,
  "keypoolsize_hd_internal": 0,
  "paytxfee": 0.00000000,
  "private_keys_enabled": false

Is this a bug? Or am I doing something wrong?

I am using Bitcoin Core as a back end for an app I am developing and want the user to easily be able to create cold transactions using the keys they import into the wallet without having to specify a change address every time.


I then set keypool to false and internal to true:

This is what you are doing wrong.

Bitcoin Core has a separate change keypool. By not setting keypool to true, the imported pubkeys won't be added to the change keypool.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.