cardano-community / guild-operators

Artifacts and scripts created by Guild operators
https://cardano-community.github.io/guild-operators
MIT License
354 stars 177 forks source link

Import Ledger(v4.0.0) HW Wallet in CNTools does not create base.addr or payment.addr #1407

Closed gmoratorio closed 2 years ago

gmoratorio commented 2 years ago

Describe the bug After installing CNTools on a new Ubuntu laptop (note issue GH-1406 as well) , when importing a Ledger HW Wallet into CNTools in offline mode, the base.addr and payment.addr files are not generated.

To Reproduce Steps to reproduce the behavior: Install cntools via steps in https://cardano-community.github.io/guild-operators/basics/#pre-requisites

  1. mkdir "$HOME/tmp";cd "$HOME/tmp"
  2. curl -sS -o prereqs.sh https://raw.githubusercontent.com/cardano-community/guild-operators/master/scripts/cnode-helper-scripts/prereqs.sh
  3. chmod 755 prereqs.sh
  4. ./prereqs.sh
  5. . "${HOME}/.bashrc"
  6. ./prereqs.sh -w
  7. . "${HOME}/.bashrc"
  8. Manually add cardano-hw-cli to PATH (see GH-1406)
  9. Start CNTools in offline mode ./cntools.sh -o
  10. Import Ledger HW Wallet via CLI steps wallet/import/HW_Wallet
  11. base.addr and payment.addr are not generated
  12. payment.hwsfile, payment.vkey, stake.hwsfile, and stake.vkey are generated correctly

Expected behavior base.addr and payment.addr should be added to the newly generated HW Wallet's directory

Screenshots Note display when wallet is imported, address(es) are missing: Wallet Creation missing addr

Note when listing wallets, error due to missing address(es): Wallet List display error

Version:

Additional context May or may not be related to install issues described in GH-1406

Scitz0 commented 2 years ago

Can you please check the user permissions of cardano-hw-cli in $HOME/bin/cardano-hw-cli and post here. I have gone over the code and I cant see why it would fail. Both adding to PATH in prereqs.sh and cntools checks look alright to me. Only possible thing would be if cardano-hw-cli binary doesn't have execution permission.

Also post output in terminal of prereqs.sh command + cntools-history.log in $CNODE_HOME/logs/ after trying to add hw wallet.

gmoratorio commented 2 years ago

Thanks for getting back to me!

Pemissions for cardano-hw-cli

-rwxrwxr-x 1 woodlandpools woodlandpools 83237775 Apr 26 12:54 cardano-hw-cli

output of ./prereqs.sh -w command

Using apt to prepare packages for "Ubuntu" system
  Updating system packages...
[sudo] password for woodlandpools: 
  Installing missing prerequisite packages, if any..
Creating Folder Structure ..
Environment Variable already set up!
IOG fork of libsodium installed to /usr/local/lib/
Installing Vacuumlabs cardano-hw-cli
  downloading Vacuumlabs cardano-hw-cli...
  cardano-hw-cli already latest version [1.10.0], skipping!
Downloading files...

log output in cntools-history.log after trying to add wallet named Ledger Nano X

2022-05-03 16:07:22 MDT [DEBUG]  What would you like to do?
2022-05-03 16:07:22 MDT [DEBUG]  Selected value: [w] Wallet
2022-05-03 16:07:22 MDT [DEBUG]  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2022-05-03 16:07:23 MDT [INFO]    >> WALLET
2022-05-03 16:07:23 MDT [DEBUG]  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2022-05-03 16:07:23 MDT [DEBUG]  Select Wallet Operation
2022-05-03 16:07:25 MDT [DEBUG]  Selected value: [i] Import
2022-05-03 16:07:26 MDT [DEBUG]  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2022-05-03 16:07:26 MDT [INFO]    >> WALLET >> IMPORT
2022-05-03 16:07:26 MDT [DEBUG]  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2022-05-03 16:07:26 MDT [DEBUG]  Select Wallet Import Operation
2022-05-03 16:07:47 MDT [DEBUG]  Selected value: [w] HW Wallet
2022-05-03 16:07:47 MDT [DEBUG]  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2022-05-03 16:07:47 MDT [INFO]    >> WALLET >> IMPORT >> HARDWARE WALLET
2022-05-03 16:07:47 MDT [DEBUG]  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2022-05-03 16:07:47 MDT [DEBUG]  Supported HW wallets: Ledger S, Ledger X, Trezor Model T
2022-05-03 16:07:47 MDT [INFO]   Is your hardware wallet one of these models?
2022-05-03 16:07:49 MDT [DEBUG]  Selected value: [y] Yes
2022-05-03 16:07:49 MDT [ACTION] cardano-hw-cli version
2022-05-03 16:07:49 MDT [DEBUG]  cardano-hw-cli version: 1.10.0
2022-05-03 16:07:52 MDT [DEBUG]  Name of imported wallet: Ledger Nano X
2022-05-03 16:07:52 MDT [ACTION] cardano-hw-cli version
2022-05-03 16:07:53 MDT [DEBUG]  cardano-hw-cli version: 1.10.0
2022-05-03 16:07:54 MDT [ACTION] cardano-hw-cli device version
2022-05-03 16:07:55 MDT [DEBUG]  hardware device: vendor=Ledger version=4.0.0
2022-05-03 16:07:55 MDT [DEBUG]  INFO: follow directions on hardware device to extract payment keys
2022-05-03 16:07:55 MDT [ACTION] cardano-hw-cli address key-gen --path 1852H/1815H/0H/0/0 --verification-key-file /opt/cardano/cnode/priv/wallet/Ledger_Nano_X/payment.vkey --hw-signing-file /opt/cardano/cnode/priv/wallet/Ledger_Nano_X/payment.hwsfile
2022-05-03 16:08:37 MDT [DEBUG]  INFO: repeat and follow instructions on hardware device to extract the stake keys
2022-05-03 16:08:37 MDT [ACTION] cardano-hw-cli address key-gen --path 1852H/1815H/0H/2/0 --verification-key-file /opt/cardano/cnode/priv/wallet/Ledger_Nano_X/stake.vkey --hw-signing-file /opt/cardano/cnode/priv/wallet/Ledger_Nano_X/stake.hwsfile
2022-05-03 16:08:39 MDT [ACTION] address build --payment-verification-key-file /opt/cardano/cnode/priv/wallet/Ledger_Nano_X/payment.vkey --stake-verification-key-file /opt/cardano/cnode/priv/wallet/Ledger_Nano_X/stake.vkey --out-file /opt/cardano/cnode/priv/wallet/Ledger_Nano_X/base.addr
2022-05-03 16:08:39 MDT [ACTION] address build --payment-verification-key-file /opt/cardano/cnode/priv/wallet/Ledger_Nano_X/payment.vkey --out-file /opt/cardano/cnode/priv/wallet/Ledger_Nano_X/payment.addr
2022-05-03 16:08:40 MDT [ACTION] stake-address build --stake-verification-key-file /opt/cardano/cnode/priv/wallet/Ledger_Nano_X/stake.vkey --out-file /opt/cardano/cnode/priv/wallet/Ledger_Nano_X/reward.addr
2022-05-03 16:08:40 MDT [INFO]   HW Wallet Imported : Ledger_Nano_X
2022-05-03 16:08:40 MDT [INFO]   Address            : 
2022-05-03 16:08:40 MDT [INFO]   Enterprise Address : 
2022-05-03 16:08:40 MDT [DEBUG]  You can now send and receive Ada using the above addresses. Note that Enterprise Address will not take part in staking
2022-05-03 16:08:40 MDT [DEBUG]  All transaction signing is now done through hardware device, please follow directions in both CNTools and the device display!
2022-05-03 16:08:40 MDT [DEBUG]  Using an imported hardware wallet in CNTools comes with a few limitations
2022-05-03 16:08:40 MDT [DEBUG]  Most operations like delegation and sending funds is seamless. For pool registration/modification however the following apply:
2022-05-03 16:08:40 MDT [DEBUG]  > Pool owner has to be a CLI wallet with enough funds to pay for pool registration deposit and transaction fee
2022-05-03 16:08:40 MDT [DEBUG]  > Add the hardware wallet containing the pledge as a multi-owner to the pool
2022-05-03 16:08:40 MDT [DEBUG]  > The hardware wallet can be used as the reward wallet, but has to be included as a multi-owner if it should be counted to pledge
2022-05-03 16:08:40 MDT [DEBUG]  Only the first address in the HD wallet is extracted and because of this the following apply if also synced with Daedalus/Yoroi:
2022-05-03 16:08:40 MDT [DEBUG]  > Address above should match the first address seen in Daedalus/Yoroi, please verify!!!
2022-05-03 16:08:40 MDT [DEBUG]  > If restored wallet contain funds since before, send all Ada through Daedalus/Yoroi to address shown in CNTools
2022-05-03 16:08:40 MDT [DEBUG]  > Only use the address shown in CNTools to receive funds
2022-05-03 16:08:40 MDT [DEBUG]  > Only spend Ada from CNTools, if spent through Daedalus/Yoroi balance seen in CNTools wont match
Scitz0 commented 2 years ago

That all looks alright.

EDIT I see now in cntools log that address build command is incomplete, missing cardano-cli at the beginning. So path to cardano-cli is not correctly set in env.

Have you modified CCLI entry in env or is it not available in PATH ?

gmoratorio commented 2 years ago

Well this is embarrassing... looks like I didn't have cardano-cli on this machine at all 🤦🏻‍♂️

I completed the prereqs to install CNTools, but since I didn't need the Cardano-node since this was going to be an offline machine, I didn't do the step that added cardano-cli

I added cardano-cli and it worked as expected.

Feel free to close this issue out, and I owe you a 🍻 if I see you at the next Cardano conf.

Truly appreciate your help. Thanks again

Scitz0 commented 2 years ago

Ok great to hear. Though I need to look into why we don't have a check for this.