-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: review node-ethereum-locale.md
- Loading branch information
Showing
3 changed files
with
39 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
"""Tool to get the private key of a keystore file.""" | ||
"""Tool to get the private key of a keystore file. | ||
Setup: | ||
python -m pip install eth-account | ||
""" | ||
import sys | ||
from binascii import b2a_hex | ||
from pathlib import Path | ||
|
||
from web3.auto import w3 | ||
from eth_account.account import Account | ||
|
||
path = Path(__file__).parent / "node" / "keystore" / sys.argv[1] | ||
encrypted_key = path.read_text() | ||
password = "" # Adapt accordingly to what was set at the account creation | ||
private_key = w3.eth.account.decrypt(encrypted_key, password) | ||
private_key = Account.decrypt(encrypted_key, password) | ||
print(b2a_hex(private_key).decode()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters