Skip to content

Instantly share code, notes, and snippets.

@reiven
Created April 6, 2017 15:30
Show Gist options
  • Save reiven/169f09efd9798995b2d8d7176f8d8889 to your computer and use it in GitHub Desktop.
Save reiven/169f09efd9798995b2d8d7176f8d8889 to your computer and use it in GitHub Desktop.
ethereum address generator
# -*- coding: utf-8 -*-
#!/usr/bin/python
# pip install ecdsa
# pip install pysha3
from ecdsa import SigningKey, SECP256k1
import sha3
keccak = sha3.keccak_256()
priv = SigningKey.generate(curve=SECP256k1)
pub = priv.get_verifying_key().to_string()
keccak.update(pub)
address = keccak.hexdigest()[24:]
print("Private key:", priv.to_string().encode('hex'))
print("Public key: ", pub.encode('hex'))
print("Address: 0x" + address)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment