When you attempt to recover your wallet and you type in the private key, when you get to the part where there is an lowercase "o", you might think it's an uppercase "O" or the number "0" because you wrote it down in a weird way.
May I propose an idea? Why not allowing 0 and O, but counting them as o? Same thing for I and l; counting both as i. You could avoid searching what you've written wrong this way.
I just checked
the wiki again and it turns out that lowercase i and lowercase o are indeed part of the alphabet. I thought they were omitted as well for some reason.
From the software perspective, I think that's a great idea: since 0 and O don't exist, they can be remapped to lowercase o automatically, otherwise indeed a user needs to know that these are not part of the alphabet.
In Electrum,
this function, or actually the lambda expression in the first line of it, checks if the input is valid.
The functions
is_address_list and
is_private_key_list specify what is classified as valid and what isn't, so I added some code that replaces the keys there and also where they're saved. I don't have enough knowledge about the Electrum codebase, but as a PoC it seems to work and I submitted a
pull request.
Neat idea, but it's a bit difficult to implement on few window such as window on below image. The reasons are,
1. You need to know whether user entering private key or address.
2. Bech32 uses different set of character.
I am certainly not in a position to propose to Electrum developers what should be included and how because I don't have the underlying skills or knowledge to do so. But I do believe that it can be done.
The software knows whether you are entering an address or a private key already. It doesn't happen that someone imports a private key and the software recovers a watch-only wallet like if you imported an address. Probably based on the length, checksums, and whatnot. Once it recognizes that the imported/entered string is a private key, the new feature could check if the entered string contains characters that don't belong there, such as "O" or "0". If discovered, a notification would inform the user of the non-allowed characters. With that, it would be easier to recognize mistakes if you know you entered a "0", for example, and you shouldn't have.
The logic how it decides between address list or private key list is very trivial: it checks first that it's not a list of addresses (
link) and if not, it checks if it's a list of private keys.
My proposal just replaces the characters which are out of the alphabet with the ones that are (0 => o, O => o, I => i, l => i).