-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatic fix of non-base58check characters #7520
Conversation
Non-technical people in Bitcoin may not know that their private key isn't accepted due to mistyping an 'o' for an 'O' or a zero. So I propose to automatically replace those characters like here or alternatively display an error message that explains it (however I don't have enough QT experience to implement it; this is more of a PoC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel raising an error would be a better option as there will be many more combinations that might occur here for replacing the letters.
@@ -1010,7 +1012,7 @@ def get_private_keys(text, *, allow_spaces_inside_key=True, raise_on_error=False | |||
|
|||
|
|||
def is_private_key_list(text, *, allow_spaces_inside_key=True, raise_on_error=False): | |||
return bool(get_private_keys(text, | |||
return bool(get_private_keys(text.replace('O', 'o').replace('0', 'o').replace('I', 'i').replace('l', 'i'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need for text.replace('O', 'o').replace('0', 'o').replace('I', 'i').replace('l', 'i')
as you are already doing the same process in get_private_keys
What do you mean, more combinations might occur? And error would be fine as well, sure, I just didn't want to get into GUI coding to propose such a change to be honest ;) But I feel this issue really needs to be addressed, if not only to decrease the risk of people going to fake 'seed recovery services' maybe thinking something's wrong with their keys and stuff... Another easy fix would be to have a static message above the seed word dialogue, explaining 'there are no capital O's and zeroes in a private key.' (and the same for I / i / l...) |
|
So the use case is that some people might have WIF keys on paper and they might manually type them and make a typo? Are there other programs/services that do either? I strongly think we should not do (1).
I guess if we really wanted to, we could do something like (2), e.g. highlight non-base58 characters in the GUI or show an error dialog to the user explaining this, or something of that sort; but that assumes you can reliably tell what the user entered is supposed to be in base58 (only they mistyped some chars) (as opposed to the user-input being in a completely different encoding), which might severely limit the UI and in some cases already (and maybe more in the future) is not true. In particular, consider a generic input box that accepts keys in a number of encodings (not just base58). Frankly I don't think the motivation/usecase is strong enough to justify action. |
Non-technical people in Bitcoin may not know that their private key isn't accepted due to mistyping an 'o' for an 'O' or a zero. So I propose to automatically replace those characters like here or alternatively display an error message that explains it (however I don't have enough QT experience to implement it; this is more of a PoC.