18 lines
455 B
Python
18 lines
455 B
Python
import os
|
|
from eth_keys import keys
|
|
|
|
# Generating a private key
|
|
private_key_hex = os.urandom(32)
|
|
private_key = keys.PrivateKey(private_key_hex)
|
|
|
|
# Getting the public key
|
|
public_key = private_key.public_key
|
|
|
|
# compute the Ethereum address from the public key
|
|
address = public_key.to_checksum_address()
|
|
|
|
print(f"key='{hex(private_key)[2:]}' # {address}")
|
|
# print("Private key:", private_key)
|
|
# print("Public key:", public_key)
|
|
# print("Address:", address)
|