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

[bug]: lncli create is not honoring its documentation #8897

Closed
JaviLib opened this issue Jul 6, 2024 · 2 comments · Fixed by #9077
Closed

[bug]: lncli create is not honoring its documentation #8897

JaviLib opened this issue Jul 6, 2024 · 2 comments · Fixed by #9077
Labels
beginner Issues suitable for new developers cli Related to the command line interface documentation Documentation changes that do not affect code behaviour good first issue Issues suitable for first time contributors to LND inline documentation documentation within the code

Comments

@JaviLib
Copy link

JaviLib commented Jul 6, 2024

Background

lncli create is not honoring its documentation which says the following:

 embed/lnd/lncli --lnddir=lnd/ create --help
NAME:
   lncli create - Initialize a wallet when starting lnd for the first time.

USAGE:
   lncli create [command options] [arguments...]

CATEGORY:
   Startup

DESCRIPTION:

  The create command is used to initialize an lnd wallet from scratch for
  the very first time. This is interactive command with one required
  argument (the password), and one optional argument (the mnemonic
  passphrase).

  The first argument (the password) is required and MUST be greater than
  8 characters. This will be used to encrypt the wallet within lnd. This
  MUST be remembered as it will be required to fully start up the daemon.

  The second argument is an optional 24-word mnemonic derived from BIP
  39. If provided, then the internal wallet will use the seed derived
  from this mnemonic to generate all keys.

  This command returns a 24-word seed in the scenario that NO mnemonic
  was provided by the user. This should be written down as it can be used
  to potentially recover all on-chain funds, and most off-chain funds as
  well.

  If the --stateless_init flag is set, no macaroon files are created by
  the daemon. Instead, the binary serialized admin macaroon is returned
  in the answer. This answer MUST be stored somewhere, otherwise all
  access to the RPC server will be lost and the wallet must be recreated
  to re-gain access.
  If the --save_to parameter is set, the macaroon is saved to this file,
  otherwise it is printed to standard out.

  Finally, it's also possible to use this command and a set of static
  channel backups to trigger a recover attempt for the provided Static
  Channel Backups. Only one of the three parameters will be accepted. See
  the restorechanbackup command for further details w.r.t the format
  accepted.


OPTIONS:
   --single_backup value  a hex encoded single channel backup obtained from exportchanbackup
   --multi_backup value   a hex encoded multi-channel backup obtained from exportchanbackup
   --multi_file value     the path to a multi-channel back up file
   --stateless_init       do not create any macaroon files in the file system of the daemon
   --save_to value        save returned admin macaroon to this file

When I do the following command I obtain the following:

embed/lnd/lncli --lnddir=lnd/ create 34423423jjjjjkasdfsa
Input wallet password:
Confirm password:

Do you have an existing cipher seed mnemonic or extended master root key you want to use?
Enter 'y' to use an existing cipher seed mnemonic, 'x' to use an extended master root key
or 'n' to create a new seed (Enter y/x/n): n

Your cipher seed can optionally be encrypted.
Input your passphrase if you wish to encrypt it (or press enter to proceed without a cipher seed passphrase):

Generating fresh cipher seed...

[lncli] unable to generate seed: rpc error: code = Unavailable desc = connection error: desc = "transport: authentication handshake failed: tls: failed to verify certificate: x509: certificate signed by unknown authority (possibly because of \"x509: ECDSA verification failure\" while trying to verify candidate authority certificate \"mac-2.local\")"

Now, if you read carefully, it says that the fist argument is the password, and the second argument is optional.
But what I get is an interactive form asking for a password, that I already provided in the first argument, and it is also asking for a seed, which is optional according to the documentation.
And not only I am not obtaining the 24 words, but in fact I am returned an error.

This makes programatically configurations imposible. I have to attach a stdin and gess what lncliis going to ask, which is not optimal. I truly want the process to be fully automatic and be gifted with the 24 words, as the documentation promises.

Your environment

  • version of lnd 0.18.1b
  • which operating system Darwin
  • version of btcd, bitcoind, or other backend NEUTRINO
  • any other relevant environment details
@JaviLib JaviLib added bug Unintended code behaviour needs triage labels Jul 6, 2024
@guggero
Copy link
Collaborator

guggero commented Jul 8, 2024

Yeah, I see how the documentation is a bit weird here. So the [arguments...] part comes from the CLI library that generates the help text and is there for every command. But there are no command line arguments for the create command, only interactive queries.
So the text should say something like:

... This is interactive command with one required
  input prompt (the password), and one optional input (the mnemonic
  passphrase).

If you want to create a wallet programmatically, I suggest looking into lndinit which was created for that exact purpose.

@guggero guggero added beginner Issues suitable for new developers documentation Documentation changes that do not affect code behaviour good first issue Issues suitable for first time contributors to LND cli Related to the command line interface inline documentation documentation within the code and removed bug Unintended code behaviour needs triage labels Jul 8, 2024
@rhg4d9ow35
Copy link
Contributor

I would like to work on this issue! Can I take it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginner Issues suitable for new developers cli Related to the command line interface documentation Documentation changes that do not affect code behaviour good first issue Issues suitable for first time contributors to LND inline documentation documentation within the code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants