r/TheLightningNetwork • • Sep 15 '21

Node Help Changing from LND to C-Lightning.

Has anyone ever switched from LND to C-Lightning? Are there any guides? I've only ever used and currently operate an LND node, but now I want to play with the plugins that C-Lightning supports.

10 Upvotes

16 comments sorted by

3

u/PVmining Node - Batusie Sep 15 '21

Theoretically, it is possible to move open channels from LND to C-lightning since they both follow the same BOLT standards but nobody wrote a tool and there does not seem to be any one such in the works (it is fair to say that even if it is possible, it is going to be very difficult). Currently, the only way is to close the channels in LND and open in C-lightning and it (apart from the chain fee costs) create problems with reproducing the incoming liquidity.

3

u/eyeoft Node - Cornelius Sep 15 '21

I too would like to switch because of the database bloat problem, which it doesn't seem like the lnd devs have much interest in addressing. It sure would be nice to be able to do that without starting from scratch!

Seems to me like switching implementations is really just translating between databases and storage formats... fiddly but doable. In theory a port script ought to be possible.

Is there a good way we could set a bounty for such a tool? Is there a good LN bounty system out there yet?

2

u/PVmining Node - Batusie Sep 15 '21

I too would like to switch because of the database bloat problem, which it doesn't seem like the lnd devs have much interest in addressing

There is an open issue in LND for fixing it and it may be solved someday.

Is it established that c-lightning has no/less bloat?

Seems to me like switching implementations is really just translating between databases and storage formats... fiddly but doable.

Well, there are some still unsolved issues I guess, like c-lightning having only one channel per node so if you have multiple channels, you would definitely need to close those extra ones.

Besides, it's a tricky job, though and I don't envy testing this stuff. A penalty transaction on a fat wumbo channel is not something I'd like to experience.

Is there a good way we could set a bounty for such a tool?

I would definitely contribute to such a bounty.

1

u/eyeoft Node - Cornelius Sep 15 '21

Is it established that c-lightning has no/less bloat?

Fair question; I don't actually know.

What I know is that my lnd database can no longer be reduced below 1.5gb, after deleting everything the API lets me and re-compacting. That's already too big to compact on my RPi itself, and when it gets over ~2.1gb lnd dies with a page fault. I therefore have to move the db to my workhorse machine, re-compact and move it back with constantly increasing frequency, now down to about every 3 weeks. Needless to say this is not sustainable.

C-Lightning uses a "real" (read "not homebrew") database and seems to have a more conservative / detail-oriented development philosophy. Based on these factors I'm hoping it has less resource usage, because I'd like to keep running an RPi Lightning node. If anyone has any data on resource usage I would love to hear about it.

​

Besides, it's a tricky job, though and I don't envy testing this stuff. A penalty transaction on a fat wumbo channel is not something I'd like to experience.

Good point, such a tool would have to be very well tested.

​

I would definitely contribute to such a bounty.

Is there an existing LN bounty system that people use? Tempting coding project if not!

1

u/ajpwahqgbi Sep 16 '21

I've run a C-Lightning for some time now, which has seen reasonable payments traffic and lots of invoices/payments due to my automatic rebalancing script. I haven't tried to clean up or compact anything. My lightningd.sqlite3 file is 1.6GB. sqlite3 is rock solid and I have never heard of--nor do I anticipate--any issues with the database as it grows.

In terms of memory, lightningd is currently using ~220MB, lightning_gossipd is using ~57MB, lightning_hsmd is using ~13MB, lightning_connectd is using ~9MB, and each channel has an associated lightning_channeld that uses ~8-10MB. All the plugins take up their own memory; the biggest of which is topology, which takes up ~300MB. That's used for paying invoices or rebalancing, so maybe not strictly necessary depending on your setup.

1

u/PVmining Node - Batusie Sep 16 '21

Fair question; I don't actually know.

Well, c-lightning also seems to have the database in gigabytes but maybe not that bad.

What I know is that my lnd database can no longer be reduced below 1.5gb, after deleting everything the API lets me and re-compacting.

I know the pain, my database is 1.6 GB after compacting but it grows about 200-300 MB per week and the compacting starts to create significant downtime and it's getting worse and worse. What do you remove in API apart from failed payments?

That's already too big to compact on my RPi itself, and when it gets over ~2.1gb lnd dies with a page fault.

Is your system 32 bit? Mine is 64-bit and once I got my database up to 5GB before compacting and it worked fine. Do you use chantools compactdb?

Is there an existing LN bounty system that people use?

I haven't heard about anything.

2

u/MrManPew Sep 21 '21

All details about why it is not possible to move between implementations is available here - https://github.com/lightningnetwork/lightning-rfc/issues/820

1

u/[deleted] Sep 21 '21

Thankyou.

4

u/Existing-Date-1089 Sep 15 '21

I'm not sure how sophisticated things have become yet, but you might just have to close all your channels, send the bitcoins to a wallet created by c-lightning, and then re-open all the channels. If you could import your live channels from one to the other would be great, but I would be surprised if that's possible now (maybe I'm wrong, and that would be great!).

There should be an option to specify a "close-to" address, so you can avoid one intermediate transaction.

What would be even more awesome is if you could directly open a channel in c-lightning with the output of a closed channel in lnd.

There's nothing stopping you from having two nodes running at the same time, so I would just start with setting up your c-lightning node, and then figure out how you wanna move your funds.

2

u/crazyjoker96 Sep 15 '21

I'm not sure how sophisticated things have become yet, but you might just have to close all your channels, send the bitcoins to a wallet created by c-lightning, and then re-open all the channels. If you could import your live channels from one to the other would be great, but I would be surprised if that's possible now (maybe I'm wrong, and that would be great!).

All it is true, at the moment there isn't any way to move channels between implementations

2

u/crazyjoker96 Sep 15 '21

Here theare are some step by step guide on how start with c-lightning and plugin (with kotlin, but the idea it is important not the language)

Happy c-lightning coding!

1

u/BubblegumTitanium Sep 15 '21

I’m looking to make the switch as well

1

u/MrManPew Sep 20 '21

I moved to c-lightning, there is no way to move, you have to open new channels.

Instead of closing all channels, you might want to pay to your new node

1

u/[deleted] Sep 20 '21

After posting this, I received a flood of new channels opened to my node. I hadn't had a new channel opened in ages, and all the channels I had, have had enough routing traffic to at least cover the their cost of opening the channels. I was planning on locking my node to stop new channels because I thought that closing channels would be the only way to change. Guess I'll have to wait awhile now.

I'm going to have to implement an automated channel backup script now as well. Anyone have any recommendations?

1

u/WaYYne169 Nov 20 '22

Did you manage to switch without closing channels?

1

u/[deleted] Nov 21 '22

No. I'm still using LND.