You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Create BitcoinCash from privatekey [bitcoincash:qr...] #57
@Pymmdrza, Basically Bitcoin Cash has 3 different types of Pay to Public Key Hash (P2PKH) addresses. Those are:
1, CashAddr addresses for Bitcoin Cash (ie starting with q or bitcoincash:q instead of 1)
2, BitPay-style addresses for Bitcoin Cash (ie starting with C instead of 1)
3, Legacy addresses for Bitcoin Cash (ie starting with 1)
So, on the currerent version of this hdwallet package; you can only generate addresses on the second type of BitPay-style addresses for Bitcoin Cash (ie starting with C instead of 1) style. In the upcoming version I will add the rest of them.
And also call this hdwallet.p2pkh_address() instead of hdwallet.p2wpkh_address() function because p2wpkh_address() is Pay to Witness Public Key Hash address or it's SegWit address.
I have similar problem:
I have BCH = Bitcoin Cash addresses dump, balanced addresses.
I also have hex pvks converted to BCH WIFs and addresses.
They don't match: I mean original addresses are 42 letters long, and when I remove "bitcoincash1" from the second - generated by HDwallet - I am getting 39 and 59 letters.
I have similar problem: I have BCH = Bitcoin Cash addresses dump, balanced addresses. I also have hex pvks converted to BCH WIFs and addresses. They don't match: I mean original addresses are 42 letters long, and when I remove "bitcoincash1" from the second - generated by HDwallet - I am getting 39 and 59 letters.
@Pymmdrza I don't see answer to my question in that code. It is just the same code Base58 for encoding addresses. No BCH distinction I see there. What's on your mind?
@Pymmdrza I don't see answer to my question in that code. It is just the same code Base58 for encoding addresses. No BCH distinction I see there. What's on your mind?
from hdwallet import HDWallet
from hdwallet.cryptocurrencies import BitcoinCash as BCH
from hdwallet.hds import BIP32HD
hdwallet = HDWallet(cryptocurrency=BCH, hd=BIP32HD)
...
hdwallet.from_private_key(private_key=pvk)
from hdwallet import HDWallet
from hdwallet.cryptocurrencies import BitcoinCash as BCH
from hdwallet.hds import BIP32HD
hdwallet = HDWallet(cryptocurrency=BCH, hd=BIP32HD)
...
hdwallet.from_private_key(private_key=pvk)
hdwallet very very It's unconventional and no principles are followed, and after a few days you wake up and see that they completely changed the structure of the library, without paying attention to the users and programmers who used them in their projects. @meherett
@Pymmdrza yep, you are right. I've seen the mega-change in HDwallet and I needed to rework all my scripts. That's shouldn't take place. I now used another library for BCH but will try yours later as it seems promising.
Activity
meherett commentedon Jun 3, 2022
@Pymmdrza, Basically Bitcoin Cash has 3 different types of Pay to Public Key Hash (P2PKH) addresses. Those are:
1, CashAddr addresses for Bitcoin Cash (ie starting with
qorbitcoincash:qinstead of1)2, BitPay-style addresses for Bitcoin Cash (ie starting with
Cinstead of1)3, Legacy addresses for Bitcoin Cash (ie starting with
1)So, on the currerent version of this
hdwalletpackage; you can only generate addresses on the second type of BitPay-style addresses for Bitcoin Cash (ie starting withCinstead of1) style. In the upcoming version I will add the rest of them.And also call this
hdwallet.p2pkh_address()instead ofhdwallet.p2wpkh_address()function becausep2wpkh_address()is Pay to Witness Public Key Hash address or it's SegWit address.Thanks.
pbies commentedon Feb 4, 2026
I have similar problem:
I have BCH = Bitcoin Cash addresses dump, balanced addresses.
I also have hex pvks converted to BCH WIFs and addresses.
They don't match: I mean original addresses are 42 letters long, and when I remove "bitcoincash1" from the second - generated by HDwallet - I am getting 39 and 59 letters.
Valid address from BCH dump:
qpqgzrp8803q3hc2w48wx4avpgry040cmvqhy4kgk8
Invalid addresses from HDwallet:
bitcoincash1qq6hag67dl53wl99vzg42z8eyzfz2xlkvsyvj90 bitcoincash1q4qp0380kg75cqv25k4zruwa87wefwz0uefv78jekagm2j8568rwq8vluve
(remove "bitcoincash1" from both and you get 39/59 letters)
How to operate properly here?
pbies commentedon Feb 5, 2026
@meherett addressing to you - maybe you know what is this about?
Pymmdrza commentedon Feb 5, 2026
Tip
It can be of great help to you if you examine it a little carefully:
libcrypto / Address Class
pbies commentedon Feb 5, 2026
@Pymmdrza I don't see answer to my question in that code. It is just the same code Base58 for encoding addresses. No BCH distinction I see there. What's on your mind?
Pymmdrza commentedon Feb 5, 2026
🫤🫤
Use :
"Bitcoin Cash", "BCH", b"\x00", b"\x05", b"\x80"BCH
Understand?
Refrence : libit
pbies commentedon Feb 5, 2026
@Pymmdrza I am already using BCH in HDWallet:
So what's your point?
Pymmdrza commentedon Feb 5, 2026
Use this : https://github.com/Pymmdrza/libcrypto
hdwallet very very It's unconventional and no principles are followed, and after a few days you wake up and see that they completely changed the structure of the library, without paying attention to the users and programmers who used them in their projects. @meherett
pbies commentedon Feb 5, 2026
@Pymmdrza yep, you are right. I've seen the mega-change in HDwallet and I needed to rework all my scripts. That's shouldn't take place. I now used another library for BCH but will try yours later as it seems promising.
itsm3abena commentedon Feb 5, 2026
Can you share us private key and address u expecting just to see the prefix, its for reference
pbies commentedon Feb 5, 2026
@itsm3abena
invalid:
valid:
meherett commentedon Feb 5, 2026
@pbies Thanks for catching that - it’s fixed now: 201a7f1
For now, please install the latest version directly from GitHub until the new package release is published:
Example
Output
{ "cryptocurrency": "Bitcoin-Cash", "symbol": "BCH", "network": "mainnet", "coin_type": 145, "entropy": null, "strength": null, "mnemonic": null, "passphrase": null, "language": null, "seed": null, "ecc": "SLIP10-Secp256k1", "hd": "BIP32", "semantic": "p2pkh", "root_xprivate_key": null, "root_xpublic_key": null, "root_private_key": null, "root_wif": null, "root_chain_code": null, "root_public_key": null, "strict": null, "public_key_type": "compressed", "wif_type": "wif-compressed", "derivation": { "xprivate_key": null, "xpublic_key": null, "private_key": "0000000000000000000000000000000000000000000000000000000000000001", "wif": "KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn", "chain_code": null, "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798", "uncompressed": "0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8", "compressed": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798", "hash": "751e76e8199196d454941c45d1b3a323f1433bd6", "fingerprint": "751e76e8", "parent_fingerprint": null, "addresses": { "std-bitcoincash": "bitcoincash:qp63uahgrxged4z5jswyt5dn5v3lzsem6cy4spdc2h", "std-p2pkh": "1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH", "std-p2sh": "4YSK54Y53wb45gfPWJyRf3EXqaRfbhfyao", "legacy-bitcoincash": "bitcoincash:qp63uahgrxged4z5jswyt5dn5v3lzsem6cy4spdc2h", "legacy-p2pkh": "1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH", "legacy-p2sh": "3LRW7jeCvQCRdPF8S3yUCfRAx4eqXFmdcr" } } }For a BitcoinCash address-only example, explore this https://github.com/hdwallet-io/python-hdwallet/blob/master/examples/addresses/slip10_secp256k1_address.py#L120
Thanks!
pbies commentedon Feb 5, 2026
@meherett yes, now it seems fixed, however I see different addresses, two sets:
Set 1 in code:
Set 2 in dump:
How to access set 2 in code? These names don't fit for addresses...
meherett commentedon Feb 5, 2026
@pbies, the two sets are equivalent overall, but P2SH differs:
STDandLegacyreturn different outputs. You can access all addresses like this:Output
pbies commentedon Feb 5, 2026
@meherett
Yes, thank you! These are valid and do not repeat: