Skip to content
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

Decrypt private key in python #5

Open
Titan-Node opened this issue Oct 13, 2024 · 0 comments
Open

Decrypt private key in python #5

Titan-Node opened this issue Oct 13, 2024 · 0 comments

Comments

@Titan-Node
Copy link

Instead of having to decrypt the private key and manually save it in the python file, would it be more secure to decrypt the JSON file within the script?

Instead of:

DELEGATOR_PRIVATE_KEY = 'InsertDelegatorPrivateKey'

We could decrypt the JSON file after we initialize w3 here:

assert w3.isConnected()

and do something like:

with open('path_to_your_keystore_file.json') as keyfile:
    encrypted_key = json.load(keyfile)
    private_key = w3.eth.account.decrypt(encrypted_key, password)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant