Skip to content

Instantly share code, notes, and snippets.

@banteg
Last active August 13, 2021 04:07
Show Gist options
  • Save banteg/136f927d4556f24ce1f64fa7e5e3a5dd to your computer and use it in GitHub Desktop.
Save banteg/136f927d4556f24ce1f64fa7e5e3a5dd to your computer and use it in GitHub Desktop.
from ecdsa import SigningKey, SECP256k1
from sha3 import keccak_256
import click
@click.command()
@click.argument('count', type=click.types.IntRange(1, 1000), default=1)
def main(count):
for i in range(count):
priv, addr = generate_pair()
print(priv, '0x' + addr)
def generate_pair():
priv = SigningKey.generate(curve=SECP256k1)
pub = priv.get_verifying_key().to_string()
address = keccak_256(pub).hexdigest()[24:]
return priv.to_string().hex(), address
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment