3

I find it very convenient, one does not have to worry about the order of arguments, e.g.

lightning-cli -k invoice msatoshi=0.001btc label=label1 description="This is a description" expiry=45m

I would like to know the source of this acronym, what does k in -k stand for? Where can I read about it? I haven't found anything about it in lightning-cli help.

meshcollider
  • 11,695
  • 4
  • 24
  • 52
John Smith
  • 542
  • 2
  • 11

1 Answers1

5

This is actually the first thing I got confused with after I installed my a lightning node for the very first time back in 2018. c-lightning ships with two (actually more) programs

  1. lightningd
  2. lighthning-cli

lightning-cli is a command line tool that sends commands via JSON RPC over a unix domain socket to lightningd so if you type: lightning-cli help what actually happens is that you send the help command to lightningd this will give you a list of all commands that lightningd can accept.

This is different to the command line arguments that can be given to lightning-cli which you are asking about. You can get the command line arguments by typing in lightning-cli --help. My output looks like this:

lightning-cli --help
Usage: lightning-cli <command> [<params>...]
--conf=<file>             Specify configuration file
--lightning-dir=<dir>     Set base directory: network-specific subdirectory is
                          under here (default: "/home/user/.lightning")
--network <arg>           Select the network parameters (bitcoin, testnet,
                          signet, regtest, litecoin or litecoin-testnet)
                           (default: bitcoin)
--mainnet                 Alias for --network=bitcoin
--testnet                 Alias for --network=testnet
--signet                  Alias for --network=signet
--allow-deprecated-apis <arg>
                          Enable deprecated options, JSONRPC commands, fields,
                          etc. (default: true)
--rpc-file <arg>          Set JSON-RPC socket (or /dev/tty)
                           (default: "lightning-rpc")
--help|-h                 Show this message. Use the command help (without
                          hyphens -- "lightning-cli help") to get a list of all
                          RPC commands
-H|--human-readable       Human-readable output
-F|--flat                 Flatten output ('x.y.x=' format)
-J|--json                 JSON output (default unless 'help')
-R|--raw                  Raw, unformatted JSON output
-k|--keywords             Use format key=value for <params>
-o|--order                Use params in order for <params>
-N|--notifications <arg>  Set notification level, or none (default: info)
--version|-V              Print version and exit

From there you can see that the -k argument stands for keywords

-k|--keywords Use format key=value for <params>

For completeness there is even the possibility to get the command line arguments for lightningd by typing lightningd --help which gives you basically all config arguments and additionally the plugin system can append command line options.

Rene Pickhardt
  • 11,670
  • 8
  • 35