PIVX-Project / PET4L

PIVX Emergency Tool for Ledger - Spend PIV from a seemingly "Stuck" Ledger wallet
MIT License
10 stars 12 forks source link

[BUG] IsPayToColdStaking tries to parse empty rawTX with Trezor api #9

Closed random-zebra closed 3 years ago

random-zebra commented 3 years ago

Closes #8

jp-solutionz commented 3 years ago

Currently testing Win 10 produces the following error: C:\Users\JP\Downloads\PET4L-202011_fix-IsPayToColdStaking-trezor\PET4L-202011_fix-IsPayToColdStaking-trezor>pet4l.py Traceback (most recent call last): File "C:\Users\JP\Downloads\PET4L-202011_fix-IsPayToColdStaking-trezor\PET4L-202011_fix-IsPayToColdStaking-trezor\pet4l.py", line 31, in from mainApp import App File "C:\Users\JP\Downloads\PET4L-202011_fix-IsPayToColdStaking-trezor\PET4L-202011_fix-IsPayToColdStaking-trezor\src\mainApp.py", line 17, in from mainWindow import MainWindow File "C:\Users\JP\Downloads\PET4L-202011_fix-IsPayToColdStaking-trezor\PET4L-202011_fix-IsPayToColdStaking-trezor\src\mainWindow.py", line 20, in from hwdevice import HWdevice File "C:\Users\JP\Downloads\PET4L-202011_fix-IsPayToColdStaking-trezor\PET4L-202011_fix-IsPayToColdStaking-trezor\src\hwdevice.py", line 15, in from trezorClient import TrezorApi File "C:\Users\JP\Downloads\PET4L-202011_fix-IsPayToColdStaking-trezor\PET4L-202011_fix-IsPayToColdStaking-trezor\src\trezorClient.py", line 13, in from trezorlib import btc, exceptions, messages as trezor_proto, coins ImportError: cannot import name 'coins' from 'trezorlib' (C:\Users\JP\AppData\Local\Programs\Python\Python39-32\lib\site-packages\trezorlib__init__.py)

random-zebra commented 3 years ago

This is probably caused by a recent change in trezorlib. Please check that your version is not higher than v0.11.1 (will set it as maximum version in requirements.txt).

jp-solutionz commented 3 years ago

Okay the application now launches (python 3.9) after running "pip install trezor==0.11.1" (installed version was 0.12.2) however does not connect to any servers.

Also attempted downgrading to python 3.8 and following packages with same result: python-bitcoinrpc==1.0 bitcoin==1.1.42 btchip-python==0.1.27 trezor==0.11.1 PyQt5==5.14.0 requests==2.18.4 simplejson==3.17.2 ecdsa==0.16.0

The latest binary connects ok and I've disabled firewall etc and however I can't get either this branch or "master branch" or "2019_cold_staking_ledger" to connect so possibly something wrong with my config.

PET4L_Logs_2020-11-12_07-55-40.txt

jp-solutionz commented 3 years ago

I've also tried the "PyQt-5.9" release on Python 3.7.0 with the same result:

https://github.com/PIVX-Project/PET4L/archive/v0.1.0-c.zip python-bitcoinrpc==1.0 bitcoin==1.1.42 btchip-python==0.1.27 trezor==0.11.1 PyQt5==5.9.0 requests==2.18.4 simplejson==3.17.2 ecdsa==0.16.0

The wallet is able to check for new version and prompt for update so network stack seems fine however errors connecting to RPC server so perhaps there another dependency issue (binary version connects fine to same servers).

2020-11-12 18:52:07 : Checking PET4L version... ===> Remote version: 0.1.1 2020-11-12 18:52:13 : Trying to connect to RPC https://amsterdam.randomzebra.party:8080... 2020-11-12 18:52:15 : Connection to RPC server failed. EXCEPTION caller : run function : updateRPCstatus err: [WinError 10061] No connection could be made because the target machine actively refused it ===> Exception in RPC client EXCEPTION caller : run function : updateRPCstatus err: cannot unpack non-iterable NoneType object ===> exception updating RPC status:

PET4L_Logs_2020-11-12_18-52-56.txt

random-zebra commented 3 years ago

Mhm quite strange. Maybe an issue with either httplib or ssl modules (though they should be shipped already with python).

Anyway... I tested this with Trezor Model T on a Windows VM, and it works here.

I've built binaries and uploaded them here for testing: https://github.com/PIVX-Project/PET4L/releases/tag/v0.1.1-a-PR9

jp-solutionz commented 3 years ago

Great work @random-zebra !

I've tested the binary and was able to send the full balance from address #1 to address #2.

I'll also test on the original wallet and report back if any issues. Thanks for your help!

random-zebra commented 3 years ago

Glad it worked! Cheers :tumbler_glass:

jp-solutionz commented 3 years ago

Just tested the binary with Ledger Nano S and address 0 is correct however subsequent addresses differ from Ledger Live so any balances in change addresses previously used by Ledger Live transactions are not displayed.

This may be due to Ledger Live using path m/44'/77'/0' as opposed to Trezor etc which uses m/44'/119'/0'.

Perhaps an option is needed to select the correct path.

random-zebra commented 3 years ago

@jp-solutionz have you switched internal/external to 1 for change addresses?