Skip to content

Instantly share code, notes, and snippets.

@brunneis
Created March 3, 2021 12:10
Show Gist options
  • Save brunneis/080656101593d11c6a3aa1401aceb445 to your computer and use it in GitHub Desktop.
Save brunneis/080656101593d11c6a3aa1401aceb445 to your computer and use it in GitHub Desktop.
Generate an Ethereum account with Python
from easyweb3 import EasyWeb3
import json
def generate_private_key(password: str) -> dict:
private_key = EasyWeb3().web3.eth.account.create()
private_key_dict = private_key.encrypt(password)
with open(f'./{private_key.address}.json', 'w') as output_file:
json.dump(private_key_dict, output_file)
password = '1234'
generate_private_key(password)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment