Bitcoin Core still can't sign a message from a Segwit address. As far as I know, Electrum made-up their own "standard" for signing.
Well, I really don't know why the signatures of a Segwit addreses is not yet an Standard
I want to try to make an example of something curious, a signature that is valid for both address P2PKH (Legacy) and P2WPKH (Segwit)
I am going to use my staked address here:
address
bc1qjyhcjacmpc9pg8wes82lktyrjcwk4sdvqtm7ky
message
albert0bsd from bitcointalk.org 27 Sep, 2023
signature
KA55lRDVVcmNzydSdLsknjq2QS/CFW0utVGhtfmr3iirPW/zGoviBY7n7lE72nH81SV+D2a5syJpb2OZ/NUzdns=
The public key of that wallet is
02b96b69d11f50e029da620d879a1ddf0d759123b23364a5384cfd815fbb183e79
The RMD160 Hash for that public key is 912f89771b0e0a141dd981d5fb2c83961d6ac1ac
So in this page we can calculate the address
https://learnmeabitcoin.com/technical/script/p2pkh/The P2PKH address for that public key 1EEfvk3usipJwrvekE12cESXWDrCZWgv3S
You also can calculate the Segwit address on this page:
https://learnmeabitcoin.com/technical/script/p2wpkh/Now the signatures, if you make a signature that is valid for Legacy addresses ( Compressed P2PKH)
-----BEGIN BITCOIN SIGNED MESSAGE-----
albert0bsd from bitcointalk.org December 2, 2024
-----BEGIN BITCOIN SIGNATURE-----
1EEfvk3usipJwrvekE12cESXWDrCZWgv3S
IAyi+i9eayGP1PTxgd6HI9FNjbPswZRwxn87fe6tSuyYbrPmkW/qirDEYGN4NlzpP+8SI2xrL7YINzmQvaeKEGU=
-----END BITCOIN SIGNATURE-----
Now please look a at the signature
IAyi+i9eayGP1PTxgd6HI9FNjbPswZRwxn87fe6tSuyYbrPmkW/qirDEYGN4NlzpP+8SI2xrL7YINzmQvaeKEGU=
If you replace the address with the Segwit : bc1qjyhcjacmpc9pg8wes82lktyrjcwk4sdvqtm7ky
The same signature data is also valid for the segwith P2WPKH address:
Check by yourself:
address
bc1qjyhcjacmpc9pg8wes82lktyrjcwk4sdvqtm7ky
message
albert0bsd from bitcointalk.org December 2, 2024
signature
IAyi+i9eayGP1PTxgd6HI9FNjbPswZRwxn87fe6tSuyYbrPmkW/qirDEYGN4NlzpP+8SI2xrL7YINzmQvaeKEGU=
Obvious because both address are generated from the same public key.
This usually don't happen in the other way, because the Electrum standard use another encode byte that is not compatible for the Legacy Signature Chekers