Cannot generate change address on descriptor wallets. #20831

issue willweatherman openend this issue on January 2, 2021
  1. willweatherman commented at 4:41 pm on January 2, 2021: none

    I am trying to create an unsigned transaction in a wallet that contains a 3 of 7 public key descriptor.

    Expected behavior

    To be able to send half a UTXO and bitcoin core to handle the change address generation

    Actual behavior

    Instead, I get this error on clicking “create unsigned”. “Transaction needs a change address, but we can’t generate it. Please call keypoolrefill first.”

    To reproduce

    To create descriptor

    1. Create a standard wallet using bitcoin core
    2. Run “getnewaddress” to generate an address
    3. Run “dumpprivkey” using the address previously generated to get a WIF key
    4. XOR the WIF key with 256 “1"s to create a unique key(not to add security or randomness)
    5. Create a new standard wallet and run “sethdseed” with the modified WIF key
    6. Dump the second wallet to get the xpriv
    7. Repeat steps 2-5 to generate 7 xprivs
    8. Using the xprivs create the 3 of 7 descriptor example below wsh(multi(3,‘xpriv1’/,‘xpriv2’/,‘xpriv3’/,‘xpriv4’/,‘xpriv5’/,‘xpriv6’/,‘xpriv7’/*)) Remove ’ from the above string.
    9. In the first wallet Run “getdescriptorinfo” to both generate the checksum for the xpriv descriptor and the xpub descriptor itself

    To reproduce error

    1. Create a descriptor wallet with disabled private keys
    2. Import the public key descriptor with “importdescriptors” example bellow importdescriptors ‘[{ “desc”:“wsh(multi(3,‘xpriv1’/,‘xpriv2’/,‘xpriv3’/,‘xpriv4’/,‘xpriv5’/,‘xpriv6’/,‘xpriv7’/*))#‘checksum’”, “timestamp”: “now”, “active”: true}]’ Remove ’ from the above string.
    3. Click “Create new receiving address” in the bitcoin core UI
    4. Send a small amount to the address
    5. In the Send tab enter a recipient and then attempt to send half of the original amount sent to the address.
    6. You should get an error “Transaction needs a change address, but we can’t generate it. Please call keypoolrefill first.”

    System info I am using ubuntu 20 with bitcoin core 0.21.0 rc3

  2. willweatherman added the label Bug on Jan 2, 2021
  3. achow101 commented at 6:09 pm on January 2, 2021: member
    You have only imported a descriptor for receiving address use. You must import another one for change address use. Otherwise there is no way for the wallet to generate change addresses.
  4. MarcoFalke removed the label Bug on Jan 2, 2021
  5. MarcoFalke added the label Questions and Help on Jan 2, 2021
  6. MarcoFalke added the label Wallet on Jan 2, 2021
  7. willweatherman commented at 7:07 pm on January 2, 2021: none
    How would you specify which one is for generating change addresses?
  8. achow101 commented at 8:23 pm on January 2, 2021: member
    Include "internal": true in your import to specify that that descriptor is for change addresses only.
  9. willweatherman commented at 3:57 pm on January 3, 2021: none
    Awesome, that works thanks.
  10. willweatherman closed this on Jan 3, 2021

  11. willweatherman commented at 5:06 pm on January 3, 2021: none

    Hi, I noticed that by running this command to allow the creation of receiving addresses. importdescriptors ‘[{ “desc”: “wsh(multi(3,xpub661MyMwAqRbcF13nMmebEmEzQvNH6ZC65QMi6wvmTAvbu957VAWpt2SM7wQiLd5NVudfUpvzpeXNfT5AjhWbbuSKpJ2cssPiPM2tCeZMy7T/,xpub661MyMwAqRbcEbwCpKydkE7KTa2EeMNtZtvSQ8BS1UK2jxVpb9767T5hyBxt67Wa2vev7defUorAFxVvNuSsrMJA34pSDAqj7MYig32Yn12/,xpub661MyMwAqRbcEnmMnN5ish1Z7tPBfPDKp4wdKhSj6j4UDhiK5bzU6qjE5KnQKw6cQLKg6AhwnPvGmw7A7gsgZqvkEQZDmDqgPUutccd74Wh/,xpub661MyMwAqRbcEydQM8Y6dCRKkpFszd8xeCFTqiwSUZW7MQ5f249yjRuD8EV43gtkNNxHCDgDmZwy2oVDuAY9pV6sWdBbeU2FuoWGtkERFhV/,xpub661MyMwAqRbcGNZ4VG1dRWTN2qcsQhz5w4McN9KRXrAECe4toPr44jEtskvCjizC63xM3QnSXyfraFgLqb14ExZUP4QQxnSejCngFjQ8sZz/,xpub661MyMwAqRbcGHtzSBVBkk166iS6XQgYQnrgu2CHAFL5znv1byy5e4ZjCmZ3ZhugmUx3x91kC5xjyYAQCvtoJXheTyUSQ23y8RWDhH6wbs2/,xpub661MyMwAqRbcGUuSCPhxc7NDC6Zh4fhecozKEiR7QK7APCVt9Yhyx2NMUd4wrTHYP91G4Fh6Jp9P5Aipf8FjDsrSutkLj3Lie5bCrrM2CfT/*))#9hky7ctt”, “timestamp”: “now”, “active”: true}]’

    And then running this command to allow bitcoin core to generate change addresses from the same descriptor. importdescriptors ‘[{ “desc”: “wsh(multi(3,xpub661MyMwAqRbcF13nMmebEmEzQvNH6ZC65QMi6wvmTAvbu957VAWpt2SM7wQiLd5NVudfUpvzpeXNfT5AjhWbbuSKpJ2cssPiPM2tCeZMy7T/,xpub661MyMwAqRbcEbwCpKydkE7KTa2EeMNtZtvSQ8BS1UK2jxVpb9767T5hyBxt67Wa2vev7defUorAFxVvNuSsrMJA34pSDAqj7MYig32Yn12/,xpub661MyMwAqRbcEnmMnN5ish1Z7tPBfPDKp4wdKhSj6j4UDhiK5bzU6qjE5KnQKw6cQLKg6AhwnPvGmw7A7gsgZqvkEQZDmDqgPUutccd74Wh/,xpub661MyMwAqRbcEydQM8Y6dCRKkpFszd8xeCFTqiwSUZW7MQ5f249yjRuD8EV43gtkNNxHCDgDmZwy2oVDuAY9pV6sWdBbeU2FuoWGtkERFhV/,xpub661MyMwAqRbcGNZ4VG1dRWTN2qcsQhz5w4McN9KRXrAECe4toPr44jEtskvCjizC63xM3QnSXyfraFgLqb14ExZUP4QQxnSejCngFjQ8sZz/,xpub661MyMwAqRbcGHtzSBVBkk166iS6XQgYQnrgu2CHAFL5znv1byy5e4ZjCmZ3ZhugmUx3x91kC5xjyYAQCvtoJXheTyUSQ23y8RWDhH6wbs2/,xpub661MyMwAqRbcGUuSCPhxc7NDC6Zh4fhecozKEiR7QK7APCVt9Yhyx2NMUd4wrTHYP91G4Fh6Jp9P5Aipf8FjDsrSutkLj3Lie5bCrrM2CfT/*))#9hky7ctt”, “timestamp”: “now”, “active”: true, “internal”: true}]’

    It will override the first command and disable the creation of external addresses. The whole point of having a descriptor wallet is a single descriptor that will handle everything as if it were an actual wallet. Is this a bug or was it done on purpose?

    Thanks- Will.

  12. willweatherman reopened this on Jan 3, 2021

  13. achow101 commented at 5:53 pm on January 3, 2021: member

    The whole point of having a descriptor wallet is a single descriptor that will handle everything as if it were an actual wallet

    No. The whole point of descriptor wallets is to have a descriptors handle everything in a wallet.

    A single descriptor cannot be used for both receiving and change addresses. This is intentional.

  14. willweatherman commented at 6:12 pm on January 3, 2021: none
    Ok, thank you.
  15. willweatherman closed this on Jan 3, 2021

  16. DrahtBot locked this on Aug 16, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-10-06 16:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me