importaddress failed, Only legacy wallets are supported by this command. #29772

issue ray2cycle openend this issue on March 31, 2024
  1. ray2cycle commented at 6:21 am on March 31, 2024: none

    Is there an existing issue for this?

    • I have searched the existing issues

    Current behaviour

    I want to import the address or public key into bitcoind because I want to list the unspent utxo based on my bitcoind node and then assemble the transaction on the client side. However, an error will be reported when importing the address and public key.

    Error:

    0error code: -4
    1error message:
    2Only legacy wallets are supported by this command
    

    Expected behaviour

    success and list unspent utxo success.

    Steps to reproduce

    bitcoin-cli importaddress mk4xz7tbbQDcQY68qYehydV9PRBWdVGNw1 "ray"

    0error code: -4
    1error message:
    2Only legacy wallets are supported by this command
    

    bitcoin-cli importpubkey 03f3de8f736a0bff7dfe446138acf98c23199c0710c704416dc9b6338bf37900e9 "ray_pub" true

    0error code: -4
    1error message:
    2Only legacy wallets are supported by this command
    

    bitcoind start cmd: bitcoind -blocksonly=false -wallet=ray -addresstype=legacy

    Relevant log output

    No response

    How did you obtain Bitcoin Core

    Pre-built binaries

    What version of Bitcoin Core are you using?

    Bitcoin Core version v25.0.0

    Operating system and version

    Ubuntu 22.04.3 LTS

    Machine specifications

    No response

  2. 1440000bytes commented at 7:45 am on March 31, 2024: none

    This should work for a descriptor wallet with disable_private_keys=true:

    0$ bitcoin-cli importdescriptors '[{ "desc": "addr(mk4xz7tbbQDcQY68qYehydV9PRBWdVGNw1)#CHECKSUM", "timestamp":"now", "label": "ray"}]'
    

    You will get the CHECKSUM with getdescriptorinfo "addr(mk4xz7tbbQDcQY68qYehydV9PRBWdVGNw1)"

  3. maflcko added the label RPC/REST/ZMQ on Apr 1, 2024
  4. maflcko added the label Questions and Help on Apr 1, 2024
  5. maflcko commented at 2:04 pm on April 1, 2024: member
    I guess the error message could be adjusted to say that the RPC has been replaced by another one for descriptor wallets.
  6. laanwj commented at 7:20 pm on May 2, 2024: member
    Yes, adding an example would be useful.
  7. RichardGantz commented at 12:41 pm on June 12, 2024: none

    I have a bitcoincore v27.0.0 running on a “Raspberry Pi OS with desktop, Release date: March 15th 2024.System: 64-bit,Kernel version: 6.6, Debian version: 12 (bookworm)” over the tor network, which is fully synchronized.

    I installed a “Electrum Personal Server v0.2.4, but it does not start because of this same JsonRpcError (“code = -4; message = “Only legacy wallets are supported by this command”). Up to this point I tried several zpubs and addresses, but they were all native segwit P2WPKH.

    Then I created a ‘Base58 (legacy)’ address within gthe “Receive” tab of the bitcoincore default wallet, i created and this address begins with a 1 and therefore is really a legacy address, right?

    The JsonRpcError which interrupts the startup of the EPS then changed to:

    {'code': -5, 'message': 'Invalid or unsupported Segwit (Bech32) or Base58 encoding.'}

    Is there a legacy address you have that would be accepted by bitcoincore when given via JsonRpc?

  8. sipa commented at 12:49 pm on June 12, 2024: member

    The terminology is confusing, but “legacy wallets” and “legacy addresses” have nothing to do with one another:

    • legacy wallets are wallet.dat files using the BDB format, and are opposed to sqlite-based wallet files (“descriptor wallets”). Legacy wallet support is being deprecated.
    • legacy addresses are P2PKH and P2SH addresses, and are opposed to more modern address types like P2WPKH and P2TR.

    What you’ve done is created a legacy address in a descriptor wallet (which is supported). The issue is that descriptor wallet do not support the importaddress RPC (though that may change, see #30175). The solution (for now) is to create a legacy wallet in Bitcoin Core instead of a descriptor wallet, and let EPS use that. Longer term, I assume EPS will have to be adapted to use the descriptor wallet RPCs (like importdescriptor).

  9. RichardGantz commented at 6:50 am on June 13, 2024: none

    Dear sipa,

    thank you so much for your quick and crystal clear answer. The EPS started up successfully after I created the legacy wallet.

    Please allow me to add for newbees like me that

    1. I had to stop bitcoin-core and start it once with the additional parameter -deprecatedrpc=create_bdb.
    2. After that started up I was able to create the legacy wallet with the following command in the console window: createwallet "LegacyWallet" false false "" false false.

    Shutdown of bitcoin-core and restart without the additional parameter still could open the “LegacyWallet” with the hint that these kinds of wallets will not be supported one day in the near future.

    But EPS could import all zpubs and seqwit addresses and started up successful.

    THANK YOU VERY MUCH!

  10. bitcoin deleted a comment on Jun 30, 2024
  11. maflcko commented at 7:18 pm on July 2, 2024: member
    Not sure what to do here, other than possibly adjusting the error message #29772 (comment) or closing this as a duplicate of https://github.com/bitcoin/bitcoin/issues/30175
  12. maflcko removed the label Questions and Help on Jul 2, 2024
  13. maflcko added the label Wallet on Jul 2, 2024

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-09-28 22:12 UTC

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