lightningnetwork / lnd

Lightning Network Daemon ⚡️
MIT License
7.68k stars 2.08k forks source link

[Question/Feature request] Migrate wallet and channels from c-lightning #4997

Closed 3nprob closed 3 years ago

3nprob commented 3 years ago

I have an existing c-lightning / lightningd node with a bunch of open channels.

I am now realizing that my use-case reqiures functionlity that for now only exist as integrations for lnd and will require a lot of reimplementations and implementation of new plugins for c-lightning.

Therefore I'd like to migrate to lnd.

Given the work, time, and capital involved in getting my c-lightning node to where it is today, I'd really like to not start from zero again.

Has anyone attempted this, or have an idea about if it's even an effort worthwhile pursuing where things stand today?

guggero commented 3 years ago

I don't see how this would ever be possible. The internal database structure of the projects are just too different. And even if you could migrate the data itself, the derivation paths for the private keys are probably different as well.

3nprob commented 3 years ago

@guggero Thanks for following up (and feel free to close if the following is considered OT here)

If my goal is to keep existing liquidity paths etc, would it make sense to:

  1. keep the existing c-lightning node (cl-0) with current channels with incoming liquidity, close pure outgoings
  2. Set up new lnd node (lnd-1)
  3. Open corresponding outgoing channels that were closed in 1
  4. Open channel cl-0 -> lnd-1 (with 0 fees)
  5. Set up new lnd node lnd-2
  6. Open channels lnd-2 -> cl-0, lnd-1 -> lnd-2 (with 0 fees)

My thinking being that the resulting triangle-node system will have the same net capacity and connectivity as the current single node, the only drawback apart from complexity being needing to lock up funds between the three nodes to keep those channels liquid

It feels like it should be possible to get a balanced channel between cl-0 <-> lnd-1, thereby only needing one new node instead of two

guggero commented 3 years ago

It sounds like you're mostly concerned about preserving the inbound capacity of your node, correct? Setting up a triangle of nodes to allow shifting the balance around is one option, yes.

Another option would be:

  1. Close all channels of cl-0 during a low-fee period (e.g. the weekend).
  2. Create a new lnd node, send the on-chain funds from cl to lnd.
  3. Open a few large-ish channels to well connected peers.
  4. Acquire inbound liquidity by:
    1. Using Loop to send off-chain funds and receive on-chain funds back.
    2. Lease a few inbound channels through Pool, then do circular rebalancing.
    3. A combination of both.

Of course this would all incur both on-chain and off-chain fees. But would it reduce the complexity of the resulting system by replacing one node with another instead of running three nodes.

Closing the issue as suggested, can still discuss migration strategies here though.