nunchuk-io / nunchuk-desktop

GNU General Public License v3.0
75 stars 10 forks source link

Error to add Hardware key #33

Closed d6n13l0l1v3r closed 1 year ago

d6n13l0l1v3r commented 1 year ago

When I try to add my ledger nano X key to the app show me this error when try to add the key

image

this message is just after this screen

image

Notes:

MacOS Ventura 13.3.1 Nunchuck Desktop 1.9.17 Hardware key : Ledger Nano X

tongvanlinh commented 1 year ago

@d6n13l0l1v3r we have new patch with hwi 2.1.1 version. Could you try on this issue?

https://github.com/nunchuk-io/nunchuk-desktop/releases/download/1.9.18/nunchuk-mac-.33.zip

d6n13l0l1v3r commented 1 year ago

I try it and have same error

image

on the ledger screen don't arrive nothing

update to this version

image
tongvanlinh commented 1 year ago

@d6n13l0l1v3r Could you check the firmware version on your Nano X ? Beside that: In macos, there are some libs are required (python and libusb) to install it, try these commands: brew install libusb brew install python

d6n13l0l1v3r commented 1 year ago

the library are already installed

==> Downloading https://formulae.brew.sh/api/formula.jws.json
######################################################################## 100.0%
==> Downloading https://formulae.brew.sh/api/cask.jws.json
######################################################################## 100.0%
Warning: libusb 1.0.26 is already installed and up-to-date.
To reinstall 1.0.26, run:
  brew reinstall libusb
Warning: python@3.11 3.11.3 is already installed and up-to-date.
To reinstall 3.11.3, run:
  brew reinstall python@3.11
~

but I will re-install it again just in case image

about the version for my nanoX is :

tongvanlinh commented 1 year ago

@d6n13l0l1v3r thanks for your information. I've tried and finally I could reproduce it with precondition:

I've tried with hwi 2.2.1 (latest) and it seem works well. With current hwi (2.1.1) I think it should work with mainet. Could you try it on mainnet.

With testnet: I think we should upgrade hwi to 2.2.1 you can try to download latest hwi v2.2.1 HERE, then you can setting hardware driver like this (replace with your path to hwi) image

I will make another build with hwi latest 2.2.1 https://github.com/nunchuk-io/nunchuk-desktop/releases/download/1.9.18/nunchuk-macos-1.9.18.zip

d6n13l0l1v3r commented 1 year ago

to resume the previous version work ok in testnet but not in mainnet,

now the new build show this error

image

in mainnet and testnet also after download the new version for hwi as set the path

image

Note: all the previous test was try to add the key for mainnet

apologise if I miss something

giahuy98 commented 1 year ago

