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

Add compatbility for bech32 (segwit) vouts #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

who-biz
Copy link

@who-biz who-biz commented Aug 2, 2022

Resolves #15. Also updated bech32.py to latest reference code from Pieter Wuille

@Spifferson
Copy link

Thanks. Works well. I did notice a tiny bug. It seems like 40 isn't high enough for line 373 in utils.py, "elif out['out_type'] in (28, 40):" it occasionally returns an out of range error. I set it to 41 and it seems to work ok. I was able to monitor the errors by using try: and found that when I printed witver, it would = 81 for every out of range error encountered but otherwise returned 0.

@who-biz
Copy link
Author

who-biz commented Aug 4, 2022

@Spifferson I will check with a BTC base if I can. This was tested using a ZEC source with segwit enabled. Only had outputs of types 28 and 40 on there. Based on what you're saying above, this may not be the same on BTC

@who-biz
Copy link
Author

who-biz commented Aug 4, 2022

Can you paste your full error text here?

@Spifferson
Copy link

I'm unable to reproduce the error now. I updated my bitcoin core which was a few days behind and now I'm not getting the error. When I view the outputs all I see are 0,1,28 and 40's. I should have mentioned that I've actually modified your code fairly heavily which may have had something to do with the error. I've converted the whole thing over to Python 3.x for use on windows 10 using Microsoft c++ build tools to access levelDB. Python 2.7 is just too old. Also, I can now stipulate in the main btcposbal2csv.py file with a True or False if I want to extract bc1 or not. I've also added a few bells and whistles to show the time it takes from start to finish, the file size of the output csv file and the number of keys (lines) it has deposited. It also plays a little medley when it's done. I've even included a line level argparse --test True which will use a simple break command in Utils.py (def parse_ldb) to abort the extraction early, after say 10000 keys to make debugging easier (should have done that ages ago). I removed height entirely because I didn't find it useful and it added substantial time. Height might have been useful if I could have stipulated ASC/DESC for it and that way I could view the keys going all the way back to the very first bitcoin transaction. I may try to incorporate that some time later when I have time. Also removed all reference to that odd "can't extract this sort of key" the ones labeled 2,3,4 and 5 (also deleted ref. to it in utils.py). No adverse effects experienced. Also, with height removed I can extract all keys beginning with 1 (--P2PKH) in around 10 minutes using a Ryzen 7 5700g. Being new-ish to Python I had a really hard time wrapping my head around all this code but now I've almost mastered it. It's a good piece of code! Thanks!

@who-biz
Copy link
Author

who-biz commented Aug 11, 2022

Great to hear. Seems that this is tested and functional on both BTC and a ZCash-derived codebase (with strictly transparent addresses).

Seems good to go for a merge.

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

Successfully merging this pull request may close these issues.

btcposbal2csv.py doesn't extract segwit
2 participants