priestc / moneywagon

Universal bitcoin/altcoin blockchain client library for Python and the command line
http://multiexplorer.com
MIT License
149 stars 48 forks source link

generate_keypair doesn't work for certain cryptos #31

Open tpae opened 6 years ago

tpae commented 6 years ago

Here's the error message:

/moneywagon/__init__.py", line 333, in generate_keypair
    pub_byte, priv_byte = get_magic_bytes(crypto)
/moneywagon/core.py", line 823, in get_magic_bytes
    if priv_byte >= 128:
TypeError: '>=' not supported between instances of 'NoneType' and 'int'

This is happening because in core.py in get_magic_bytes function,

        pub_byte = crypto_data[crypto]['address_version_byte']
        priv_byte = crypto_data[crypto]['private_key_prefix']
        if priv_byte >= 128:
            priv_byte -= 128 #pybitcointools bug

Maybe we need to expand on currency support to accommodate this?

something like:

    support_categories = {
        'address': ['address_form', 'private_key_form'],
        'transaction': [ 'transaction_form', 'transaction_hash_algo', 'script_hash_algo'],
        'block': ['header_hash_algo'],
        'generate_keypair': ['address_version_byte', 'private_key_prefix'],
    }