ethstaker-deposit 1.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ethstaker_deposit-1.3.1/LICENSE +116 -0
- ethstaker_deposit-1.3.1/PKG-INFO +85 -0
- ethstaker_deposit-1.3.1/README.md +49 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/VERSION +1 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/__init__.py +4 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/__main__.py +4 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/bls_to_execution_change_keystore.py +72 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/cli/__init__.py +0 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/cli/builder.py +171 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/cli/existing_mnemonic.py +126 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/cli/exit_transaction_keystore.py +123 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/cli/exit_transaction_mnemonic.py +164 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/cli/generate_bls_to_execution_change.py +189 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/cli/generate_bls_to_execution_change_keystore.py +140 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/cli/generate_builder_keys.py +185 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/cli/generate_keys.py +205 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/cli/generate_mnemonic.py +95 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/cli/new_mnemonic.py +82 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/cli/partial_deposit.py +205 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/cli/test_keystore.py +63 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/credentials.py +495 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/deposit.py +131 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/exceptions.py +9 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/intl/__init__.py +0 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/key_handling/__init__.py +0 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/key_handling/key_derivation/__init__.py +0 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/key_handling/key_derivation/mnemonic.py +170 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/key_handling/key_derivation/path.py +34 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/key_handling/key_derivation/tree.py +84 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/key_handling/keystore.py +230 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/schema/keystore.py +157 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/settings.py +122 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/utils/__init__.py +0 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/utils/ascii_art.py +49 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/utils/click.py +296 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/utils/config.py +7 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/utils/constants.py +84 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/utils/crypto.py +55 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/utils/exit_transaction.py +60 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/utils/export_data.py +22 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/utils/file_handling.py +24 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/utils/intl.py +135 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/utils/ssz.py +212 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/utils/symlink.py +35 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/utils/terminal.py +42 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit/utils/validation.py +764 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit.egg-info/PKG-INFO +85 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit.egg-info/SOURCES.txt +106 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit.egg-info/dependency_links.txt +1 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit.egg-info/requires.txt +31 -0
- ethstaker_deposit-1.3.1/ethstaker_deposit.egg-info/top_level.txt +7 -0
- ethstaker_deposit-1.3.1/pyproject.toml +69 -0
- ethstaker_deposit-1.3.1/scripts/check_dependencies_sync.py +149 -0
- ethstaker_deposit-1.3.1/scripts/check_python_version.py +67 -0
- ethstaker_deposit-1.3.1/scripts/check_translations.py +272 -0
- ethstaker_deposit-1.3.1/scripts/complete_translations.py +55 -0
- ethstaker_deposit-1.3.1/setup.cfg +4 -0
- ethstaker_deposit-1.3.1/tests/__init__.py +0 -0
- ethstaker_deposit-1.3.1/tests/conftest.py +38 -0
- ethstaker_deposit-1.3.1/tests/shared_helpers.py +110 -0
- ethstaker_deposit-1.3.1/tests/test_check_translations.py +197 -0
- ethstaker_deposit-1.3.1/tests/test_cli/__init__.py +0 -0
- ethstaker_deposit-1.3.1/tests/test_cli/helpers.py +49 -0
- ethstaker_deposit-1.3.1/tests/test_cli/test_builder.py +496 -0
- ethstaker_deposit-1.3.1/tests/test_cli/test_existing_mnemonic.py +584 -0
- ethstaker_deposit-1.3.1/tests/test_cli/test_exit_transaction_keystore.py +366 -0
- ethstaker_deposit-1.3.1/tests/test_cli/test_exit_transaction_mnemonic.py +146 -0
- ethstaker_deposit-1.3.1/tests/test_cli/test_generate_bls_to_execution_change.py +202 -0
- ethstaker_deposit-1.3.1/tests/test_cli/test_generate_bls_to_execution_change_keystore.py +401 -0
- ethstaker_deposit-1.3.1/tests/test_cli/test_generate_mnemonic.py +101 -0
- ethstaker_deposit-1.3.1/tests/test_cli/test_new_mnemonic.py +1102 -0
- ethstaker_deposit-1.3.1/tests/test_cli/test_partial_deposit.py +548 -0
- ethstaker_deposit-1.3.1/tests/test_cli/test_regeneration.py +109 -0
- ethstaker_deposit-1.3.1/tests/test_cli/test_test_keystore.py +65 -0
- ethstaker_deposit-1.3.1/tests/test_credentials.py +364 -0
- ethstaker_deposit-1.3.1/tests/test_deposit.py +204 -0
- ethstaker_deposit-1.3.1/tests/test_integration/__init__.py +0 -0
- ethstaker_deposit-1.3.1/tests/test_integration/helpers.py +45 -0
- ethstaker_deposit-1.3.1/tests/test_integration/interactive.py +158 -0
- ethstaker_deposit-1.3.1/tests/test_integration/test_builder.py +132 -0
- ethstaker_deposit-1.3.1/tests/test_integration/test_existing_mnemonic.py +105 -0
- ethstaker_deposit-1.3.1/tests/test_integration/test_exit_transaction_keystore.py +110 -0
- ethstaker_deposit-1.3.1/tests/test_integration/test_exit_transaction_mnemonic.py +40 -0
- ethstaker_deposit-1.3.1/tests/test_integration/test_full_workflow.py +125 -0
- ethstaker_deposit-1.3.1/tests/test_integration/test_generate_bls_to_execution_change.py +77 -0
- ethstaker_deposit-1.3.1/tests/test_integration/test_generate_bls_to_execution_change_keystore.py +57 -0
- ethstaker_deposit-1.3.1/tests/test_integration/test_generate_mnemonic.py +28 -0
- ethstaker_deposit-1.3.1/tests/test_integration/test_helpers.py +22 -0
- ethstaker_deposit-1.3.1/tests/test_integration/test_new_mnemonic.py +72 -0
- ethstaker_deposit-1.3.1/tests/test_integration/test_partial_deposit.py +71 -0
- ethstaker_deposit-1.3.1/tests/test_integration/test_regeneration.py +85 -0
- ethstaker_deposit-1.3.1/tests/test_integration/test_test_keystore.py +76 -0
- ethstaker_deposit-1.3.1/tests/test_intl/test_json_schema.py +42 -0
- ethstaker_deposit-1.3.1/tests/test_key_handling/__init__.py +0 -0
- ethstaker_deposit-1.3.1/tests/test_key_handling/test_key_derivation/__init__.py +0 -0
- ethstaker_deposit-1.3.1/tests/test_key_handling/test_key_derivation/test_mnemonic.py +119 -0
- ethstaker_deposit-1.3.1/tests/test_key_handling/test_key_derivation/test_path.py +95 -0
- ethstaker_deposit-1.3.1/tests/test_key_handling/test_key_derivation/test_tree.py +77 -0
- ethstaker_deposit-1.3.1/tests/test_key_handling/test_keystore.py +241 -0
- ethstaker_deposit-1.3.1/tests/test_utils/test_click_chain.py +134 -0
- ethstaker_deposit-1.3.1/tests/test_utils/test_constants.py +14 -0
- ethstaker_deposit-1.3.1/tests/test_utils/test_crypto.py +107 -0
- ethstaker_deposit-1.3.1/tests/test_utils/test_intl.py +105 -0
- ethstaker_deposit-1.3.1/tests/test_utils/test_python_version.py +28 -0
- ethstaker_deposit-1.3.1/tests/test_utils/test_ssz.py +78 -0
- ethstaker_deposit-1.3.1/tests/test_utils/test_symlink.py +43 -0
- ethstaker_deposit-1.3.1/tests/test_utils/test_validation.py +549 -0
- ethstaker_deposit-1.3.1/tests/test_utils/test_validation_bls_to_execution_change.py +104 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
CC0 1.0 Universal
|
|
2
|
+
|
|
3
|
+
Statement of Purpose
|
|
4
|
+
|
|
5
|
+
The laws of most jurisdictions throughout the world automatically confer
|
|
6
|
+
exclusive Copyright and Related Rights (defined below) upon the creator and
|
|
7
|
+
subsequent owner(s) (each and all, an "owner") of an original work of
|
|
8
|
+
authorship and/or a database (each, a "Work").
|
|
9
|
+
|
|
10
|
+
Certain owners wish to permanently relinquish those rights to a Work for the
|
|
11
|
+
purpose of contributing to a commons of creative, cultural and scientific
|
|
12
|
+
works ("Commons") that the public can reliably and without fear of later
|
|
13
|
+
claims of infringement build upon, modify, incorporate in other works, reuse
|
|
14
|
+
and redistribute as freely as possible in any form whatsoever and for any
|
|
15
|
+
purposes, including without limitation commercial purposes. These owners may
|
|
16
|
+
contribute to the Commons to promote the ideal of a free culture and the
|
|
17
|
+
further production of creative, cultural and scientific works, or to gain
|
|
18
|
+
reputation or greater distribution for their Work in part through the use and
|
|
19
|
+
efforts of others.
|
|
20
|
+
|
|
21
|
+
For these and/or other purposes and motivations, and without any expectation
|
|
22
|
+
of additional consideration or compensation, the person associating CC0 with a
|
|
23
|
+
Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
|
|
24
|
+
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
|
|
25
|
+
and publicly distribute the Work under its terms, with knowledge of his or her
|
|
26
|
+
Copyright and Related Rights in the Work and the meaning and intended legal
|
|
27
|
+
effect of CC0 on those rights.
|
|
28
|
+
|
|
29
|
+
1. Copyright and Related Rights. A Work made available under CC0 may be
|
|
30
|
+
protected by copyright and related or neighboring rights ("Copyright and
|
|
31
|
+
Related Rights"). Copyright and Related Rights include, but are not limited
|
|
32
|
+
to, the following:
|
|
33
|
+
|
|
34
|
+
i. the right to reproduce, adapt, distribute, perform, display, communicate,
|
|
35
|
+
and translate a Work;
|
|
36
|
+
|
|
37
|
+
ii. moral rights retained by the original author(s) and/or performer(s);
|
|
38
|
+
|
|
39
|
+
iii. publicity and privacy rights pertaining to a person's image or likeness
|
|
40
|
+
depicted in a Work;
|
|
41
|
+
|
|
42
|
+
iv. rights protecting against unfair competition in regards to a Work,
|
|
43
|
+
subject to the limitations in paragraph 4(a), below;
|
|
44
|
+
|
|
45
|
+
v. rights protecting the extraction, dissemination, use and reuse of data in
|
|
46
|
+
a Work;
|
|
47
|
+
|
|
48
|
+
vi. database rights (such as those arising under Directive 96/9/EC of the
|
|
49
|
+
European Parliament and of the Council of 11 March 1996 on the legal
|
|
50
|
+
protection of databases, and under any national implementation thereof,
|
|
51
|
+
including any amended or successor version of such directive); and
|
|
52
|
+
|
|
53
|
+
vii. other similar, equivalent or corresponding rights throughout the world
|
|
54
|
+
based on applicable law or treaty, and any national implementations thereof.
|
|
55
|
+
|
|
56
|
+
2. Waiver. To the greatest extent permitted by, but not in contravention of,
|
|
57
|
+
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
|
|
58
|
+
unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
|
|
59
|
+
and Related Rights and associated claims and causes of action, whether now
|
|
60
|
+
known or unknown (including existing as well as future claims and causes of
|
|
61
|
+
action), in the Work (i) in all territories worldwide, (ii) for the maximum
|
|
62
|
+
duration provided by applicable law or treaty (including future time
|
|
63
|
+
extensions), (iii) in any current or future medium and for any number of
|
|
64
|
+
copies, and (iv) for any purpose whatsoever, including without limitation
|
|
65
|
+
commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
|
|
66
|
+
the Waiver for the benefit of each member of the public at large and to the
|
|
67
|
+
detriment of Affirmer's heirs and successors, fully intending that such Waiver
|
|
68
|
+
shall not be subject to revocation, rescission, cancellation, termination, or
|
|
69
|
+
any other legal or equitable action to disrupt the quiet enjoyment of the Work
|
|
70
|
+
by the public as contemplated by Affirmer's express Statement of Purpose.
|
|
71
|
+
|
|
72
|
+
3. Public License Fallback. Should any part of the Waiver for any reason be
|
|
73
|
+
judged legally invalid or ineffective under applicable law, then the Waiver
|
|
74
|
+
shall be preserved to the maximum extent permitted taking into account
|
|
75
|
+
Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
|
|
76
|
+
is so judged Affirmer hereby grants to each affected person a royalty-free,
|
|
77
|
+
non transferable, non sublicensable, non exclusive, irrevocable and
|
|
78
|
+
unconditional license to exercise Affirmer's Copyright and Related Rights in
|
|
79
|
+
the Work (i) in all territories worldwide, (ii) for the maximum duration
|
|
80
|
+
provided by applicable law or treaty (including future time extensions), (iii)
|
|
81
|
+
in any current or future medium and for any number of copies, and (iv) for any
|
|
82
|
+
purpose whatsoever, including without limitation commercial, advertising or
|
|
83
|
+
promotional purposes (the "License"). The License shall be deemed effective as
|
|
84
|
+
of the date CC0 was applied by Affirmer to the Work. Should any part of the
|
|
85
|
+
License for any reason be judged legally invalid or ineffective under
|
|
86
|
+
applicable law, such partial invalidity or ineffectiveness shall not
|
|
87
|
+
invalidate the remainder of the License, and in such case Affirmer hereby
|
|
88
|
+
affirms that he or she will not (i) exercise any of his or her remaining
|
|
89
|
+
Copyright and Related Rights in the Work or (ii) assert any associated claims
|
|
90
|
+
and causes of action with respect to the Work, in either case contrary to
|
|
91
|
+
Affirmer's express Statement of Purpose.
|
|
92
|
+
|
|
93
|
+
4. Limitations and Disclaimers.
|
|
94
|
+
|
|
95
|
+
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
|
96
|
+
surrendered, licensed or otherwise affected by this document.
|
|
97
|
+
|
|
98
|
+
b. Affirmer offers the Work as-is and makes no representations or warranties
|
|
99
|
+
of any kind concerning the Work, express, implied, statutory or otherwise,
|
|
100
|
+
including without limitation warranties of title, merchantability, fitness
|
|
101
|
+
for a particular purpose, non infringement, or the absence of latent or
|
|
102
|
+
other defects, accuracy, or the present or absence of errors, whether or not
|
|
103
|
+
discoverable, all to the greatest extent permissible under applicable law.
|
|
104
|
+
|
|
105
|
+
c. Affirmer disclaims responsibility for clearing rights of other persons
|
|
106
|
+
that may apply to the Work or any use thereof, including without limitation
|
|
107
|
+
any person's Copyright and Related Rights in the Work. Further, Affirmer
|
|
108
|
+
disclaims responsibility for obtaining any necessary consents, permissions
|
|
109
|
+
or other rights required for any use of the Work.
|
|
110
|
+
|
|
111
|
+
d. Affirmer understands and acknowledges that Creative Commons is not a
|
|
112
|
+
party to this document and has no duty or obligation with respect to this
|
|
113
|
+
CC0 or use of the Work.
|
|
114
|
+
|
|
115
|
+
For more information, please see
|
|
116
|
+
<http://creativecommons.org/publicdomain/zero/1.0/>
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ethstaker_deposit
|
|
3
|
+
Version: 1.3.1
|
|
4
|
+
Summary: Secure key generation for deposits
|
|
5
|
+
Project-URL: Homepage, https://github.com/ethstaker/ethstaker-deposit-cli
|
|
6
|
+
Requires-Python: <4,>=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: click>=8.4.2
|
|
10
|
+
Requires-Dist: eth-typing>=6.0.0
|
|
11
|
+
Requires-Dist: eth-utils>=6.0.0
|
|
12
|
+
Requires-Dist: pycryptodome>=3.23.0
|
|
13
|
+
Requires-Dist: pyperclip>=1.11.0
|
|
14
|
+
Requires-Dist: py-ecc>=8.0.0
|
|
15
|
+
Requires-Dist: ssz>=0.5.2
|
|
16
|
+
Requires-Dist: jsonschema>=4.26.0
|
|
17
|
+
Requires-Dist: colorama>=0.4.6; sys_platform == "win32"
|
|
18
|
+
Provides-Extra: test
|
|
19
|
+
Requires-Dist: exceptiongroup==1.3.1; extra == "test"
|
|
20
|
+
Requires-Dist: mypy==2.3.1; extra == "test"
|
|
21
|
+
Requires-Dist: pytest==9.1.1; extra == "test"
|
|
22
|
+
Requires-Dist: pytest-asyncio==1.4.0; extra == "test"
|
|
23
|
+
Requires-Dist: backports-asyncio-runner==1.2.0; python_version < "3.11" and extra == "test"
|
|
24
|
+
Requires-Dist: coverage==7.15.4; extra == "test"
|
|
25
|
+
Requires-Dist: tomli==2.4.1; extra == "test"
|
|
26
|
+
Requires-Dist: iniconfig==2.3.0; extra == "test"
|
|
27
|
+
Requires-Dist: mypy-extensions==1.1.0; extra == "test"
|
|
28
|
+
Requires-Dist: packaging==26.3; extra == "test"
|
|
29
|
+
Requires-Dist: pluggy==1.6.0; extra == "test"
|
|
30
|
+
Requires-Dist: typing-extensions==4.16.0; extra == "test"
|
|
31
|
+
Requires-Dist: ruff==0.16.4; extra == "test"
|
|
32
|
+
Requires-Dist: Pygments==2.20.0; extra == "test"
|
|
33
|
+
Requires-Dist: pathspec==1.1.1; extra == "test"
|
|
34
|
+
Requires-Dist: pip-audit==2.10.1; extra == "test"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
# ethstaker-deposit-cli docs
|
|
38
|
+
|
|
39
|
+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
|
40
|
+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
41
|
+
## Documentation
|
|
42
|
+
- [Introduction](https://deposit-cli.ethstaker.cc/landing.html)
|
|
43
|
+
- [Quick Setup](https://deposit-cli.ethstaker.cc/quick_setup.html)
|
|
44
|
+
|
|
45
|
+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
46
|
+
|
|
47
|
+
## Introduction
|
|
48
|
+
|
|
49
|
+
`ethstaker-deposit-cli` is a tool for creating [EIP-2335 format](https://eips.ethereum.org/EIPS/eip-2335) BLS12-381 keystores and a corresponding `deposit_data*.json` file for [Ethereum Staking Launchpad](https://github.com/ethereum/staking-launchpad) or the [Gnosis Beacon Chain deposit UI](https://github.com/gnosischain/gbc-deposit-ui/). One can also provide a keystore file to generate a `signed_exit_transaction*.json` file to be broadcast at a later date to exit a validator.
|
|
50
|
+
|
|
51
|
+
- **Warning: Please generate your keystores on your own safe, completely offline device.**
|
|
52
|
+
- **Warning: Please backup your mnemonic, keystores, and password securely.**
|
|
53
|
+
|
|
54
|
+
Please read [Launchpad Validator FAQs](https://launchpad.ethereum.org/faq#keys) before generating the keys.
|
|
55
|
+
|
|
56
|
+
The project has been through various security audits over the years. You can find them here:
|
|
57
|
+
- March 4, 2026: [Security assessment report by Trail of Bits](https://github.com/trailofbits/publications/blob/master/reviews/2026-03-ethstaker-deposit-cli-securityreview.pdf)
|
|
58
|
+
- December 13, 2024: [Security assessment report by Trail of Bits](https://github.com/trailofbits/publications/blob/master/reviews/2024-12-ethstaker-depositcli-securityreview.pdf)
|
|
59
|
+
- September 4, 2020: [Security assessment report by Trail of Bits](https://github.com/trailofbits/publications/blob/master/reviews/ETH2DepositCLI.pdf) of the original staking-deposit-cli project
|
|
60
|
+
|
|
61
|
+
## Canonical Deposit Contract and Launchpad
|
|
62
|
+
|
|
63
|
+
Ethstaker confirms the canonical Ethereum staking deposit contract addresses and launchpad URLs.
|
|
64
|
+
Please be sure that your ETH is deposited only to this deposit contract address, depending on chain.
|
|
65
|
+
|
|
66
|
+
Depositing to the wrong address **will** lose you your ETH.
|
|
67
|
+
|
|
68
|
+
- Ethereum mainnet
|
|
69
|
+
- Deposit address: [0x00000000219ab540356cBB839Cbe05303d7705Fa](https://etherscan.io/address/0x00000000219ab540356cBB839Cbe05303d7705Fa)
|
|
70
|
+
- [Launchpad](https://launchpad.ethereum.org/)
|
|
71
|
+
- Ethereum Hoodi testnet
|
|
72
|
+
- Deposit address: [0x00000000219ab540356cBB839Cbe05303d7705Fa](https://hoodi.etherscan.io/address/0x00000000219ab540356cBB839Cbe05303d7705Fa)
|
|
73
|
+
- [Launchpad](https://hoodi.launchpad.ethereum.org/)
|
|
74
|
+
|
|
75
|
+
- Plataberget testnet
|
|
76
|
+
- Deposit address: [0x00000000219ab540356cBB839Cbe05303d7705Fa](https://dora.plataberget.ethpandaops.io/address/0x00000000219ab540356cbb839cbe05303d7705fa)
|
|
77
|
+
- [Validator deposits via Dora](https://dora.plataberget.ethpandaops.io/validators/deposits/submit)
|
|
78
|
+
- Plataberget is expected to be shut down by the end of 2026.
|
|
79
|
+
|
|
80
|
+
- Gnosis mainnet
|
|
81
|
+
- Deposit address: [0x0B98057eA310F4d31F2a452B414647007d1645d9](https://gnosis.blockscout.com/address/0x0B98057eA310F4d31F2a452B414647007d1645d9)
|
|
82
|
+
- [Gnosis Beacon Chain deposit UI](https://deposit.gnosischain.com/)
|
|
83
|
+
- Chiado testnet
|
|
84
|
+
- Deposit address: [0xb97036A26259B7147018913bD58a774cf91acf25](https://gnosis-chiado.blockscout.com/address/0xb97036A26259B7147018913bD58a774cf91acf25)
|
|
85
|
+
- [Gnosis Beacon Chain deposit UI](https://deposit.gnosischain.com/)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# ethstaker-deposit-cli docs
|
|
2
|
+
|
|
3
|
+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
|
4
|
+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
5
|
+
## Documentation
|
|
6
|
+
- [Introduction](https://deposit-cli.ethstaker.cc/landing.html)
|
|
7
|
+
- [Quick Setup](https://deposit-cli.ethstaker.cc/quick_setup.html)
|
|
8
|
+
|
|
9
|
+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
10
|
+
|
|
11
|
+
## Introduction
|
|
12
|
+
|
|
13
|
+
`ethstaker-deposit-cli` is a tool for creating [EIP-2335 format](https://eips.ethereum.org/EIPS/eip-2335) BLS12-381 keystores and a corresponding `deposit_data*.json` file for [Ethereum Staking Launchpad](https://github.com/ethereum/staking-launchpad) or the [Gnosis Beacon Chain deposit UI](https://github.com/gnosischain/gbc-deposit-ui/). One can also provide a keystore file to generate a `signed_exit_transaction*.json` file to be broadcast at a later date to exit a validator.
|
|
14
|
+
|
|
15
|
+
- **Warning: Please generate your keystores on your own safe, completely offline device.**
|
|
16
|
+
- **Warning: Please backup your mnemonic, keystores, and password securely.**
|
|
17
|
+
|
|
18
|
+
Please read [Launchpad Validator FAQs](https://launchpad.ethereum.org/faq#keys) before generating the keys.
|
|
19
|
+
|
|
20
|
+
The project has been through various security audits over the years. You can find them here:
|
|
21
|
+
- March 4, 2026: [Security assessment report by Trail of Bits](https://github.com/trailofbits/publications/blob/master/reviews/2026-03-ethstaker-deposit-cli-securityreview.pdf)
|
|
22
|
+
- December 13, 2024: [Security assessment report by Trail of Bits](https://github.com/trailofbits/publications/blob/master/reviews/2024-12-ethstaker-depositcli-securityreview.pdf)
|
|
23
|
+
- September 4, 2020: [Security assessment report by Trail of Bits](https://github.com/trailofbits/publications/blob/master/reviews/ETH2DepositCLI.pdf) of the original staking-deposit-cli project
|
|
24
|
+
|
|
25
|
+
## Canonical Deposit Contract and Launchpad
|
|
26
|
+
|
|
27
|
+
Ethstaker confirms the canonical Ethereum staking deposit contract addresses and launchpad URLs.
|
|
28
|
+
Please be sure that your ETH is deposited only to this deposit contract address, depending on chain.
|
|
29
|
+
|
|
30
|
+
Depositing to the wrong address **will** lose you your ETH.
|
|
31
|
+
|
|
32
|
+
- Ethereum mainnet
|
|
33
|
+
- Deposit address: [0x00000000219ab540356cBB839Cbe05303d7705Fa](https://etherscan.io/address/0x00000000219ab540356cBB839Cbe05303d7705Fa)
|
|
34
|
+
- [Launchpad](https://launchpad.ethereum.org/)
|
|
35
|
+
- Ethereum Hoodi testnet
|
|
36
|
+
- Deposit address: [0x00000000219ab540356cBB839Cbe05303d7705Fa](https://hoodi.etherscan.io/address/0x00000000219ab540356cBB839Cbe05303d7705Fa)
|
|
37
|
+
- [Launchpad](https://hoodi.launchpad.ethereum.org/)
|
|
38
|
+
|
|
39
|
+
- Plataberget testnet
|
|
40
|
+
- Deposit address: [0x00000000219ab540356cBB839Cbe05303d7705Fa](https://dora.plataberget.ethpandaops.io/address/0x00000000219ab540356cbb839cbe05303d7705fa)
|
|
41
|
+
- [Validator deposits via Dora](https://dora.plataberget.ethpandaops.io/validators/deposits/submit)
|
|
42
|
+
- Plataberget is expected to be shut down by the end of 2026.
|
|
43
|
+
|
|
44
|
+
- Gnosis mainnet
|
|
45
|
+
- Deposit address: [0x0B98057eA310F4d31F2a452B414647007d1645d9](https://gnosis.blockscout.com/address/0x0B98057eA310F4d31F2a452B414647007d1645d9)
|
|
46
|
+
- [Gnosis Beacon Chain deposit UI](https://deposit.gnosischain.com/)
|
|
47
|
+
- Chiado testnet
|
|
48
|
+
- Deposit address: [0xb97036A26259B7147018913bD58a774cf91acf25](https://gnosis-chiado.blockscout.com/address/0xb97036A26259B7147018913bD58a774cf91acf25)
|
|
49
|
+
- [Gnosis Beacon Chain deposit UI](https://deposit.gnosischain.com/)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.3.1
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
from typing import Any
|
|
4
|
+
from eth_typing import HexAddress
|
|
5
|
+
from eth_utils import to_canonical_address
|
|
6
|
+
from py_ecc.bls import G2ProofOfPossession as bls
|
|
7
|
+
|
|
8
|
+
from ethstaker_deposit.exceptions import ValidationError
|
|
9
|
+
from ethstaker_deposit.settings import BaseChainSetting
|
|
10
|
+
from ethstaker_deposit.utils.ssz import (
|
|
11
|
+
BLSToExecutionChangeKeystore,
|
|
12
|
+
SignedBLSToExecutionChangeKeystore,
|
|
13
|
+
compute_signing_root,
|
|
14
|
+
compute_bls_to_execution_change_keystore_domain,
|
|
15
|
+
)
|
|
16
|
+
from ethstaker_deposit.utils.file_handling import (
|
|
17
|
+
sensitive_opener,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def bls_to_execution_change_keystore_generation(
|
|
22
|
+
chain_setting: BaseChainSetting,
|
|
23
|
+
signing_key: int,
|
|
24
|
+
withdrawal_address: HexAddress,
|
|
25
|
+
validator_index: int) -> SignedBLSToExecutionChangeKeystore:
|
|
26
|
+
if withdrawal_address is None:
|
|
27
|
+
raise ValueError("The withdrawal address should NOT be empty.")
|
|
28
|
+
if chain_setting.GENESIS_VALIDATORS_ROOT is None:
|
|
29
|
+
raise ValidationError("The genesis validators root should NOT be empty "
|
|
30
|
+
"for this chain to obtain the BLS to execution change.")
|
|
31
|
+
|
|
32
|
+
message = BLSToExecutionChangeKeystore( # type: ignore[no-untyped-call]
|
|
33
|
+
validator_index=validator_index,
|
|
34
|
+
to_execution_address=to_canonical_address(withdrawal_address),
|
|
35
|
+
)
|
|
36
|
+
domain = compute_bls_to_execution_change_keystore_domain(
|
|
37
|
+
fork_version=chain_setting.GENESIS_FORK_VERSION,
|
|
38
|
+
genesis_validators_root=chain_setting.GENESIS_VALIDATORS_ROOT,
|
|
39
|
+
)
|
|
40
|
+
signing_root = compute_signing_root(message, domain)
|
|
41
|
+
signature = bls.Sign(signing_key, signing_root)
|
|
42
|
+
|
|
43
|
+
return SignedBLSToExecutionChangeKeystore( # type: ignore[no-untyped-call]
|
|
44
|
+
message=message,
|
|
45
|
+
signature=signature,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def export_bls_to_execution_change_keystore_json(folder: str,
|
|
50
|
+
signed_execution_change: SignedBLSToExecutionChangeKeystore,
|
|
51
|
+
timestamp: float) -> str:
|
|
52
|
+
signed_bls_to_execution_change_keystore_json: dict[str, Any] = {}
|
|
53
|
+
|
|
54
|
+
address = '0x' + signed_execution_change.message.to_execution_address.hex() # type: ignore[attr-defined]
|
|
55
|
+
index = signed_execution_change.message.validator_index # type: ignore[attr-defined]
|
|
56
|
+
signature = '0x' + signed_execution_change.signature.hex() # type: ignore[attr-defined]
|
|
57
|
+
|
|
58
|
+
message = {
|
|
59
|
+
'to_execution_address': address,
|
|
60
|
+
'validator_index': index,
|
|
61
|
+
}
|
|
62
|
+
signed_bls_to_execution_change_keystore_json.update({'message': message})
|
|
63
|
+
signed_bls_to_execution_change_keystore_json.update({'signature': signature})
|
|
64
|
+
|
|
65
|
+
filefolder = os.path.join(
|
|
66
|
+
folder,
|
|
67
|
+
f'bls_to_execution_change_keystore_signature-{index}-{int(timestamp)}.json'
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
with open(filefolder, 'w', encoding='utf-8', opener=sensitive_opener) as f:
|
|
71
|
+
json.dump(signed_bls_to_execution_change_keystore_json, f)
|
|
72
|
+
return filefolder
|
|
File without changes
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import click
|
|
2
|
+
import pyperclip
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from ethstaker_deposit.key_handling.key_derivation.mnemonic import (
|
|
6
|
+
get_mnemonic,
|
|
7
|
+
reconstruct_mnemonic,
|
|
8
|
+
)
|
|
9
|
+
from ethstaker_deposit.cli.existing_mnemonic import (
|
|
10
|
+
validate_mnemonic,
|
|
11
|
+
)
|
|
12
|
+
from ethstaker_deposit.exceptions import ValidationError
|
|
13
|
+
from ethstaker_deposit.utils import config
|
|
14
|
+
from ethstaker_deposit.utils.click import (
|
|
15
|
+
captive_prompt_callback,
|
|
16
|
+
choice_prompt_func,
|
|
17
|
+
jit_option,
|
|
18
|
+
prompt_if_none,
|
|
19
|
+
prompt_if_other_is_none,
|
|
20
|
+
)
|
|
21
|
+
from ethstaker_deposit.utils.constants import (
|
|
22
|
+
MNEMONIC_LANG_OPTIONS,
|
|
23
|
+
WORD_LISTS_PATH,
|
|
24
|
+
)
|
|
25
|
+
from ethstaker_deposit.utils.intl import (
|
|
26
|
+
fuzzy_reverse_dict_lookup,
|
|
27
|
+
load_text,
|
|
28
|
+
get_first_options,
|
|
29
|
+
)
|
|
30
|
+
from ethstaker_deposit.utils.terminal import clear_terminal
|
|
31
|
+
from ethstaker_deposit.utils.validation import validate_int_range
|
|
32
|
+
|
|
33
|
+
from .generate_builder_keys import (
|
|
34
|
+
generate_builder_keys,
|
|
35
|
+
generate_builder_keys_arguments_decorator,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
languages = get_first_options(MNEMONIC_LANG_OPTIONS)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _mnemonic_language_default() -> str | None:
|
|
42
|
+
# If an existing mnemonic was supplied, its language is auto-detected by validate_mnemonic.
|
|
43
|
+
# A fresh mnemonic needs a wordlist language chosen up-front
|
|
44
|
+
ctx = click.get_current_context(silent=True)
|
|
45
|
+
if ctx is not None and ctx.params.get('mnemonic'):
|
|
46
|
+
return None
|
|
47
|
+
return load_text(['arg_mnemonic_language', 'default'], func='builder')
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _process_mnemonic_language(mnemonic_language: str, _: Any) -> str | None:
|
|
51
|
+
return fuzzy_reverse_dict_lookup(mnemonic_language, MNEMONIC_LANG_OPTIONS) if mnemonic_language else None
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _resolve_mnemonic(ctx: click.Context, param: Any, mnemonic: str) -> str | None:
|
|
55
|
+
if mnemonic:
|
|
56
|
+
# Provided directly via --mnemonic
|
|
57
|
+
return validate_mnemonic(mnemonic=mnemonic, language=ctx.params.get('mnemonic_language'))
|
|
58
|
+
if config.non_interactive:
|
|
59
|
+
return None
|
|
60
|
+
has_existing = click.confirm(load_text(['arg_mnemonic', 'existing_confirm'], func='builder'), default=False)
|
|
61
|
+
if not has_existing:
|
|
62
|
+
return None
|
|
63
|
+
return captive_prompt_callback(
|
|
64
|
+
lambda mnemonic, _: validate_mnemonic(mnemonic=mnemonic, language=ctx.params.get('mnemonic_language')),
|
|
65
|
+
lambda: load_text(['arg_mnemonic', 'prompt'], func='builder'),
|
|
66
|
+
prompt_if=prompt_if_none,
|
|
67
|
+
)(ctx, param, mnemonic)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _resolve_mnemonic_password(ctx: click.Context, param: Any, mnemonic_password: str) -> str:
|
|
71
|
+
resolved = captive_prompt_callback(
|
|
72
|
+
lambda x, _: x,
|
|
73
|
+
lambda: load_text(['arg_mnemonic_password', 'prompt'], func='builder'),
|
|
74
|
+
lambda: load_text(['arg_mnemonic_password', 'confirm'], func='builder'),
|
|
75
|
+
lambda: load_text(['arg_mnemonic_password', 'mismatch'], func='builder'),
|
|
76
|
+
hide_input=True,
|
|
77
|
+
)(ctx, param, mnemonic_password)
|
|
78
|
+
if resolved and not ctx.params.get('mnemonic'):
|
|
79
|
+
# Do not allow mnemonic password if mnemonic is not provided
|
|
80
|
+
raise ValidationError(load_text(['err_mnemonic_password_not_allowed'], func='builder'))
|
|
81
|
+
return resolved
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
@click.command(
|
|
85
|
+
help=load_text(['arg_builder', 'help'], func='builder'),
|
|
86
|
+
)
|
|
87
|
+
@click.pass_context
|
|
88
|
+
@jit_option(
|
|
89
|
+
callback=_resolve_mnemonic,
|
|
90
|
+
help=lambda: load_text(['arg_mnemonic', 'help'], func='builder'),
|
|
91
|
+
param_decls='--mnemonic',
|
|
92
|
+
default=None,
|
|
93
|
+
prompt=False,
|
|
94
|
+
type=str,
|
|
95
|
+
is_eager=True,
|
|
96
|
+
)
|
|
97
|
+
@jit_option(
|
|
98
|
+
callback=_resolve_mnemonic_password,
|
|
99
|
+
default='',
|
|
100
|
+
help=lambda: load_text(['arg_mnemonic_password', 'help'], func='builder'),
|
|
101
|
+
hidden=True,
|
|
102
|
+
param_decls='--mnemonic_password',
|
|
103
|
+
prompt=False,
|
|
104
|
+
)
|
|
105
|
+
@jit_option(
|
|
106
|
+
callback=captive_prompt_callback(
|
|
107
|
+
_process_mnemonic_language,
|
|
108
|
+
choice_prompt_func(lambda: load_text(['arg_mnemonic_language', 'prompt'], func='builder'), languages),
|
|
109
|
+
default=_mnemonic_language_default,
|
|
110
|
+
prompt_if=prompt_if_other_is_none('mnemonic'),
|
|
111
|
+
),
|
|
112
|
+
default=_mnemonic_language_default,
|
|
113
|
+
help=lambda: load_text(['arg_mnemonic_language', 'help'], func='builder'),
|
|
114
|
+
param_decls='--mnemonic_language',
|
|
115
|
+
prompt=False,
|
|
116
|
+
)
|
|
117
|
+
@jit_option(
|
|
118
|
+
# We do not want to request a start index if a mnemonic is not provided as it
|
|
119
|
+
# is assumed to be 0, unless provided. If a mnemonic is provided we must request
|
|
120
|
+
# the start index if not already provided
|
|
121
|
+
callback=lambda ctx, param, num: (
|
|
122
|
+
captive_prompt_callback(
|
|
123
|
+
lambda num, _: validate_int_range(num, 0, 2**32),
|
|
124
|
+
lambda: load_text(['arg_builder_start_index', 'prompt'], func='builder'),
|
|
125
|
+
lambda: load_text(['arg_builder_start_index', 'confirm'], func='builder'),
|
|
126
|
+
prompt_if=prompt_if_none,
|
|
127
|
+
)(ctx, param, num)
|
|
128
|
+
if ctx.params.get('mnemonic')
|
|
129
|
+
else captive_prompt_callback(
|
|
130
|
+
lambda num, _: validate_int_range(num, 0, 2**32),
|
|
131
|
+
lambda: load_text(['arg_builder_start_index', 'prompt'], func='builder'),
|
|
132
|
+
)(ctx, param, num)
|
|
133
|
+
),
|
|
134
|
+
default=0,
|
|
135
|
+
help=lambda: load_text(['arg_builder_start_index', 'help'], func='builder'),
|
|
136
|
+
param_decls="--builder_start_index",
|
|
137
|
+
prompt=False,
|
|
138
|
+
)
|
|
139
|
+
@generate_builder_keys_arguments_decorator
|
|
140
|
+
def builder(ctx: click.Context, mnemonic: str, mnemonic_password: str, mnemonic_language: str, **kwargs: Any) -> None:
|
|
141
|
+
if not mnemonic:
|
|
142
|
+
mnemonic = get_mnemonic(language=mnemonic_language, words_path=WORD_LISTS_PATH)
|
|
143
|
+
test_mnemonic = ''
|
|
144
|
+
while mnemonic != reconstruct_mnemonic(test_mnemonic, WORD_LISTS_PATH, mnemonic_language):
|
|
145
|
+
clear_terminal()
|
|
146
|
+
click.echo(
|
|
147
|
+
load_text(['msg_mnemonic_presentation'], func='builder')
|
|
148
|
+
+ '\n\n********************\n'
|
|
149
|
+
+ load_text(['msg_mnemonic_clipboard_warning'], func='builder')
|
|
150
|
+
+ '\n********************'
|
|
151
|
+
)
|
|
152
|
+
click.echo(f'\n\n{mnemonic}\n\n')
|
|
153
|
+
click.pause(load_text(['msg_press_any_key'], func='builder'))
|
|
154
|
+
|
|
155
|
+
clear_terminal()
|
|
156
|
+
test_mnemonic = click.prompt(
|
|
157
|
+
load_text(['msg_mnemonic_retype_prompt'], func='builder')
|
|
158
|
+
+ '\n\n********************\n'
|
|
159
|
+
+ load_text(['msg_mnemonic_clipboard_warning'], func='builder')
|
|
160
|
+
+ '\n********************\n\n'
|
|
161
|
+
)
|
|
162
|
+
clear_terminal()
|
|
163
|
+
# Clear clipboard
|
|
164
|
+
try: # Failing this on headless Linux is expected
|
|
165
|
+
click.pause(load_text(['msg_confirm_clipboard_clearing'], func='builder'))
|
|
166
|
+
pyperclip.copy(' ')
|
|
167
|
+
except Exception: # noqa: S110
|
|
168
|
+
pass
|
|
169
|
+
|
|
170
|
+
ctx.obj = {'mnemonic': mnemonic, 'mnemonic_password': mnemonic_password}
|
|
171
|
+
ctx.forward(generate_builder_keys)
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import click
|
|
2
|
+
import pyperclip
|
|
3
|
+
from typing import Any
|
|
4
|
+
from collections.abc import Callable
|
|
5
|
+
|
|
6
|
+
from ethstaker_deposit.exceptions import MultiLanguageError, ValidationError
|
|
7
|
+
from ethstaker_deposit.key_handling.key_derivation.mnemonic import (
|
|
8
|
+
reconstruct_mnemonic,
|
|
9
|
+
)
|
|
10
|
+
from ethstaker_deposit.utils import config
|
|
11
|
+
from ethstaker_deposit.utils.constants import (
|
|
12
|
+
MNEMONIC_LANG_OPTIONS,
|
|
13
|
+
WORD_LISTS_PATH,
|
|
14
|
+
)
|
|
15
|
+
from ethstaker_deposit.utils.click import (
|
|
16
|
+
captive_prompt_callback,
|
|
17
|
+
choice_prompt_func,
|
|
18
|
+
jit_option,
|
|
19
|
+
prompt_if_none,
|
|
20
|
+
)
|
|
21
|
+
from ethstaker_deposit.utils.intl import fuzzy_reverse_dict_lookup, get_first_options, load_text
|
|
22
|
+
from ethstaker_deposit.utils.validation import validate_int_range
|
|
23
|
+
from .generate_keys import (
|
|
24
|
+
generate_keys,
|
|
25
|
+
generate_keys_arguments_decorator,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def load_mnemonic_arguments_decorator(function: Callable[..., Any]) -> Callable[..., Any]:
|
|
30
|
+
'''
|
|
31
|
+
This is a decorator that, when applied to a parent-command, implements the
|
|
32
|
+
to obtain the necessary arguments for the generate_keys() subcommand.
|
|
33
|
+
'''
|
|
34
|
+
decorators = [
|
|
35
|
+
jit_option(
|
|
36
|
+
callback=lambda c, _, mnemonic:
|
|
37
|
+
captive_prompt_callback(
|
|
38
|
+
lambda mnemonic, _: validate_mnemonic(mnemonic=mnemonic,
|
|
39
|
+
language=c.params.get('mnemonic_language')),
|
|
40
|
+
prompt=lambda: load_text(['arg_mnemonic', 'prompt'], func='existing_mnemonic'),
|
|
41
|
+
prompt_if=prompt_if_none,
|
|
42
|
+
)(c, _, mnemonic),
|
|
43
|
+
help=lambda: load_text(['arg_mnemonic', 'help'], func='existing_mnemonic'),
|
|
44
|
+
param_decls='--mnemonic',
|
|
45
|
+
prompt=False,
|
|
46
|
+
type=str,
|
|
47
|
+
),
|
|
48
|
+
jit_option(
|
|
49
|
+
callback=captive_prompt_callback(
|
|
50
|
+
lambda x, _: x,
|
|
51
|
+
lambda: load_text(['arg_mnemonic_password', 'prompt'], func='existing_mnemonic'),
|
|
52
|
+
lambda: load_text(['arg_mnemonic_password', 'confirm'], func='existing_mnemonic'),
|
|
53
|
+
lambda: load_text(['arg_mnemonic_password', 'mismatch'], func='existing_mnemonic'),
|
|
54
|
+
hide_input=True,
|
|
55
|
+
),
|
|
56
|
+
default='',
|
|
57
|
+
help=lambda: load_text(['arg_mnemonic_password', 'help'], func='existing_mnemonic'),
|
|
58
|
+
hidden=True,
|
|
59
|
+
param_decls='--mnemonic_password',
|
|
60
|
+
prompt=False,
|
|
61
|
+
),
|
|
62
|
+
jit_option(
|
|
63
|
+
callback=validate_mnemonic_language,
|
|
64
|
+
default=None,
|
|
65
|
+
help=lambda: load_text(['arg_mnemonic_language', 'help'], func='existing_mnemonic'),
|
|
66
|
+
param_decls='--mnemonic_language',
|
|
67
|
+
prompt=None,
|
|
68
|
+
),
|
|
69
|
+
]
|
|
70
|
+
for decorator in reversed(decorators):
|
|
71
|
+
function = decorator(function)
|
|
72
|
+
return function
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def validate_mnemonic(mnemonic: str, language: str | None = None) -> str:
|
|
76
|
+
try:
|
|
77
|
+
reconstructed_mnemonic = reconstruct_mnemonic(mnemonic, WORD_LISTS_PATH, language)
|
|
78
|
+
except MultiLanguageError as e:
|
|
79
|
+
# Get discovered languages from error and prompt user to select one of them
|
|
80
|
+
available_languages = sorted(get_first_options({lang: MNEMONIC_LANG_OPTIONS[lang] for lang in e.languages}))
|
|
81
|
+
prompt_message = choice_prompt_func(lambda: load_text(['arg_mnemonic_language'], func='validate_mnemonic'),
|
|
82
|
+
available_languages,
|
|
83
|
+
False)
|
|
84
|
+
language = click.prompt(prompt_message())
|
|
85
|
+
mnemonic_language = fuzzy_reverse_dict_lookup(language, MNEMONIC_LANG_OPTIONS)
|
|
86
|
+
return validate_mnemonic(mnemonic=mnemonic, language=mnemonic_language)
|
|
87
|
+
|
|
88
|
+
if reconstructed_mnemonic is not None:
|
|
89
|
+
return reconstructed_mnemonic
|
|
90
|
+
else:
|
|
91
|
+
raise ValidationError(load_text(['err_invalid_mnemonic']))
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def validate_mnemonic_language(ctx: click.Context, param: Any, language: str) -> str | None:
|
|
95
|
+
return fuzzy_reverse_dict_lookup(language, MNEMONIC_LANG_OPTIONS) if language else None
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
@click.command(
|
|
99
|
+
help=load_text(['arg_existing_mnemonic', 'help'], func='existing_mnemonic'),
|
|
100
|
+
)
|
|
101
|
+
@load_mnemonic_arguments_decorator
|
|
102
|
+
@jit_option(
|
|
103
|
+
callback=captive_prompt_callback(
|
|
104
|
+
lambda num, _: validate_int_range(num, 0, 2**32),
|
|
105
|
+
lambda: load_text(['arg_validator_start_index', 'prompt'], func='existing_mnemonic'),
|
|
106
|
+
lambda: load_text(['arg_validator_start_index', 'confirm'], func='existing_mnemonic'),
|
|
107
|
+
prompt_if=prompt_if_none,
|
|
108
|
+
),
|
|
109
|
+
default=0,
|
|
110
|
+
help=lambda: load_text(['arg_validator_start_index', 'help'], func='existing_mnemonic'),
|
|
111
|
+
param_decls="--validator_start_index",
|
|
112
|
+
prompt=False, # the callback handles the prompt
|
|
113
|
+
)
|
|
114
|
+
@generate_keys_arguments_decorator
|
|
115
|
+
@click.pass_context
|
|
116
|
+
def existing_mnemonic(ctx: click.Context, mnemonic: str, mnemonic_password: str, **kwargs: Any) -> None:
|
|
117
|
+
ctx.obj = {} if ctx.obj is None else ctx.obj # Create a new ctx.obj if it doesn't exist
|
|
118
|
+
ctx.obj.update({'mnemonic': mnemonic, 'mnemonic_password': mnemonic_password})
|
|
119
|
+
# Clear clipboard
|
|
120
|
+
try: # Failing this on headless Linux is expected
|
|
121
|
+
if not config.non_interactive:
|
|
122
|
+
click.pause(load_text(['msg_confirm_clipboard_clearing']))
|
|
123
|
+
pyperclip.copy(' ')
|
|
124
|
+
except Exception: # noqa: S110
|
|
125
|
+
pass
|
|
126
|
+
ctx.forward(generate_keys)
|