Пример #1
0
import click
from typing import (
    Any, )

from eth2deposit.key_handling.key_derivation.mnemonic import (
    get_languages,
    get_mnemonic,
)
from eth2deposit.utils.constants import WORD_LISTS_PATH

from .generate_keys import (
    generate_keys,
    generate_keys_arguments_decorator,
)

languages = get_languages(WORD_LISTS_PATH)


@click.command(
    help='Generate a new mnemonic and keys', )
@click.pass_context
@click.option(
    '--mnemonic_language',
    default='english',
    help='The language that your mnemonic is in.',
    prompt='Please choose your mnemonic language',
    type=click.Choice(languages, case_sensitive=False),
)
@generate_keys_arguments_decorator
def new_mnemonic(ctx: click.Context, mnemonic_language: str,
                 **kwargs: Any) -> None:
Пример #2
0
    verify_keystores,
)
from eth2deposit.key_handling.key_derivation.mnemonic import (
    get_languages,
    get_mnemonic,
)
from eth2deposit.utils.eth2_deposit_check import verify_deposit_data_json
from eth2deposit.utils.constants import (
    WORD_LISTS_PATH,
    MAX_DEPOSIT_AMOUNT,
    DEFAULT_VALIDATOR_KEYS_FOLDER_NAME,
)
from eth2deposit.utils.ascii_art import RHINO_0

words_path = os.path.join(os.getcwd(), WORD_LISTS_PATH)
languages = get_languages(words_path)


def generate_mnemonic(language: str, words_path: str) -> str:
    mnemonic = get_mnemonic(language=language, words_path=words_path)
    test_mnemonic = ''
    while mnemonic != test_mnemonic:
        click.clear()
        click.echo('This is your seed phrase. Write it down and store it safely, it is the ONLY way to retrieve your deposit.')  # noqa: E501
        click.echo('\n\n%s\n\n' % mnemonic)
        click.pause('Press any key when you have written down your mnemonic.')

        click.clear()
        test_mnemonic = click.prompt('Please type your mnemonic (separated by spaces) to confirm you have written it down\n\n')  # noqa: E501
        test_mnemonic = test_mnemonic.lower()
    click.clear()