Split address generation steps
This commit is contained in:
parent
51e8a16f52
commit
80cc54e3ba
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
8
setup.py
8
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,
|
||||
|
Loading…
Reference in New Issue
Block a user