1

I have successfully setup a C-lightning node on ubuntu using the tutorial. The problem I am having is trying to setup a second node that DOESN'T utilize the same .lightning hidden directory to run which means I can only run 1 node at a time. How do I clone and setup a second c-lightning node on the same machine and run it in it's own hidden directory? I am aware that both nodes need to direct to their own config files located in different paths.

1 Answer 1

1

you can run lightningd --help and get a list of arguments you can use to start lightning from the output there ist:

--lightning-dir=<dir>                Set working directory. All other files are
                                     relative to this
                                      (default: "/home/user/.lightning")

this means that you can set your own lightning-dir by calling lightningd --lightning-dir=/some/path/to/some/directory

now you can either put all the config values as additional arguments to your call or you put a config file into /some/path/to/some/directory/ which sets everything. the default is to call it config but you can also use the command line argument --conf=/path/to/some/conffile from lightningd to set a different one in a different location.

One thing you need to remember that both lightning nodes need to run on different tcp/ip ports. you do this by setting the port in your accounce addr in the config file announce-addr=IP-ADDR:PORT you need to replacei IP-ADDR with your address and the port with the port.

obviously when interacting with each of the nodes you need to tell lightning-cli which one. again the --help command helps (:

lightning-cli --help
Usage: lightning-cli <command> [<params>...]
--lightning-dir=<dir>  Set working directory. All other files are relative to this (default: "/home/user/.lightning")
...

this means you can for example do lightning-cli --lightning-dir=/some/path/to/somedir/ getinfo

5
  • I have setup both nodes in their respective config files with their own ports and directories: i.e.... announce-addr=x.x.x.x:9900 bind-addr=0.0.0.0:9900 ligtning-dir=/home/array/.lightning announce-addr=x.x.x.x:9902 bind-addr=0.0.0.0:9902 ligtning-dir=/home/array/.lightning2 but when I run… lightningd --network=bitcoin --log-level=debug on either folder…they both startup in the .lightning folder where only one can run at a time…
    – Next Layer
    Aug 20, 2019 at 18:14
  • perhaps i am installing and configuring c-lightning wrong....when I setup the second c-lightning....I just used git clone github.com/ElementsProject/lightning.git lightning2 cd lightning2
    – Next Layer
    Aug 20, 2019 at 18:22
  • Although helpful, this doesn't solve the problem of running both at the same time. As soon as I activate the first node, the second one cannot be initiated.
    – Next Layer
    Aug 20, 2019 at 23:09
  • It just says "We seem to be missing gossip messages"
    – Next Layer
    Aug 20, 2019 at 23:14
  • you don't need to clone the source code twice! it is sufficient to download, compile and install the software once and then you can run two nodes exactly in the way how I wrote it. The error message "we seem to be missing gossip messages" seems to be a different problem (for example each node needs to peer with at least one public node in order to retrieve information about the network) Aug 24, 2019 at 8:04

Your Answer

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

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