Skip to content

Instantly share code, notes, and snippets.

@dendisuhubdy
Forked from banteg/eth_wallets.py
Last active December 13, 2021 07:51
Show Gist options
  • Save dendisuhubdy/6d566fc8aa29372e751af66811172389 to your computer and use it in GitHub Desktop.
Save dendisuhubdy/6d566fc8aa29372e751af66811172389 to your computer and use it in GitHub Desktop.

Revisions

  1. dendisuhubdy revised this gist Dec 13, 2021. 1 changed file with 13 additions and 1 deletion.
    14 changes: 13 additions & 1 deletion eth_wallets.py
    Original file line number Diff line number Diff line change
    @@ -12,10 +12,22 @@ def main(count):


    def generate_pair():
    priv = generate_private_key()
    pubc = generate_public_key(priv)
    address = generate_public_address(pub)
    return priv.to_string().hex(), address

    def generate_private_key():
    priv = SigningKey.generate(curve=SECP256k1)
    return priv

    def generate_public_key(priv):
    pub = priv.get_verifying_key().to_string()
    return pub

    def generate_public_address(pub):
    address = keccak_256(pub).hexdigest()[24:]
    return priv.to_string().hex(), address
    return address


    if __name__ == '__main__':
  2. @banteg banteg revised this gist Jan 27, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion eth_wallets.py
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@
    def main(count):
    for i in range(count):
    priv, addr = generate_pair()
    print(priv, addr)
    print(priv, '0x' + addr)


    def generate_pair():
  3. @banteg banteg created this gist Jan 27, 2018.
    22 changes: 22 additions & 0 deletions eth_wallets.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    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, 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()