<p>Port 9735 is the lightning port. What BTCPay wants is the API.
C-Lightning does not support TCP natively, but one can use <code>socat</code> as I did in the <a href="https://github.com/btcpayserver/lightning/blob/master/tools/docker-entrypoint.sh#L15" rel="nofollow noreferrer">docker entrypoint</a> to bridge unix to TCP.</p>

CC BY-SA 4.0
2019-05-03T08:35:32.900Z
I'll add additional description if anyone like me will be searching for direct steps there are two ways to connect:

1) use socat. install and run command socat TCP-LISTEN:22345 UNIX-CONNECT:/path/to/.lightning/lightning-rpc
2) as suggested before, use https://github.com/ElementsProject/lightning-charge
baysx
CC BY-SA 4.0
2019-07-05T08:07:01.380Z
But what is the `EXPOSE_TCP` setting for then? I'm confused. I created a new question specifically about that, so that one of you can reap the benefits of answering another question. :)
https://bitcoin.stackexchange.com/questions/88862/is-it-possible-to-connect-remotely-to-a-c-lightning-node-with-an-exposed-tcp-por
gijswijs
CC BY-SA 4.0
2019-08-19T05:29:30.340Z
`EXPOSE_TCP` just mean that the container is running socat to expose RPC over TCP.
Nicolas Dorier
CC BY-SA 4.0
2019-05-02T12:22:22.700Z
2019-05-02T12:22:22.700Z
Nicolas Dorier
<p>I have BTCPay server and would like to use external c-lightning node which i have funded and prefer more over BTCPay server local docker container (DC). </p>

<p>In store configuration i see that there is option to connect to c-lightning over tcp or unix socket (this one is used when i connect internal node because c-lightning DC socket is linked to BTCPay directly).</p>

<p><a href="https://i.sstatic.net/IGJXM.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/IGJXM.png" alt="screenshot of store LN payment configuration menu"></a></p>

<p>How can i connect over TCP? As i uderstand this is not public nodes port (9735) which is used to communicate between nodes but some API port? How can i enable it on c-lightning? Is data sent plain and i should secure communication (lan, fw, vpn etc.)?</p>

CC BY-SA 4.0
2019-05-01T15:36:00.930Z
Can't give you the full answer but a hint. Unix domain sockets are local. So you could only connect to a Unix domain socket on that machine / within that docker container. One way is you could migrate your external lightning node inside your dicker container. Shut it down and copy `./lightning` dir. I am however sure there is a more elegant way. Also you will most likely not talk to your c Lightning node via port 9735 on tcp as that is what is used on the lightning network. It is new to me that clightning offers a tcp api. Which is the reason I could only comment here and not answer
Rene Pickhardt
CC BY-SA 4.0
2019-05-01T15:41:48.077Z
yeah, i see your point. i thought about "sharing" exactly lightning-rpc socket file over ssh or smth similar if its possible to share unix domain socket over lan at all. i have btcpay server and c-lightning on separate physical hosts in same lan, but would like to prefer not to move one into another if its possible.  i also could not find any mention about tcp listeners in lightningd help..
baysx
CC BY-SA 4.0
2019-05-01T17:14:04.827Z
Just a word of caution. In case you decide to migrate the node make sure to really migrate the latest channel state and don't run two seperate instances with the same files in the lightning-dir as this will most certainly produce channel beaches with lots of funds
Rene Pickhardt
<lightning-network><payment><payment-processors><core-lightning><micropayments>
Is it possible to connect to BTCPay server remote c-lightning node?
baysx
# Is it possible to connect to BTCPay server remote c-lightning node?

(Asked by: username_0 on 2019-05-01)

I have BTCPay server and would like to use external c-lightning node which i have funded and prefer more over BTCPay server local docker container (DC).

In store configuration i see that there is option to connect to c-lightning over tcp or unix socket (this one is used when i connect internal node because c-lightning DC socket is linked to BTCPay directly).

[![screenshot of store LN payment configuration menu](https://i.sstatic.net/IGJXM.png)](https://i.sstatic.net/IGJXM.png)

How can i connect over TCP? As i uderstand this is not public nodes port (9735) which is used to communicate between nodes but some API port? How can i enable it on c-lightning? Is data sent plain and i should secure communication (lan, fw, vpn etc.)?

**Tags:** lightning-network, payment, payment-processors, core-lightning, micropayments

> **Comments:**
> **username_1**: Can't give you the full answer but a hint. Unix domain sockets are local. So you could only connect to a Unix domain socket on that machine / within that docker container. One way is you could migrate your external lightning node inside your dicker container. Shut it down and copy `./lightning` dir. I am however sure there is a more elegant way. Also you will most likely not talk to your c Lightning node via port 9735 on tcp as that is what is used on the lightning network. It is new to me that clightning offers a tcp api. Which is the reason I could only comment here and not answer  
> **username_0**: yeah, i see your point. i thought about "sharing" exactly lightning-rpc socket file over ssh or smth similar if its possible to share unix domain socket over lan at all. i have btcpay server and c-lightning on separate physical hosts in same lan, but would like to prefer not to move one into another if its possible.  i also could not find any mention about tcp listeners in lightningd help..  
> **username_1**: Just a word of caution. In case you decide to migrate the node make sure to really migrate the latest channel state and don't run two seperate instances with the same files in the lightning-dir as this will most certainly produce channel beaches with lots of funds  

---

## 1 answers

### Answer by username_2 on 2019-05-02. Score: 2 | Accepted answer

Port 9735 is the lightning port. What BTCPay wants is the API.
C-Lightning does not support TCP natively, but one can use `socat` as I did in the [docker entrypoint](https://github.com/btcpayserver/lightning/blob/master/tools/docker-entrypoint.sh#L15) to bridge unix to TCP.

> **Comments:**
> **username_0**: I'll add additional description if anyone like me will be searching for direct steps there are two ways to connect:  1) use socat. install and run command socat TCP-LISTEN:22345 UNIX-CONNECT:/path/to/.lightning/lightning-rpc 2) as suggested before, use https://github.com/ElementsProject/lightning-charge  
> **username_3**: But what is the `EXPOSE_TCP` setting for then? I'm confused. I created a new question specifically about that, so that one of you can reap the benefits of answering another question. :) https://bitcoin.stackexchange.com/questions/88862/is-it-possible-to-connect-remotely-to-a-c-lightning-node-with-an-exposed-tcp-por  
> **username_2**: `EXPOSE_TCP` just mean that the container is running socat to expose RPC over TCP.  

---

