Last active
May 19, 2024 18:42
-
-
Save Aviksaikat/fd22f2441172b8ce7e613e04a310b5e4 to your computer and use it in GitHub Desktop.
Get the public address of an EOA from private key(randomly generated)
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
from eth_account import Account | |
# Generate a new Ethereum private key | |
private_key = Account.create()._private_key.hex() | |
# Print the private key | |
print("Private Key:", private_key) | |
# Derive the Ethereum address from the private key | |
address = Account.from_key(private_key).address | |
# Print the Ethereum address | |
print("Address:", address) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment