16

According to the release notes v0.12.2.0 includes Ledger support. How do I generate a Ledger Monero wallet with the CLI (monero-wallet-cli)?

4
  • I can't create a wallet on my ledger, I have this error message : failed to generate new wallet: Fail SCard API : (-2146435069) Invalid handle. Device=0, hCard=0, hContext=1 Anyone know what's happen? Thanks guys.
    – Manlio
    Aug 17, 2018 at 15:23
  • Which operating system are you using?
    – dEBRUYNE
    Aug 18, 2018 at 10:10
  • Thanks for explaining step by step. I have Windows and get stuck by step number 4: -The CLI will, after executing aforementioned command, prompt your for a password. Make sure to set a strong password and confirm it thereafter. It doesn't let me write the password... So I can't ''set'' it...Why? How can I solve it? Thanks a lot!
    – user9108
    Aug 28, 2018 at 1:07
  • @user9108 - The current CLI version won't display the asterisks of the password. Thus, simply type your password and hit enter.
    – dEBRUYNE
    Aug 28, 2018 at 8:27

2 Answers 2

17

Windows

We first have to ensure that we're sufficiently prepared. This entails the following:

  1. This guide assumes you have already initialized your Ledger wallet and thus generated a 24 word mnemonic seed.

  2. You need to run / use CLI v0.17.3.0, which can be found here or on the downloads page of the official website.

  3. You need to install the Ledger Monero app. Instructions can be found here. In addition, make sure to set the network to Mainnet

  4. Your Ledger needs to be plugged in and the Ledger Monero app should be running.

  5. Either your daemon (monerod.exe) should be running and preferably be fully synced or you should connect to a remote node.

Now that we're sufficiently prepared, let's start!

  1. Go to the directory / folder v0.17.3.0 monerod.exe and monero-wallet-cli.exe are located.

  2. Open a new command prompt / powershell. This is done by first making sure your cursor isn't located on any of the files and subsequently doing SHIFT + right click. It will give you an option to "Open command window here". If you're using Windows 10, it'll, most likely, give you an option to open the Powershell.

  3. Now type:

    monero-wallet-cli.exe --generate-from-device <new-wallet-name> --subaddress-lookahead 3:200 (Win 7 + 8)

    .\monero-wallet-cli.exe --generate-from-device <new-wallet-name> --subaddress-lookahead 3:200 (Win 10)

Note that is simply a placeholder for the actual wallet name. If you, for instance, want to name your wallet MoneroWallet, the command would be as follows:

monero-wallet-cli.exe --generate-from-device MoneroWallet --subaddress-lookahead 3:200 (Win 7 + 8)

.\monero-wallet-cli.exe --generate-from-device MoneroWallet --subaddress-lookahead 3:200 (Win 10)

  1. The CLI will, after executing aforementioned command, prompt your for a password. Make sure to set a strong password and confirm it thereafter.

  2. The Ledger will ask whether you want to export the private view key or not. First and foremost, your funds cannot be compromised with merely the private view key. Exporting the private view key enables the client (on the computer - Monero v0.17.3.0) to scan blocks looking for transactions that belong to your wallet / address. If this option is not utilized, the device (Ledger) will scan blocks, which will be significantly slower. There is, however, one caveat. That is, if your system gets compromised, the adversary will potentially be able to compromise your private view key as well, which is detrimental to privacy. This is virtually impossible when the private view key is not exported.

  3. You may have to hit confirm twice before it proceeds.

  4. Your Ledger Monero wallet will now be generated. Note that this may take up to 5-10 minutes. Furthermore, there will be no immediate feedback in the CLI nor on the Ledger.

  5. monero-wallet-cli will start refreshing. Wait until it has fully refreshed.

  6. Congratulations, you can now use your Ledger Monero wallet in conjunction with the CLI.


Mac OS X

We first have to ensure that we're sufficiently prepared. This entails the following:

  1. This guide assumes you have already initialized your Ledger wallet and thus generated a 24 word mnemonic seed.

  2. You need to run / use CLI v0.17.3.0, which can be found here or on the downloads page of the official website.

  3. You need to install the Ledger Monero app.

  4. Your Ledger needs to be plugged in and the Ledger Monero app should be running.

  5. Either your daemon (monerod) should be running and preferably be fully synced or you should connect to a remote node.

Now that we're sufficiently prepared, let's start!

  1. Use Finder to browse to the directory / folder monero-wallet-cli (CLI v0.17.3.0) is located.

  2. Go to your desktop.

  3. Open a new terminal (if don't know how to open a terminal, see here).

  4. Drag monero-wallet-cli in the terminal. It should add the full path to the terminal. Do not hit enter.

  5. Now type:

    --generate-from-device <new-wallet-name> --subaddress-lookahead 3:200

Note that is simply a placeholder for the actual wallet name. If you, for instance, want to name your wallet MoneroWallet, the command would be as follows:

--generate-from-device MoneroWallet --subaddress-lookahead 3:200

Note that aforementioned text will be appended to the path of monero-wallet-cli. Thus, before you hit enter, your terminal should look like:

/full/path/to/monero-wallet-cli --generate-from-device <new-wallet-name> --subaddress-lookahead 3:200

Where the full path is, intuitively, the actual path on your Mac OS X.

  1. The CLI will, after executing aforementioned command, prompt your for a password. Make sure to set a strong password and confirm it thereafter.

  2. The Ledger will ask whether you want to export the private view key or not. First and foremost, your funds cannot be compromised with merely the private view key. Exporting the private view key enables the client (on the computer - Monero v0.17.3.0) to scan blocks looking for transactions that belong to your wallet / address. If this option is not utilized, the device (Ledger) will scan blocks, which will be significantly slower. There is, however, one caveat. That is, if your system gets compromised, the adversary will potentially be able to compromise your private view key as well, which is detrimental to privacy. This is virtually impossible when the private view key is not exported.

  3. You may have to hit confirm twice before it proceeds.

  4. monero-wallet-cli will start refreshing. Wait until it has fully refreshed.

  5. Congratulations, you can now use your Ledger Monero wallet in conjunction with the CLI.


Linux

We first have to ensure that we're sufficiently prepared. This entails the following:

  1. This guide assumes you have already initialized your Ledger wallet and thus generated a 24 word mnemonic seed.

  2. You need to run / use CLI v0.17.3.0, which can be found here or on the downloads page of the official website.

  3. You need to install the Ledger Monero app. In addition, you may have to add some udev-rules. A script can be found here.

  4. Your Ledger needs to be plugged in and the Ledger Monero app should be running.

  5. Either your daemon (monerod) should be running and preferably be fully synced or you should connect to a remote node.

Now that we're sufficiently prepared, let's start!

  1. Go to the directory / folder v0.17.3.0 monero-wallet-cli and monerod are located.

  2. Open a new terminal.

  3. Now type:

    ./monero-wallet-cli --generate-from-device <new-wallet-name> --subaddress-lookahead 3:200

Note that is simply a placeholder for the actual wallet name. If you, for instance, want to name your wallet MoneroWallet, the command would be as follows:

./monero-wallet-cli --generate-from-device MoneroWallet --subaddress-lookahead 3:200

  1. The CLI will, after executing aforementioned command, prompt your for a password. Make sure to set a strong password and confirm it thereafter.

  2. The Ledger will ask whether you want to export the private view key or not. First and foremost, your funds cannot be compromised with merely the private view key. Exporting the private view key enables the client (on the computer - Monero v0.17.3.0) to scan blocks looking for transactions that belong to your wallet / address. If this option is not utilized, the device (Ledger) will scan blocks, which will be significantly slower. There is, however, one caveat. That is, if your system gets compromised, the adversary will potentially be able to compromise your private view key as well, which is detrimental to privacy. This is virtually impossible when the private view key is not exported.

  3. You may have to hit confirm twice before it proceeds.

  4. Your Ledger Monero wallet will now be generated. Note that this may take up to 5-10 minutes. Furthermore, there will be no immediate feedback in the CLI nor on the Ledger.

  5. monero-wallet-cli will start refreshing. Wait until it has fully refreshed.

  6. Congratulations, you can now use your Ledger Monero wallet in conjunction with the CLI.


A few final notes:

  1. I'd strongly advise to test the full process first. That is, send a small amount to the wallet and subsequently restore it (using aforementioned guide) to verify that you can recover the wallet. Note that, upon recreating / restoring the wallet, you ought to append the --restore-height flag (with a block height before the height of your first transaction to the wallet) to the command in step 3 (Windows), step 5 (Mac OS X), or step 3 (Linux). More information about the restore height and how to approximate it can be found here.

  2. If you use a remote node, append the --daemon-address host:port flag to the command in step 3 (Windows), step 5 (Mac OS X), or step 3 (Linux).

  3. If desired, you can manually tweak the --subaddress-lookahead value. The first value is the number of accounts and the second value is the number of subaddresses per account. Thus, if you, for instance, want to pregenerate 5 accounts with 100 subaddresses each, use --subaddress-lookahead 5:100. Bear in mind that, the more subaddresses you pregenerate, the longer it takes for the Ledger to create your wallet.

  4. You only have to use the --generate-from-device flag once (i.e. upon wallet creation). Thereafter, you'd basically use it similar to how you normally use the CLI. That is:

[1] Make sure your Ledger is plugged in and the Monero app is running.

[2] Open monero-wallet-cli

[3] Enter the wallet name of your Ledger Monero wallet.

[4] Enter the password to open the wallet.

If the Ledger wallet files are not in the same directory as monero-wallet-cli, you ought to open monero-wallet-cli with the --wallet-file /path/to/wallet.keys/file flag. Alternatively, you can copy the Ledger wallet files to the same directory as monero-wallet-cli.

  1. It's imperative that the closing process of your Ledger Monero wallet is done in this specific consecutive order:

[1] Exit monero-wallet-cli by typing exit

[2] Exit the Ledger Monero app.

[3] Unplug the Ledger device.

  1. If you have any further questions or need assistance, please leave a comment in this thread.
7
  • Maybe this is a dump question but how do I use this wallet? How do I transfer XMR from and to it? It is not obvious for me. Jun 6, 2018 at 12:14
  • This should be helpful -> getmonero.org/resources/user-guides/monero-wallet-cli.html. Note that, once GUI v0.12.2.0 is out, you will be able to load your Ledger Monero wallet into the GUI.
    – dEBRUYNE
    Jun 6, 2018 at 12:15
  • I was able to create a wallet. But when I tried to re-open it a refreshing procedure started which took forever. This way it is completely unusable. Jun 7, 2018 at 21:08
  • Did you export your view key? Otherwise it will be fairly slow (this is mentioned in the guide by the way).
    – dEBRUYNE
    Jun 8, 2018 at 9:50
  • I answered the question with Yes. But I was not sure it is the right answer because I found the question ambiguous. Nevertheless "refreshing" is going so slow that I would have to connect it for more than 7 days uninterrupted to get this finished. This way I cannot use it. Jun 8, 2018 at 13:51
2

Adding a small guide for Manjaro Linux users here (and possibly other Arch-based systems as well) as the process is a bit different than how it is explained in:

https://github.com/LedgerHQ/blue-app-monero/blob/master/doc/user/bolos-app-monero.pdf

specifically part 3.2.1.

The guide tells you to install the following packages: "pcsc-tools" "pcscd" and "libpcsclite1:amd64". However on Manjaro I found that two of these do not exist in the repositories."pcsc-tools" package is there so you can just go ahead and install it. A package called "pcsclite" was already installed on my system and can otherwise be installed from the repo. "pcscd" and "libpcsclite1:amd64" however are missing. This means that there most likely is no file called "libccid_info.plist"and this file is needed and has to be configured as described in the guide.

What I did was to install the package called "ccid" and also a package called "opensc". Not entirely sure if both are needed and you could try to get the wallet working with only one of them, mainly I believe that it was "ccid" that made it work. If uncertain just install both as I did.

Then go ahead and add the lines as described in

https://github.com/LedgerHQ/blue-app-monero/blob/master/doc/user/bolos-app-monero.pdf section 3.2.1.

to /etc/"libccid_info.plist"

Finally I had to start the daemon "pcscd" because on my system it did not start automatically.

"sudo systemctl start pcscd.service" should do the trick.

If you want the service to start auto at boot the command would be:

"sudo systemctl enable pcscd.service"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.