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

Wrong address from PrivateKeyTestnet #7

Closed
anastasiia-bilova opened this issue Jun 8, 2018 · 8 comments
Closed

Wrong address from PrivateKeyTestnet #7

anastasiia-bilova opened this issue Jun 8, 2018 · 8 comments

Comments

@anastasiia-bilova
Copy link

Hello! Thanks a lot for your library!

I have the following problem, when I generate the instance of the PrivateKeyTestnet and get the public address I got the address I cannot send money to:

>> key = PrivateKeyTestnet()
>> key.address
qq6pzzfpuf9uumjmeayfw9qtuy7w386kyy42pkdau8

Even if I compress it, I get the same error called One or more input or output is invalid:

>> key = PrivateKeyTestnet(wif='cMqw...')
>> key.address
qpgdlktn6ltjgxd4dz63rtn6gk6dk0wnusth8axycv

selection_215

When I send money (through ccoin-cash web-site) from my own test-net address mntaWjMep9AVmssAg7bd9hEHmNsuLtZDSS to another also mine, all goes fine.

>>> len('qpgdlktn6ltjgxd4dz63rtn6gk6dk0wnusth8axycv') == len('mntaWjMep9AVmssAg7bd9hEHmNsuLtZDSS')
False

Can you help me with this question or even with all process to create signed offline raw transaction through your library? Thanks a lot!

@ghost
Copy link

ghost commented Jun 13, 2018

Hi Anastasia!

I'm sorry for the wait. Have been out for a few days. I'll take a look into this and get back to you shortly. I do have some test cases with testnet, but my use has all been mainnet, so the odds of a bug with testnet are fairly high.

-Teran

@ghost
Copy link

ghost commented Jun 13, 2018

Okay, turns out this isn't a bitcash bug afterall. ccoin.cash is using the old Bitcoin address format and hasn't updated to cashaddr. If you want to use bitcash with ccoin, you'll need to convert the cashaddr to the legacy address.

One site you can do this with is: https://cashaddr.bitcoincash.org

If you want to keep this within Python, you can do so with cashaddress: https://github.com/oskyk/cashaddress

cashaddress is already used inside this repository. You can send to legacy addresses, but the .address property will always return the cashaddr format.

I hope this helps! Let me know if you have any questions.

@ghost
Copy link

ghost commented Jun 13, 2018

Oh, about raw transactions, just use .create_transaction() and it will give you something that you can broadcast, just the hex output.

https://github.com/sporestack/bitcash/blob/master/bitcash/wallet.py#L208

@anastasiia-bilova
Copy link
Author

Teran, thank you so much for your reply!

You helped me a lot, with new converted BCH address everything works!

And thank you for your cool library!

@AustEcon
Copy link
Contributor

AustEcon commented Jul 7, 2018

anastasia-bilova - I found a great library for converting between BCH and legacy addresses natively in python - https://github.com/oskyk/cashaddress - super handy little one to have in your tool belt :)

@ghost
Copy link

ghost commented Jul 7, 2018

You're welcome! Glad I could help.

Though most of the credit goes to @ofek, he wrote the bit library for Bitcoin which I ported this from. He did 99% of the legwork.

@AustEcon
Copy link
Contributor

AustEcon commented Jul 9, 2018

I would also like to thank you for this library. Absolutely amazing. You have made a huge difference to the BCH ecosystem with this, regardless of who did the original core work. Still takes effort to connect all the ports, add extra features, taylor it to BCH and make it work right out of the box.

@ghost
Copy link

ghost commented Jul 9, 2018

Thank you! I really appreciate that. I needed it myself and I'm glad you've been able to find it useful as well.

Will close this out for now.

@ghost ghost closed this as completed Jul 9, 2018
merc1er pushed a commit that referenced this issue Dec 18, 2021
This issue was closed.
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