I'm trying to run lighting-charge (https://github.com/ElementsProject/lightning-charge) on top of one of my 2 lightning (https://github.com/ElementsProject/lightning) instances. I am running 2 nodes using the script here: lightning/contrib/startup_regtest.sh. This file will start a bitcoin instance as well as 2 lightning nodes (/tmp/l1-regtest, /tmp/l2-regtest)

I then tried to run lightning-charge with:

$ NETWORK=regtest charged --api-token super_secret_1 --ln-path ~/.lightning --db-path ~/charge1.db --port 9112

Which gives me this error:

Lightning client connection error { Error: connect ECONNREFUSED ~/.lightning
    at Object._errnoException (util.js:1022:11)
    at _exceptionWithHostPort (util.js:1044:20)
    at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1198:14)
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: '~/.lightning' }
      throw er; // Unhandled 'error' event

Error: connect ECONNREFUSED ~/.lightning
    at Object._errnoException (util.js:1022:11)
    at _exceptionWithHostPort (util.js:1044:20)
    at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1198:14)

I've also tried running it with ln-path set to /tmp/l1-regtest/

with ps aux I can see lightning is running with this command:

~/git/lightning/lightningd/lightningd --lightning-dir=/tmp/l1-regtest
~/git/lightning/lightningd/lightningd --lightning-dir=/tmp/l2-regtest

Does anyone know how to get lightning-charge to connect to my regtest lightning node?

There are instructions on how to do this in docker in the readme file (https://github.com/ElementsProject/lightning-charge/blob/master/README.md), but it doesn't seem to work outside of docker.

  • Does lightning charge connect via a port to lightning? I just realized that the regtest lightning doesn't use the default port 9735 but actually uses 6060 and 9090
    – kschieck
    May 19, 2020 at 17:23
  • I guess I could just run it on docker and mount the lightning and Bitcoin dirs. It does explain how to do that in the readme. It's pretty complicated though so I was hoping to avoid using docker. I'll report back after I've tried that.
    – kschieck
    May 19, 2020 at 17:28

1 Answer 1


the problem is in your call of charged there you are passing the argument --ln-path ~/.lightning assuming that you run lightning in your home directory thus you have to set ln-path to /tmp/l1-regtest/.

Now you say that this also did not work. So before I give you a solution let me explain what is actually going on. charged talkes to lightningd via an rpc-interface on an UNIX Domain socket. In older versions of lightningd there was a file called lightning-rpc in the folder that you specified as lightning-dir however lightningd has switched its API recently to to have subdirectories in lightning-dir for mainnet, testnet and regtest. (the reason was that in particular in the default directory people wanted to have different configs for mainnet, testnet and regtest)

Thus I assume that you will find lightning-rpc when you do ls /tmp/l1-regtest/regtest which means that you should pass the tmp/l1-regtest/regtest in --ln-path when you call charged. If that is not the case I would have to see another error message.

  • 1
    It works! thank you and thanks for making all those yt videos!
    – kschieck
    May 19, 2020 at 19:30

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.