You are on page 1of 1

import secrets

from eth_keys import keys

private_key ="{:64x".format (secrets.randbits(256))


private_key_bytes=bytes.fromhex(private_key)
public_key_hex=keys.PrivateKey(private_key_bytes).public_key
public_key_bytes=bytes.fromhex(str(public_key_hex)[2:])
public_address+keys.PrivateKey(public_key_bytes).to_address()

print(private_key+""+public_address)

You might also like