Forked from RareSkills/generate-ethereum-address-lower-level.py
Created
February 1, 2023 02:32
-
-
Save smallyunet/acffecc29926e4c917552531fa85c8ad to your computer and use it in GitHub Desktop.
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 ecpy.curves import Curve | |
from sha3 import keccak_256 | |
private_key = 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 | |
cv = Curve.get_curve('secp256k1') | |
pu_key = private_key * cv.generator # just multiplying the private key by generator point (EC multiplication) | |
concat_x_y = pu_key.x.to_bytes(32, byteorder='big') + pu_key.y.to_bytes(32, byteorder='big') | |
eth_addr = '0x' + keccak_256(concat_x_y).digest()[-20:].hex() | |
print('private key: ', hex(private_key)) | |
print('eth_address: ', eth_addr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment