ethereum / staking-deposit-cli

Secure key generation for deposits
Creative Commons Zero v1.0 Universal
531 stars 330 forks source link

i18n for Mnemonic #135

Open chrishobcroft opened 3 years ago

chrishobcroft commented 3 years ago

Related to https://github.com/prysmaticlabs/prysm-web-ui/issues/78

Overview

Currently, the eth2.0-deposit-cli enables a user to select on of the following 7 mnemonic languages: korean, chinese_traditional, spanish, italian, english, chinese_simplified, czech.

image

This issue aims to increase the language coverage, enabling broader inclusion by enabling users to select additional languages for their mnemonic. Without this, ETH 2.0 risks becoming less accessible for non-native speakers of the languages already

Coverage

We ought to aim to absolutely maximise language coverage, as it would appear likely that this cli might be reused for other "official" EF software, which might start to become used by end-user-facing clients integrating with ETH 2.0 - and as such, if there are pre-existing word libraries in as many languages as possible, this can help assist with language support throughout the stack.

See below for screenshot from Google Translate, showing which languages they offer for users to translate between:

image

wackerow commented 3 years ago

Are you suggesting expanding BIP39? Or adding additional language support to the website?

Your title suggests you want to expand the languages allowed for mnemonic selection... The languages above are the approved BIP39 languages, with official word lists of 2048 words each (https://github.com/bitcoin/bips/blob/master/bip-0039/bip-0039-wordlists.md), each list being very specific in what words are or are not included for security reasons. Adding additional languages I would assume would not be done from this level, but could potentially (doubt it will be easy) be done from the BIP repo in that link.

wackerow commented 3 years ago

(I did just notice, however, that Japanese and French, two approved BIP39 mnemonic languages, are not listed in the above screen shot... perhaps at least this could be addressed in this repo?)

chrishobcroft commented 3 years ago

Thank you @wackerow, yes, adding these 2 already-supported languages to the ETH 2.0 Deposit CLI would be a couple of steps in the right direction.

And I agree that the addition of languages could be addresses in the bitcoin repo... although I also wonder how many years it might take for changes to be accepted there.

wackerow commented 3 years ago

@chrishobcroft Right, and I feel like that is the point in my opinion... BIP moves slowly and securely. Those word list are very carefully selected to minimize errors when a human reproduces it. Repercussions of even one character being off is potentially losing all of your money, so this was done in a very careful way that the community has since vetted and agreed upon. I would argue it is not safe for the eth 2.0 deposit CLI to venture away from the approved BIP39 languages.

As far as for French and Japanese, does anyone here know why these are not listed? I'm new to the repo but could take a look, but not really a python guy

hwwhww commented 3 years ago

@chrishobcroft @wackerow thanks for the suggestions!

As far as for French and Japanese, does anyone here know why these are not listed?

I think the main reason was that we don't have trustworthy test vectors for French and Japanese. Our test vector was from Trezor: https://github.com/trezor/python-mnemonic/blob/master/vectors.json

/cc @CarlBeek

wackerow commented 3 years ago

@hwwhww Okay, am I missing something on that repo? I only see vectors for English, but not the other languages supported in eth2.0-deposit-cli. The README lists all but Czech for some reason, but does list Japanese and French. In fact, I even see logic around here: https://github.com/trezor/python-mnemonic/blob/ad06157e21fc2c2145c726efbfdcf69df1350061/mnemonic/mnemonic.py#L193 ...that properly handles the ideographic spaces used in Japanese text.

Didn't dive into exactly what is currently being tested on this end, but cloned this master branch and added the two additional language files, which did seem to work just fine when running ./deposit.sh, and no tests failed with python3 -m pytest .