funga

Signer and keystore daemon and library for cryptocurrency software development
Log | Files | Refs | README | LICENSE

commit 80cc54e3ba11fe571eacfa016744f728184188e6
parent 51e8a16f52c27718361cb685895abaa2aab818e8
Author: nolash <dev@holbrook.no>
Date:   Thu, 25 Mar 2021 19:14:55 +0100

Split address generation steps

Diffstat:
Mcrypto_dev_signer/encoding.py | 16++++++++++++----
Rcrypto_dev_signer/keystore/postgres.py -> crypto_dev_signer/keystore/reference.py | 0
Mcrypto_dev_signer/runnable/signer.py | 2+-
Mrequirements.txt | 2+-
Msetup.py | 8++++----
5 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/crypto_dev_signer/encoding.py b/crypto_dev_signer/encoding.py @@ -12,10 +12,7 @@ from hexathon import ( logg = logging.getLogger(__name__) -def private_key_to_address(pk, result_format='hex'): - pubk = coincurve.PublicKey.from_secret(pk.secret) - logg.debug('secret {} '.format(pk.secret.hex())) - pubk_bytes = pubk.format(compressed=False) +def public_key_bytes_to_address(pubk_bytes, result_format='hex'): h = sha3.keccak_256() logg.debug('public key bytes {}'.format(pubk_bytes.hex())) h.update(pubk_bytes[1:]) @@ -27,6 +24,17 @@ def private_key_to_address(pk, result_format='hex'): raise ValueError('invalid result format "{}"'.format(result_format)) +def public_key_to_address(pubk, result_format='hex'): + pubk_bytes = pubk.format(compressed=False) + return public_key_bytes_to_address(pubk_bytes, result_format='hex') + + +def private_key_to_address(pk, result_format='hex'): + pubk = coincurve.PublicKey.from_secret(pk.secret) + logg.debug('secret {} '.format(pk.secret.hex())) + return public_key_to_address(pubk, result_format) + + def is_address(address_hex): try: address_hex = strip_0x(address_hex) diff --git a/crypto_dev_signer/keystore/postgres.py b/crypto_dev_signer/keystore/reference.py diff --git a/crypto_dev_signer/runnable/signer.py b/crypto_dev_signer/runnable/signer.py @@ -16,7 +16,7 @@ from jsonrpc.exceptions import * # local imports from crypto_dev_signer.eth.signer import ReferenceSigner from crypto_dev_signer.eth.transaction import EIP155Transaction -from crypto_dev_signer.keystore import ReferenceKeystore +from crypto_dev_signer.keystore.reference import ReferenceKeystore from crypto_dev_signer.error import UnknownAccountError logging.basicConfig(level=logging.WARNING) diff --git a/requirements.txt b/requirements.txt @@ -8,4 +8,4 @@ confini~=0.3.6a3 sqlalchemy==1.3.20 coincurve==15.0.0 pycrypto==2.6.1 -hexathon==0.0.1a4 +hexathon~=0.0.1a5 diff --git a/setup.py b/setup.py @@ -24,18 +24,18 @@ f.close() setup( name="crypto-dev-signer", - version="0.4.14a4", + version="0.4.14a8", description="A signer and keystore daemon and library for cryptocurrency software development", author="Louis Holbrook", author_email="dev@holbrook.no", packages=[ 'crypto_dev_signer.eth.signer', - 'crypto_dev_signer.eth.web3ext', - 'crypto_dev_signer.eth.helper', + #'crypto_dev_signer.eth.web3ext', + #'crypto_dev_signer.eth.helper', 'crypto_dev_signer.eth', 'crypto_dev_signer.keystore', 'crypto_dev_signer.runnable', - 'crypto_dev_signer.helper', + #'crypto_dev_signer.helper', 'crypto_dev_signer', ], install_requires=requirements,