Maybe I don't understand something! Let's say, if I have the latest version of Bitcoin Core and I have a compressed WIF... How can I add a legacy uncompressed address for this WIF key through the console?
You can't with that WIF private key.
WIF with compressed flag byte (
starts with 'L' or 'K') will generate its compressed public key pair; thus, compressed legacy address.
If you want to derive the uncompressed legacy address, use its WIF without that flag (
starts with '5').
To import using the console (
testnet):
Compute the checksum:
getdescriptorinfo "pkh(91dKmbXPRSVp8vemQPWecCFT1esvSeDHYgpoPexzeTkCuowEeM3)"
get the checksum in the result: "
zzpvlmvx"
To import:
importdescriptors "[{\"desc\": \"pkh(91dKmbXPRSVp8vemQPWecCFT1esvSeDHYgpoPexzeTkCuowEeM3)#zzpvlmvx\",\"label\": \"your_label\",\"timestamp\": \"now\"}]"
Timestamp "
now" will prevent the client from rescanning once its imported to the wallet, use a specific unix time value or 0 if you want it to rescan.
And if you're expecting P2PK outputs:
getdescriptorinfo "pk(91dKmbXPRSVp8vemQPWecCFT1esvSeDHYgpoPexzeTkCuowEeM3)"
Checksum: "
pxrrw3he"
To import:
importdescriptors "[{\"desc\": \"pk(91dKmbXPRSVp8vemQPWecCFT1esvSeDHYgpoPexzeTkCuowEeM3)#pxrrw3he\",\"label\": \"your_label\",\"timestamp\": 0}]"