With the new build (https://github.com/nunchuk-io/nunchuk-desktop/releases/download/1.9.18/nunchuk-macos-1.9.18.zip), please disable the "Custom HWI Driver" and then try again @d6n13l0l1v3r.

d6n13l0l1v3r commented 1 year ago

@giahuy98 now when try to search the ledger device show

image
giahuy98 commented 1 year ago

Could you please provide a screenshot of the 'Custom HWI Driver' setting, @d6n13l0l1v3r It should look like this: image

d6n13l0l1v3r commented 1 year ago

Sure @giahuy98 , below all screen

image image image image
giahuy98 commented 1 year ago

We were unable to reproduce the error Could not scan devices: [-4099] Run command exit error!.

Could you please provide the output of the following command when running it on your Mac @d6n13l0l1v3r.

/Users/doliver/Downloads/hwi-2.2.1-mac-amd64/hwi --debug enumerate
d6n13l0l1v3r commented 1 year ago

@giahuy98 I install from the oficial repository with pip command like this

pip3 install -U hwi

~ pip3 show hwi
Name: hwi
Version: 2.2.1
Summary: A library for working with Bitcoin hardware wallets
Home-page: https://github.com/bitcoin-core/HWI
Author: Andrew Chow
Author-email: andrew@achow101.com
License: MIT
Location: /usr/local/lib/python3.11/site-packages
Requires: bitbox02, cbor, ecdsa, hidapi, libusb1, mnemonic, pyaes, pyserial, typing-extensions
Required-by:

image

giahuy98 commented 1 year ago

What about this command @d6n13l0l1v3r? (hwi downloaded from https://github.com/bitcoin-core/HWI/releases, not the one from pip3)

/Users/doliver/Downloads/hwi-2.2.1-mac-amd64/hwi --debug enumerate
d6n13l0l1v3r commented 1 year ago

@giahuy98 I did other test set the custom path to

/usr/local/bin/hwi

and test again and work image

image

image

image

Now my doubt is why if I use packet from https://github.com/bitcoin-core/HWI/releases/ work and with the version embedded in Nunchuk not ?

giahuy98 commented 1 year ago

Now my doubt is why if I use packet from https://github.com/bitcoin-core/HWI/releases/ work and with the version embedded in Nunchuk not ?

It appears that the hwi tool you used, /usr/local/bin/hwi was installed via pip3, and not from the hwi release page at https://github.com/bitcoin-core/HWI/releases/.

Based on the image you shared here: https://github.com/nunchuk-io/nunchuk-desktop/issues/33#issuecomment-1503794541, it seem like the hwi from the release page is also not working. Only your hwi installed from pip3 is working.

It's possible that your Mac, anti virus or other security measures are preventing Nunchuk from running hwi, even the one embedded within Nunchuk.

d6n13l0l1v3r commented 1 year ago

strange because I algo have sparrow and spectre and work well, I let see if other report same issue because I have default security from Mac and little snitch to filter outgoing traffic

d6n13l0l1v3r commented 1 year ago

@giahuy98 could you upload to release repo [SHA256SUMS.asc] for version [Nunchuk v1.9.18]

giahuy98 commented 1 year ago

The checksum file has been uploaded, @d6n13l0l1v3r.

Regarding the HWI issues, it appears that the latest version (2.2.1) has some problems running on Mac M1. Sparrow is building their own HWI binary for M1 instead of using the one from the official release page, which could be a reason why it works.

d6n13l0l1v3r commented 1 year ago

@giahuy98 just let you know, my Macbook is 2017 intel cpu.

image
giahuy98 commented 1 year ago

Sorry @d6n13l0l1v3r. We have only been able to reproduce the error when scanning Ledger using M1 with HWI 2.2.1. We really appreciate it if you could download HWI 2.2.1 from the release page https://github.com/bitcoin-core/HWI/releases and run it in Terminal to see if any errors occur

/path/to/your/downloaded-and-unzip-hwi-2.2.1/hwi --debug enumerate
d6n13l0l1v3r commented 1 year ago

sure @giahuy98

I download hwi-2.2.1-mac-amd64.tar.gz

result

~/Downloads/hwi-2.2.1-mac-amd64 ./hwi --debug enumerate
[38017] Module object for struct is NULL!
Traceback (most recent call last):
  File "struct.py", line 13, in <module>
ImportError: dlopen(/var/folders/vg/gh08wlnd5rn3k_6drvzgdpc80000gn/T/_MEIZIJyih/lib-dynload/_struct.cpython-39-darwin.so, 0x0002): tried: '/var/folders/vg/gh08wlnd5rn3k_6drvzgdpc80000gn/T/_MEIZIJyih/lib-dynload/_struct.cpython-39-darwin.so' (fcntl(fd, F_ADDFILESIGS_RETURN) failed with errno=7 in <FCF78D44-CB39-3D13-988F-D88C248A3D8C> '/private/var/folders/vg/gh08wlnd5rn3k_6drvzgdpc80000gn/T/_MEIZIJyih/lib-dynload/_struct.cpython-39-darwin.so', sliceOffset=0x00000000, codeBlobOffset=0x0000CD40, codeBlobSize=0x49545050), '/System/Volumes/Preboot/Cryptexes/OS/var/folders/vg/gh08wlnd5rn3k_6drvzgdpc80000gn/T/_MEIZIJyih/lib-dynload/_struct.cpython-39-darwin.so' (no such file), '/var/folders/vg/gh08wlnd5rn3k_6drvzgdpc80000gn/T/_MEIZIJyih/lib-dynload/_struct.cpython-39-darwin.so' (fcntl(fd, F_ADDFILESIGS_RETURN) failed with errno=7 in <FCF78D44-CB39-3D13-988F-D88C248A3D8C> '/private/var/folders/vg/gh08wlnd5rn3k_6drvzgdpc80000gn/T/_MEIZIJyih/lib-dynload/_struct.cpython-39-darwin.so', sliceOffset=0x00000000, codeBlobOffset=0x0000CD40, codeBlobSize=0x49545050), '/private/var/folders/vg/gh08wlnd5rn3k_6drvzgdpc80000gn/T/_MEIZIJyih/lib-dynload/_struct.cpython-39-darwin.so' (fcntl(fd, F_ADDFILESIGS_RETURN) failed with errno=7 in <FCF78D44-CB39-3D13-988F-D88C248A3D8C> '/private/var/folders/vg/gh08wlnd5rn3k_6drvzgdpc80000gn/T/_MEIZIJyih/lib-dynload/_struct.cpython-39-darwin.so', sliceOffset=0x00000000, codeBlobOffset=0x0000CD40, codeBlobSize=0x49545050), '/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/vg/gh08wlnd5rn3k_6drvzgdpc80000gn/T/_MEIZIJyih/lib-dynload/_struct.cpython-39-darwin.so' (no such file), '/private/var/folders/vg/gh08wlnd5rn3k_6drvzgdpc80000gn/T/_MEIZIJyih/lib-dynload/_struct.cpython-39-darwin.so' (fcntl(fd, F_ADDFILESIGS_RETURN) failed with errno=7 in <FCF78D44-CB39-3D13-988F-D88C248A3D8C> '/private/var/folders/vg/gh08wlnd5rn3k_6drvzgdpc80000gn/T/_MEIZIJyih/lib-dynload/_struct.cpython-39-darwin.so', sliceOffset=0x00000000, codeBlobOffset=0x0000CD40, codeBlobSize=0x49545050)
[38017] Module object for pyimod01_archive is NULL!
Traceback (most recent call last):
  File "PyInstaller/loader/pyimod01_archive.py", line 27, in <module>
ModuleNotFoundError: No module named 'struct'
[38017] Module object for pyimod02_importers is NULL!
Traceback (most recent call last):
  File "PyInstaller/loader/pyimod02_importers.py", line 28, in <module>
ModuleNotFoundError: No module named 'pyimod01_archive'
Traceback (most recent call last):
  File "PyInstaller/loader/pyiboot01_bootstrap.py", line 17, in <module>
ModuleNotFoundError: No module named 'pyimod02_importers'
[38017] Failed to execute script 'pyiboot01_bootstrap' due to unhandled exception!

after that download https://github.com/bitcoin-core/HWI/releases/download/2.2.1/hwi-2.2.1.tar.gz

result:

~/Downloads/hwi-2.2.1 ./hwi.py --debug enumerate
DEBUG:ledgercomm:=> b001000000
DEBUG:ledgercomm:<= 0107426974636f696e05322e312e310102 9000
DEBUG:ledgercomm:=> e105000100
DEBUG:ledgercomm:<= 0b675ab1 9000
WARNING:jade:No module named 'hwilib.devices.jadepy.jade_ble'
WARNING:jade:BLE scanning/connectivity will not be available
INFO:jade.tcp:Connecting to tcp:127.0.0.1:30121
DEBUG:root:Failed to connect to Jade simulator at tcp:127.0.0.1:30121
DEBUG:root:[Errno 61] Connection refused
[{"type": "ledger", "model": "ledger_nano_x", "label": null, "path": "DevSrvsID:429xxxxx31", "fingerprint": "0bxxxxb1", "needs_pin_sent": false, "needs_passphrase_sent": false}]
giahuy98 commented 1 year ago

Thanks @d6n13l0l1v3r, asking @achow101 on HWI now.

giahuy98 commented 1 year ago

Hi @d6n13l0l1v3r, Could you please try this new build? We are using our self-built HWI in this version. https://github.com/hadvluffy/macdeploynunchuk/suites/12474794572/artifacts/664846103

d6n13l0l1v3r commented 1 year ago

this version work perfect when I disable the "Custom HWI Driver"

image image