How to do this in 2024? I'm using BC 26.0.0 and the console window gives this error that only legacy wallets are supported by this command.
walletpassphrase(…)
null
dumpwallet Test
Only legacy wallets are supported by this command (code -4)
And no indication is given as to how to do it for "newer" or non-legacy wallets. So in addition to backing up wallet.dat, how do I export the private keys?
Legacy refer to wallets based on key-based architecture. As to BC 26.0.0 it creates wallets the skeleton of which is descriptor based. That is why you got that "code -4 " message when run dumpwallet comand/ To get list of private keys run
listdescriptors true
[url=https://bitcoincore.org/en/doc/26.0.0/rpc/wallet/listdescriptors/]where [/url]true is boolean value for ( private ) argument of this function
Setting "true" is mandatory value for ( private ) argument as on default it equals to "false" which results in descriptor for public keys rather than private one.