I can't create the private key of a legacy address on bitcoin core. When I do the command it writes me that it can only be done to legacy addresses. And my address is legacy. What should I do. Thank you
1 Answer
I believe you're confusing legacy addresses with legacy wallets. They're distinct and unrelated things.
- Legacy addresses are pre-segwit addresses (P2PKH most commonly), and are contrasted with segwit and taproot addresses.
- Legacy wallets are wallet files in the BDB file format, created by old versions of Bitcoin Core (and can still be opened by new versions, for now). They're contrasted with descriptor wallets, which use the SQLite file format, which are created by newer versions of Bitcoin Core.
You can create legacy addresses using descriptor wallets, and you can create segwit (but not taproot) addresses using legacy wallets.
What I suspect is going on here is that you're trying to perform the dumpprivkey
on a legacy address in a descriptor wallet. And that doesn't work, because dumpprivkey
only works on legacy wallets (regardless of address type). Exporting private key is dangerous, and especially so for descriptor wallets (where an attacker can typically compute all your private keys from just one). If you must, you can export the private master key using listdescriptors
, though I suspect this will not be what you want.
To help you find an alternative, I encourage you to amend your answer to explain exactly what you're trying to achieve (or point out if my interpretation of events is incorrect). Perhaps a solution exists that doesn't involve exporting private keys, as that is generally a bad idea unless you really know what you are doing.