Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bitcoin Cash addresses not valid #31

Closed
merc1er opened this issue Sep 25, 2018 · 2 comments
Closed

Bitcoin Cash addresses not valid #31

merc1er opened this issue Sep 25, 2018 · 2 comments

Comments

@merc1er
Copy link

merc1er commented Sep 25, 2018

Addresses generated using the Bitcoin Cash (BCH) network are not valid, while they are when using the Bitcoin Core (BTC) network.

Here is an example of returned addresses running the following code:

from pywallet import wallet
import pprint as pp

# generate 24 word mnemonic seed
seed = wallet.generate_mnemonic(strength=256)

w = wallet.create_wallet(network='BCH', seed=seed, children=10)

pp.pprint(w)

Returns:

...
{'address': 'CNzDhHkL3B5ubi5439mi57HgQD8UKQKFvA',
 'children': [{'address': 'CPFDNsRBFDqRKBqx3v1oqtya9NcdoaJaVr',
              {'address': 'CHwdg1ud5UGEGH5zPdSFTDNqq8yL8WoqZZ',
              {'address': 'CSKzN9vteXumbeLLtmuqxS1GYLMfBwxd6N',
              {'address': 'CTmbWvsnc6MSJ7t2Zi7WhJ3oxptE76GFJJ',
              {'address': 'Cb1CuvHuEdPVKYVfMRXzoxe18EYLtg76vF',
              {'address': 'CfmWPcgkLR56N4XwHYaEhXVEhMiXoaSvuw',
              {'address': 'CaQEjsCHHMy7mWmkFMvwCu1Ma13nd1tybL',
              {'address': 'CZQ5KpGKc5ubjWQ2GN8ScKizkpKXRdnfhP',
              {'address': 'CYpSm7iWdapD8aWuXecBVpn8cSWr57mfRY',
              {'address': 'CdqVNvBWK4BC6EPVQZ54A4pvGxGpQVs6Re',
...

Which are not valid Bitcoin addresses.

@merc1er
Copy link
Author

merc1er commented Sep 26, 2018

Okay so I dug deeper and I found out that the version bytes are incorrect for the BCH network in pywallet/network.py.
See https://github.com/Bitcoin-ABC/bitcoin-abc/blob/master/src/chainparams.cpp

@hurlenko
Copy link

These are valid bitcoin cash addresses, though I don't recommend using this address format as it is not supported by most of the wallets. You can use this converter to convert between any of the 3 supported address types. Switch your application to CashAddr addresses, bitcoincash: prefixed

@merc1er merc1er closed this as completed Nov 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants